We’ve built an obstacle avoiding robot and a Bluetooth controlled robot in the past.
What we didn’t do yet is one of the most popular robots every beginner do when starting with robotics.
A line follower!
A line follower is a satisfying robot especially when it follows the line the way you want it to.
I would first want to point out that we will go with the simplest code possible without making the use of a PID controller which most of the advanced robots of such use.
If you want some more advanced algorithm, you need to read about PID controllers. Every robot on competitions has one or more PID controllers and 10 or more line sensors so that it can track the line really fast and precisely.
Parts needed
- 1 x Arduino Uno board
- 3 x line tracking sensors
- 1 x Motor controller
- 1 x Robot chassis
- jumper wires
- 1 x breadboard (check the image)
We will also need a 3d printed part to attach our line tracking sensors to the chassis at a proper height above the ground, you can download it here: https://www.thingiverse.com/thing:2594606
This robot is quite similar to our last Bluetooth controlled robot. We have to connect 4 cables to 5V but there is only one 5V pin on Arduino. That’s why we needed to use a breadboard (or just a piece of it). I had a medium size breadboard with detachable power lines. So, I used one of them to connect all 5V and GND pins without soldering.
The 3d printed holder should be fixed at the front of the robot and you should try fixing the sensors on it as seen in the image below.
The LEDs on the sensor indicate whether it detects a line or not, you might need to calibrate it before it works perfectly on your set-up. There is a potentiometer on the sensor which you can use to adjust its accuracy.
You should also keep in mind that the line detection accuracy depends on the light conditions as well.
The logic here is the following:
- When the left and right sensors detect no line and at the same time the middle sensor detects a line, the robot should move forward.
- When the right sensor detects the line, the robot should turn right
- When the left sensor detects the line, the robot should turn left
That’s all it does. Incomplete right! But not a bad algorithm to start with. There is plenty room for improvement here.
The motor functions are exactly the same as there were in our Bluetooth controlled robot example at the only difference that the PWM values here are low. This robot needs to move slowly in order to stay on track. Feel free to experiment with faster speeds to check its limitation.
Here is the robot working on a dark floor, not too bad. Quite inefficient, but the good news is, it stays on track.
And that’s it for today. One task at hand right now for you is to go and find ways to improve the performance of this robot.
You might also like:
- Arduino hx711 tutorial
- Arduino magnetic switch
- Best Arduino Kits
- gifts for engineering students
- gifts for engineers
- mpu6050 Arduino projects
- Current sensor Arduino
- Soil Moisture Sensor With Arduino
- Arduino Count up Timer Using the Nokia 5110 LCD
- Arduino Yun: Integrating or Juxtaposing Arduino with Linux
- Line Follower Arduino Robot
- Arduino MOSFET
- Which Arduino Should You Buy
- What Can You Do With Arduino Boards?
- Great Alternatives to the Arduino Microcontroller
- Arduino Projects: Color Sensor
- Arduino IDE Alternatives
- Arduino Mega vs. Uno
- Arduino Projects: Arduino LCD Display
- Read Arduino Rotary Encoders
- A Selection of the Best Arduino Simulators
- Arduino Projects: IR Receiver
- Arduino Light Sensor Project
- Arduino Projects: Arduino Decibel Meter
- Arduino Stopwatch Project
- Arduino Bluetooth RC Car Project
- Arduino Temperature Logger Project
- Arduino Projects: Arduino 7 Segment Display
- Arduino Projects: Clap ON Clap OFF Light
- Arduino Relay Project
- Install a Library Onto the Arduino IDE
- Arduino Projects: Rainfall Detector
- Arduino Projects: RGB LED Arduino
- Arduino Stepper Motor Project
- Arduino Projects: Arduino DC Motor Control
- The Top Affordable Arduino Robot Kit
- Arduino 3D Printed Case
- Arduino Projects: Asynchronous LEDs Blink
- Arduino Projects: Ultrasonic Distance Sensor
- Arduino Projects: LED – 4X4X4 LED Cube
- Arduino Car Projects: Build an Obstacle Avoiding Robot With Less Than $30
- Arduino Projects: Servo Potentiometer Control
- Arduino LED Project: Knight Rider
- Arduino Projects: PIR Motion Sensor
- The Difference between Arduino and Raspberry Pi
- Top 9 Books Every Engineer Should Read
- Top Used Sensors for Arduino
- First Hand on the Arduino Uno Board