Introduction: Bluetooth Controlled Line-Following Car

This is a tutorial on how to make a small RC car with tunable line following abilities. The design is highly mod-able, allowing one to expand on the design to implement any other abilities desired. The car, as built here, can follow a line approximately 4"-5" in width, but the sensors can be relocated to follow thinner or thicker ones, with slight modifications to the code.

This is a great project for someone who has a basic working knowledge of Arduino, and wants to explore some more functionality.

Step 1: Tools and Materials

You can't build anything if you don't have any materials! This robot was built using parts sourced from our local RadioShack, pololu, and amazon; but you can probably also use found or recycled parts to make yours.

Materials:

  • 3/8" Acrylic Sheet (this will make up the main chassis)
  • 1/8" Acrylic Sheet (this will become the sensor bar)
  • Ball Caster (from pololu) (I would recommend getting a metal one instead)
  • Motor Controller (from pololu)
  • two 5V Motors and Wheels (from RadioShack)
  • Arduino Nano (3rd party from amazon)
  • Arduino Bluetooth Module (from amazon)
  • Line sensor module (from amazon)
  • Small solderless Breadboards (from amazon) (we used two for expandability, but you can easily reconfigure it for one)
  • Machine Screws
    • two 4-40 x 1.500"
    • two 4-40 x 0.875"
    • four 4-40 x 1.250"
    • four 4-40 x 0.750"
    • four 4-40 x 0.625"
    • one 8-32 x 0.500"
  • Washers for 4-40 screws
  • 0.250" thick Spacers (to fit 5-40 screws)
  • two 9V batteries and battery clips
  • zipties
  • electrical tape
  • breadboard wires (24ga wire works too)

Tools Required:

  • Soldering Iron
  • Laser Cutter (we used our university's for this, but you can find laser cutters at most hacker/maker spaces.)
  • Screwdrivers
  • Allen (hex) keys
  • Laptop and Arduino IDE (If you have never programmed with an arduino before check out this)
  • USB mini b cable
  • Drill press
  • Tap set (some threading is required for this car)

Step 2: Chassis

Note: Attached are the files for the chassis, which are required for this part of the build

First, using the laser cutter, cut out the parts from the 3/8" acrylic sheet.

Next, mark out two holes on the motor mounts as shown in the picture above, 0.75" apart. Drill and tap them for the 4-40 x 0.875" screws.

Mark out one hole in the front of the main chassis for the caster foot. Drill and tap it for the 8-32 x 0.500" screw

Now glue the ball caster as shown to the adjustable foot.

Drill two holes on the breadboard support to attach to the chassis.

Last, assemble the chassis as desired.

Note: We used 3 of the spacers to lower the sensors down towards the floor

Step 3: Wiring

Stick the breadboards to the chassis as shown.

attach the line sensors to the sensor mount and slide them along to space them out approximately evenly.

Note: the line sensors can interfere with each other, so we made a simple cardboard divider for them.

Seen above is the wiring setup for the breadboard. Connect the following:

  • Arduino pin 5 -- Line Sensor D001
  • Arduino pin 6 -- Motor A1 in
  • Arduino pin 7 -- Line Sensor D002
  • Arduino pin 8 -- Line Sensor D003
  • Arduino pin 9 -- Motor A2 in
  • Arduino pin 10 -- Motor B1 in
  • Arduino pin 11 -- Motor B2 in
  • Arduino pin 12 -- Line Sensor D004
  • Arduino 5v pin -- vcc Line Sensor and Bluetooth
  • Arduino gnd -- gnd Line Sensor, Bluetooth, and 9v-
  • Arduino Tx pin -- Bluetooth Rx pin
  • Arduino Rx pin -- Bluetooth Tx pin
  • Arduino Vin pin-- 9v+
  • Motor Vin pin -- 9v+
  • Motor Out A1 -- Left Motor +
  • Motor Out A2 -- Left Motor -
  • Motor Out B1 -- Right Motor -
  • Motor Out B2 -- Right Motor +

Note: the two 9v batteries are connected in parallel

Once everything is plugged in, tune the sensors with the attached potentiometers.

Step 4: How to Follow a Line

If you'd like to understand the line following algorithm, we'll explain it here:

The method used was fairly simple, and could be described as (very) basic proportional control. the further off of the line it is, the harder it turns. the robot follows the edge of the line analyzing 5 cases shown above.

1 = black

0 = white

Case 1: 0000

  • Left Motor --rev 30% speed
  • Right Motor --fwd 50% speed

Case 2: 1000

  • Left Motor --fwd 30% speed
  • Right Motor --fwd 50% speed

Case 3: 1100

  • Left Motor --fwd 50% speed
  • Right Motor --fwd 50% speed

Case 4: 1110

  • Left Motor --fwd 50% speed
  • Right Motor --fwd 30% speed

Case 5: 1111

  • Left Motor --fwd 50% speed
  • Right Motor --rev 30% speed

Step 5: Programming Arduino

If you don't know how to program an arduino, check out this instructable.

Attached is the Arduino program for the bot, including line following and bluetooth control. The program is built to work with the android app Arduino total control.

Note: make sure you disconnect the bluetooth module while programming the Arduino. you can damage it if you don't

Upload it to the Arduino, and the bot should be ready to go.

Step 6: Test and Explore!

You can print out the powerpoint slides below and combine them to make a course for your bot. Then power it up, enable line following with your phone, and tune until you are pleased with it's results.