Line Following Car
Our team (Peyten, Skye, Paige, Ivan & Aryan) made a vehicle that follows a black line using gear motors and line following sensor. This project follows 4H rules, making it perfect for younger students who have less arduino experience to learn about circuits.
Supplies
- Sparkfun Arduino Kit: Includes the following
- Gear Motors
- H-Bridge Motor Driver
- Wires
- Battery Pack
- Arduino Board & Breadboard
- Swivel Wheel
- Line Following Sensors
- 4 AA Batteries
- Extension Wires
- 3D Printed Files (attached below)
- Tape/Glue
If 3D models can't be printed, drawings of the dimensions are included so it can be made out of cardboard. All dimensions are in mm.
Wiring
- Attach the TB6612 motor driver to the breadboard across the center gap.
- Attach the two pushbuttons to the breadboard on the right side.
- Connect the motors to the breadboard/motor driver area so the wires can reach the driver.
- Connect Arduino 5V to VCC on the motor driver.
- Connect Arduino GND to GND on the motor driver.
- Connect VM on the motor driver to the 5V pin.
- Connect STBY on the motor driver to 5V.
- Connect PWMA on the motor driver to Arduino digital pin 11.
- Connect AIN1 on the motor driver to Arduino digital pin 12.
- Connect AIN2 on the motor driver to Arduino digital pin 13.
- Connect the first motor wires to AO1 and AO2 on the motor driver.
- Connect BIN2 on the motor driver to Arduino digital pin 10.
- Connect PWMB on the motor driver to Arduino digital pin 6.
- Connect the second motor wires to BO1 and BO2 on the motor driver.
- Connect one side of the first button to Arduino A0.
- Connect the other side of the first button to GND.
- Connect one side of the second button to Arduino A2.
- Connect the other side of the second button to GND.
Code
Upload the following code using Arduino IDE into the Arduino Uno
Downloads
Attaching Swivel Wheel
Attach the swivel wheel using tape or glue as shown. This allows turning to be smooth, as the wheel is a ball bearing
Attaching Motors
- Connect the wheels to the motors
- Attach the motors to the slots as shown
Battery Pack
Tape the battery pack on the bottom as such. This allows for the power source to be easily accessible
Insert Arduino Board
Flip around the base and insert the arduino board into the box as such
Sensor Positioning
On the bottom, tape the sensors so that they are facing outwards towards the front, this will detect the line
Attach Lid
Attach the lid to the top and fasten it with tape. Make sure the wires are going through the given holes.