Lionel – The Line Follow Bot

Featured

lionel

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.

 

 

 

Circuit 05 – Shift Register

shiftregister

Shift Registers are a type of Integrated Circuit (IC) or chip.  The Shift Register is a serial to parallel convertor that allows us to control eight additional output pins with just three on the Arduino.  You can link them together to give you even more (unlimited) outputs!

A Shift Register works by clocking in the data and then locking (or latching) it.  This is achieved by setting the data pin to high or low and then pulsing the clock.  This is repeated until you have shifted out eight bits of data and set all the pins.  Now you can pulse the latch and all eight bits are output to their representative pins.

Circuit 04 – Servos

servo

Servos can be used for lots of things where a great detail of control is needed such as steering RC vehicles, robotics and freaking out small children with moving dolls.  Standard Servos like the one provided by Oomlout travel through 0 to 180 degrees with positioning controlled via a timed pulse.  Timing varies with manufacturer but for example a pulse sent every 25 to 50 ms will run the servo smoothly.  

Circuit 03 – Transistors and Motors

photo

The Arduino will allow you to attach low power devices directly to its pins but items such as motors requiring more power require a transistor. A Transistor allows you to switch big volts using little volts. In circuit 03 we wil be switching a motor.

It uses a 1N4001 diode to act as a flyback diode which eliminates or suppresses voltage spikes seen across an inductive load when a voltage supply is suddenly reduced or removed.