This instructable was made for a school project.
We had to make a linefollower with a few specifications:
- It had to be cheap with a target price of €50.
- As fast as possible: > 0,5m/s.
- Width of line: 1,5cm / radius of a curve: 10cm / intersections possible (the car has to drive straight).
- The linefollower has to work in normal light conditions (TL-lights, sunlight, camera flash, ...).
- Max. dimensions 12mm x 12mm.
- Simple hardware: 1 power supply, cheap DC-motors, H-bridge, ...
- Light sensors array (min. 6).
- Wireless communication (infrared, Bluetooth, ...).
- 1 start/stop button, linefollower starts with last set values (even when power has been cut off).
- All settings can be changed via a simple to use pc program (Kp, Ki, Kd, debug, max. speed, ...).
- The final product has to be a self made PCB (design).
- Use smd components where necessary.
Let's get started.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Concepts and Components
You start this project by making a few choices. These are: controller, communication, H-bridge, power supply, sensors and motors. These choices will depend on each other.
My choices were:
Micro controller: atmega32u4 (arduino leonardo chip) needs 5V
Communication: RN-42 (Bluetooth) needs 3,3V
Power: Lio-ion 18650 2 x 4.2V --> 8,4V
Motors: Polulu 50/1 (testing) and 30/1 (speed)
Sensors: SHARP microelectronics GP2S700HCP
Step 2: Making the Schematic
To make the schematics, look in the datasheets and you'll see how everything needs to be connected.
The schematics can be made in several different programs (DipTrace, Eagle, EasyEDA, ...).
If you want to use mine you can download them here.
Step 3: PCB
When you get your PCB you'll need to solder everything to it. Make sure you don't short circuit the components.
Step 4: Program (arduino)
All the calculations are in the arduino and the values can be changed by a different program (see next step).
You can download the full program.
Step 5: Program (Visual Basic)
I quickly wrote a program in Visual Basic that can write values to the linefollower, there are also some extra features in there.
The program and code is downloadable here.
Step 6: Testing Everything on the PCB
Now you will have to test everything.
If there are no problems you can start tweaking it and make it go faster.
(Else you will have to find what may cause the problem, and then solve it.)
Do this by changing the PID, speed and cycletime.
This will change with every linefollower
For me, the values were (for a speed of 0,858 m/s motors of 30:1):
- Kp: 4,00
If your PID values are to high the linefollower will pick up too much distortion.
Step 7: End Result
In the end we made a linefollower with all the specifications they gave us and reached a speed of 0,858 m/s.
That is the fastest speed ever in this school project.
If you want all the documents that are in this instructable and more, use the link below.
(Some of them are in Dutch)
My blog (also in Dutch).
If you have questions feel free to ask.
Participated in the