Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Build a line-following robot

Build the drive train of a line-following robot from library parts, connect power and motor control, organize the canvas and get a clean DRC

Goal

Build the Main controller board of the Line-Following Robot demo project by hand: an Arduino Nano, an L298N motor driver, two gearmotors and a 12 V battery. You'll connect power and control, group the motors, leave a note for your team and finish with a clean DRC. Every other tutorial uses this project.

Time: 15 to 20 minutes. You need: a free account. If you haven't used the editor yet, do the Quickstart first.

What you're building

Part
Role

Arduino Nano

Controller: reads the line sensor and drives the motors

L298N motor driver

Switches battery power to the motors under the Nano's control

2 × N20 gearmotors

Left and right wheels

12 V battery

Powers the motor driver

The line sensor comes later: in Design with ProtoBot, ProtoBot adds an IR sensor array to this board.

The finished Main controller board: Arduino Nano, L298N motor driver, two N20 gearmotors in a group labelled Drive motors, a 12 V battery and a note linked to the motor driver
The finished Main controller board.

Steps

1

Create the project and the board

  1. On Home, click + next to PROJECTS, name the project Line-Following Robot and click Create.

  2. Open the project from the sidebar and click New Board.

  3. Name the board Main controller and click Create board.

2

Add the parts

Open Parts Bin in the left rail and add each part with its Add button:

  1. Search arduino nano and add the Arduino Nano.

  2. Search L298N and add the L298N motor driver.

  3. Search N20 gearmotor and add it. Right-click the motor and choose Duplicate to make the second one.

  4. Search 12V battery and add a battery.

Parts land in free space near the middle of the canvas. Drag them into a rough left-to-right layout: battery, driver, motors on one side, Nano on the other.

Can't find a part? Click Can't find it? Request a part under the search results. See Request or fix a part.

3

Connect the battery to the driver

  1. Drag from the battery's edge handle to the L298N.

  2. In the Inspector, open Interface pair and choose the power pair.

  3. Rename the harness 12V motor supply in the harness name field.

4

Connect the driver to each motor

  1. Drag from the L298N to the left motor and choose the motor output pair.

  2. Rename it Left motor drive.

  3. Repeat for the right motor and name it Right motor drive.

The L298N has two motor channels. If you connect a third motor, the DRC reports that the interface is over capacity.

5

Connect the Nano to the driver

  1. Drag from the Arduino Nano to the L298N and choose the control pair for one channel. Name it Left motor control.

  2. Create a second harness for the other channel and name it Right motor control.

  3. If a harness stays amber, open Function Links in the Inspector and click Auto Assign, or pick pins in each row. See Resource allocation.

6

Group the motors

Group selected parts

Animated GIF · Steps:

  1. Drag a box around both motors (with nothing selected, dragging the canvas box-selects).

  2. Click Add group in the canvas toolbar. The group wraps the selection.

  3. In the Inspector, name the group Drive motors and pick a colour.

7

Leave a note for the team

Add a note and connect it

Animated GIF · Steps:

  1. Click Add note in the canvas toolbar. The note lands in free space.

  2. Type Check the L298N heat sink at stall current.

  3. With the note selected, use Connect annotation in the Inspector and choose the L298N, then click Create.

8

Check the DRC

  1. Open Board Review. Fix anything under BLOCKED first, then PARTIAL.

  2. Expand an issue and click the target icon to jump to it.

  3. When // DRC Issues reads "No DRC issues found", every harness is configured.

See Fixing DRC failures if an issue doesn't clear.

9

Describe the board

  1. Open Board Identity in the left rail.

  2. Add a description, the tags robotics and line-follower, and a requirement such as Runs 30 minutes on one charge.

ProtoBot and your teammates read this when they work on the board. See Board Identity, requirements and kits.

Result

You have a validated drive train with named harnesses, a group and a note. Next, let ProtoBot add the line sensor, or price the BOM.

Common failures

The motor harness is red: "No compatible interface pairs found"

You connected two parts that share no interface, for example the battery straight to a motor. Delete the harness and connect through the motor driver.

A control harness stays amber

Some functions have no pin assigned. The issue in Board Review names them ("Side A function ... not yet assigned to a resource"). Use Auto Assign or pick pins in Function Links.

Add group created an empty group

Nothing was selected. Select the parts first, then click Add group, or drag parts into the empty group.

Last updated