Introduction: Line Follower Robot Lap Counter/Timer Based in Arduino
Line follower robots are very popular among robotics competitions. . My robotics team, Cirobots (https://www.facebook.com/cirobots/), has been building line followers since 2014. We have been quite succesful nationally and are about to compete in international competitions. You can see our robots in our facebook page.
This time, we present to the instructables community a simple to build, yet interesting tool that is helping us achieve better times with our robots: A lap counter/timer.
Step 1: Structure
The structure is designed to allow a robot to pass through it. Dimensions can be changed to meet robot dimensions needs.
The detection of the robot crossing is accomplished using an infrarred LED and an infrarred phototransistor, one in one side of the structure and the other in the other side, such that when the robot passes, the light is obstructed . I have set up two pairs at different altitudes just in case. I think using one is pretty much OK.
Attatched is a zip folder with Solidworks parts and assembly of the structure, and also AutoCAD DXF of the structure. (The part named "poste" is to be cut twice, since the structure is symmetrical.)
You can choose wether to cut these in Laser, CNC, Waterjet, or even print the patterns and cut manually. (The structure is designed using 6mm wood, but you can easily modify the drawings to adapt to any material you choose.)
Structure assembly is pretty straightforward, as it requires only hand fitting of the three pieces and wood glue. The holes in the top are for cable ties. The holes in the bottom are for sensores, and the holes in the middle are for the Arduino. (Arduino only in one side, so you can ignore holes in the other side).
Step 2: Electronics
You'll need the following stuff:
- 2x 5mm Infrarred LED. (I used this one https://hetpro-store.com/led-ir-emisor/ )
- 2x 5mm Infrarred phototransistor. (I used this one https://hetpro-store.com/led-ir-receptor/ )
- 4x LED housing. (Like this one )
- Arduino UNO or similar (With its USB Cable)
- 4x 1/8" screws and nuts
- Perforated Circuit Board (Like this )
- 2x 10K Resistor
- 2x 100 Ohm Resistor
- Header pins (Like this )
- Soldering Iron
- Cable ties
1) Insert LEDs in housing and into their holes in the structure (two emitters in one side and two recievers on the other side)
2) Screw the Arduino to either side of the structure (leaving pins to the outside, as shown in the picture.)
3) Put cables to the LEDs (I chose a color for cathodes and other for anodes, so that they don't mess up)
4) Layout the wiring across the structure so that every cable is on the Arduino side.
5) With the help of Perforated Circuit Board, and according to the circuit diagram shown in the picture.
6) Place the newly created shield on the arduino, being careful of the pin layout.
Step 3: Programming
Programming is pretty straightforward, too.
In Analog input 0 and 1 you can read both sensors. If there is no obstruction, you will be reading a low value. Otherwise, you read a high value. You can use this info to make a lap counter or more complex timers using different software.
Attatched is a sample Arduino Serial lap counter, which can be executed in the Arduino IDE and monitored through the serial terminal of the software.
Also I attatched our Labview timer. (It needs the LINX Library for Comm with Arduino)
The way the timer works is the following: (Use the images attatched as guide)
In the Arduino Tab, configure the port. You can now run the program. Wait 10 seconds aprox for the arduino to connect. In the sensor displays, you can see the sensor analog values, raw from the arduino. you can now move to the main screen.
In the main screen, there is a button (Run).
Once you slide this button, the timer will be ready for the first time a robot crosses it (The beginning of lap 1). When it crosses, the timer starts counting. Then, when the robot passes again, the timer resets, but stores the previous value in the other display. The best time is kept there, also.
HOPE YOU LIKED THIS AND IS USEFUL! ANY DOUBT DONT HESITATE TO WRITE IT IN THE COMMENTS.
We have a be nice policy.
Please be positive and constructive.