For line following I have built a daughter board that gets mounted under the robot so the sensors are closer to the ground. On the main board I have soldered 2 pieces of 3 pin female connectors. On one of them I have connected the power and ground and on the other the 3 signal lines for the sensors. On the daughter board I have soldered 3 IR photo transistors that I have pulled out from a VCR spaced about 3/8 of an inch from each other. In between them I have soldered 2 IR LEDs mounted in some LED holders so that the IR light will not get sideways to the photo transistors. I have installed an adjustable pot so I can adjust the sensitivity of the sensors. Then I made the connections to 5 pins installed 3 on one side (signal lines) and 2 on the other side (power and ground lines).
Like every robot builder that wants to teach others how to build robots, I have built a sample robot, using parts from VCRs and bought only the minimum necessary to make the simplest robot I could think of. At the time I was using the Nemesis microcontroller, produced by Kronos Robotics, however this was not a good choice for Romania, because import taxes would have made their price almost double. Nemesis is a PIC 16F88 with a pre-programmed bootloader. This feature allows the user to program it from the serial port of the PC through a logic level adapter. Kronos Robotics also provides Athena, a free Basic compiler, lots of sample code and great support. Basic is easier to learn by young people, so I thought it is a good choice for beginners. And Nemesis costs only $12.95. A PIC 16F88 costs about $3, but needs a programmer (the cheapest I could find is $40) and the PBasic compiler costs $99. Too expensive. Now I would use an AVR ATtiny26 and Bascom-AVR for programming, cutting the price to about $15 for the whole project.
Have a look at the program:
3. The mechanics. To keep costs low I have merged the chassis and electronics board together and mounted all on a perforated prototyping board. Besides the microcontroller, the H Bridge, the voltage regulator, a couple of nails and a few screws, all the other parts I pulled out from a couple of broken VCRs found on the side of the street. They were different brands, but inside they looked the same. I needed 2 VCRs because they rarely have 2 similar DC motors inside. But here’s what I got:
2. The electronics.
Let's take a look at the schematic: