Having purchased the basics of a Line Following Robot from Robot Bits and purchased some lovely little QR1113 sensors from Proto-Pic I have finally found time to put everything together and program Lionel Mk1 – The Line Following Robot.
The Robot Shield from RB is a gem and assembly took me about an hour which isn’t bad given I have not soldered in 10 years. Thankfully it also worked first time with no mistakes. The shield comes with its own Arduino library RobotShield.zip but at the time of writing I needed to modify this to work with Arduino Version >1.0. If you get an error along the lines of WProgram.h: No such file or directory you will need to edit the library files and change the WProgram.h include to Arduino.h as the header was renamed from version 1.0.
Also in the end I didn’t use the library as I wanted to control the direction of the robot by subtly adjusting the speed of each motor – something that the library doesn’t allow.
The first thing I need to know was how the sensors worked so I found a good little Bildr post which led to my first attempt being based on instinct more than knowledge. Although it resulted in moderate success I knew I needed to do more research. I was lucky to find a very good Building Autonomous Line Followers with Arduino! article on MB Robot Games. This directed me towards PID Control, a generic feedback loop system. Through further research on the internet I then found a Pololu guide and Arduino Library for the sensors I was using.
After some playing I was able to get a basic robot following the line that: would go around corners; and stop when it reaches the end of the line. At this point my batteries finally died and so I upgraded from a single 9v to a six fresh 1.5v batteries. The effect was to increase the power going to the wheels and thus changing all dynamics of the robot and undoing all my progress of the day!
I’ll update this with more info when I have made some further revisions.