Introduction: E101 Line Following Bot With Speaker

Here is a line following robot that plays music when it passes over specific colors

Step 1:

David Lashbrooke, Hunter Jackson, and Rithik Angala

Step 2: Goal

This bot will follow a track or tracks of multiple different colored lines that you can create while playing music of your choice.

Step 3: How It Works

Create a continuous track of electrical tape around any room that you would like the bot to follow. Set the bot at any point on the track and watch it go.

Step 4: Materials

1. Gathered all materials needed to meet our goal which consisted of

· Raspberry Pi 3 B+

· Wheels (3)

· Motors (2)

· IR Sensors (2)

· Chassis

· Wires (∞)

· Screws (6)

· Nuts (6)

· AA Batteries (4)

· Battery holder

· Color sensor

· Speaker

· Circuit board

· Audio jack

· Nuts

· Screws

· Resistors (10k, 22k, 30k)

· Capacitors (50 and 30)

· LEDs (green, red, and yellow)

· USB to audio cable

· 4 cord cable

· 3 cord cable

· A few other small electronic components and acrylic for speaker case

2. In order to set up the Raspberry Pi 3 B+, we needed

· HDMI Cable

· USB to MicroUSB Cable

· Keyboard

· Mouse

· Monitor

· Internet Access

Step 5: Tools

  • Soldering gun/station
  • 3D printer
  • Wire strippers/cutters
  • Screw driver phillips/flathead

Step 6: Code

Here is the link to the GitHub with our code. For some reason instructables did not like the format when copy and pasting so we created a GitHub file instead. Github will also allow for easier cloning to a device than copy and pasting.

Step 7: Step 1


  • After obtaining your Raspberry Pi, plug it into a monitor via HDMI
  • Follow the instructions on the screen


  • After obtaining your Micro USB card, plug it into any computer and have it flashed and formatted

Step 8: Step 2


  • Write code for the bot to follow a black line (code shown above)
  • After writing the code, download that code onto the SD card via your computer
  • Then, insert the SD card into your Raspberry Pi

Step 9: Step 3


  • Put together each motor with each forward/backward wheel and screw them together
  • Screw the small clear wheel into the front of the chassis
  • Then, screw in the other two wheels with the motor into the chassis
  • Connect appropriate wires to the battery pack in order for it to receive power
  • Place battery pack and Raspberry Pi on top of the bot

Step 10: Step 4


Click here to see the video we used to build the speaker

After building the speaker, place that on top of the chassis on the bot

Step 11: Step 5


  • Decide what music you want to be played through your speaker
  • Download that music onto your SD card as an .mp3
  • Insert your SD card into your Raspberry Pi
  • Download that music onto your Raspberry Pi
  • Decide what color you want to be associated with each song and edit the code as needed