Line Following Robot
This is a Line Following Robot. It follows a black line that is drawn.
It is able to detect the black line through one photocell and one analog light sensor (https://www.adafruit.com/products/1384). There is an LED in between the two sensors that gives off red light when the Arduino is powered on. Then, when the light is reflected back, more light is detected when it is reflected on the white surface, compared to when it is reflected on the black surface. Using this, the right and left servo motors move accordingly to turn left or right when the sensors detect white surface rather than black.
I used the Parallax BOEBot Robot for Arduino Kit as my base for the robot (https://www.adafruit.com/products/749). Then I placed a breadboard in front of the base to attach all the sensors with the LED to face the black line.
When watching at the video, you will notice the Altoid tin that is taped on the Arduino. This is merely just to balance the weight between the breadboard in the front and the Arduino in the back. When the Altoid tin wasn't taped, the robot constantly tipped towards the front when moving.
----------------------------------------------------------------------------------------------------------------------------------------------------
When working with the code, you will need to adjust the values for the photocell and the light sensor to change directions. To do this, just place the robot with the sensor (comment out the 2 lines of code to attach the servos in the setup) and check the values of the photocell and the light sensor when it is in the middle, right, and left edge of the black line. Then, change the values of the code accordingly for moving the servo motors.
It is able to detect the black line through one photocell and one analog light sensor (https://www.adafruit.com/products/1384). There is an LED in between the two sensors that gives off red light when the Arduino is powered on. Then, when the light is reflected back, more light is detected when it is reflected on the white surface, compared to when it is reflected on the black surface. Using this, the right and left servo motors move accordingly to turn left or right when the sensors detect white surface rather than black.
I used the Parallax BOEBot Robot for Arduino Kit as my base for the robot (https://www.adafruit.com/products/749). Then I placed a breadboard in front of the base to attach all the sensors with the LED to face the black line.
When watching at the video, you will notice the Altoid tin that is taped on the Arduino. This is merely just to balance the weight between the breadboard in the front and the Arduino in the back. When the Altoid tin wasn't taped, the robot constantly tipped towards the front when moving.
----------------------------------------------------------------------------------------------------------------------------------------------------
When working with the code, you will need to adjust the values for the photocell and the light sensor to change directions. To do this, just place the robot with the sensor (comment out the 2 lines of code to attach the servos in the setup) and check the values of the photocell and the light sensor when it is in the middle, right, and left edge of the black line. Then, change the values of the code accordingly for moving the servo motors.
Code found in:
https://github.com/helenbang/Line-Following-Robot/tree/master