Documentation
Content
With this tutorial you can do it!
Needed
- 1 Keystudio UNO R3
- 2 Continous servo FS90R
- 2 Servo wheel
- 1 Infrared sensor (for object detection)
- 2 Prototyping PCBs
- 1 3.7V Battery
- 1 Step up circuit (3.7V to 5V)
- 1 LED
- 1 Resistor 150k
- 1 Resistor 1k
- 1 Phototransistor
- 1 Button
- some Pins
- some Cables
- some M3 screws
- some M3 nuts
- 1 3D printer
That is all!
Hardware
First of all, we need to make sensor, this line follower is only with one line sensor, for sensor we need one prototyping PCB, LED, three male pins, soldering iron, phototransistor and both resistors, 150k and 1k.
Second thing you need to do is to setup connection, so line sensor is going to GND, OUT to Analog pin 0 on Arduino and VCC to 3.3V on Arduino. Then you need to connect rest of components.
Right servo INPUT to Digital pin 9
Left servo INPUT to Digital pin 10
IR detection sensor to Digital pin 3
Calibration mode ON/OFF to Digital pin 4
Calibration pin will be connected to a button on the next PCB where will be connected all VCC(5V) and GND. For this you will need soldering iron, 15 male pins, button and cables to connect everything together.
Now when everything is connected, only thing you need to do is to make 3D printed base and servo holders. You can download this parts by clicking on button below.
If you have printed it, then you need to put it all together, you can see how it have to look like in pictures section.
Software
If you were doing something with Arduino then you can skip right to programming section here. If not yet, then start with Arduino IDE installation.
If you have installed it, then you need to set your board to Arduino/Genuino UNO
Now everythig is done. You only need to upload the program to your line follower robot.
Programming
First of all we need to import libraries and define some values, that we will need at all of our program:
Now, here is calibration function, that will calibrate your line follower robot. If it is in calibration mode, you need only to place it on line, and it will do everything without you. If it is not in calibration mode, this will be skiped and robot will continue with his values saved in EEPROM memory.
Now we are going to program some motion functions for our robot:
Now we need to get around object that is on line. We programm function for it:
Only void setup() and void loop() is now needed:
And loop, if we are on white we go to black. But if we are on black then we go to white, we are on the edge of line.
Now you got it, simply upload to your robot and you can go. You can also download this code below. Or you can read it whole here.
Download code