A collection of line follower projects .Some of these are without microcontroller. Most of these are with atmega8 (www.atmel.com),PIC. we mostly use Codevision and Keil. a discussion of sensor array and the motors differential drive steering

Monday, February 11, 2008

fastcharged.org line follower

Introduction

The internet for me is almost always the first place I go to search for info. on any topic and I spent quite some time investigating how I should begin to enter the world of robotics.

I'd decided that I needed a step-by-step guidebook on how to build a robot, together with a general electronics book.

I prefer the creative freedom of building something from scratch, as opposed to assembling a kit, so the description of "Robot Building for Beginners" by David Cook sounded right for me. David also has his own website Robot Room.

That's the 'robot' book I settled on and after reading it and following the steps to build a robot, I can definitely recommend it to anyone new to both robotics AND electronics.

It was more difficult to identify an electronics book which I would find useful, not only as I began learning about electronics but also when I reached an intermediate level of understanding. As I didn't want to buy too many books to begin with, I finally chose "Practical Electronics for Inventors" by Paul Scherz.

This book is primarily a reference book and it appears to be one of the best general electronic's reference books available. It covers many circuits and components, including various ICs and also describes the main laws and theories which govern electronics. I've benefitted from information that it contains on a number of occassions and I expect I'll refer to it even more in the future. If you are looking for an entry text in electronics though, I suggest you buy another book.

Description

This robot is based on the line following robot detailed in David Cook's book. It uses a comparator chip as it's brains, which makes it a relatively easy first robot to build.

Due to the initial 'entry costs' , as are associated with any hobby i.e. tools, equipment and parts, this will probably end up being one of the most expensive robots I'll build for a while.

I would like to progress to building programmable microcontroller chip based robots, possibly using Atmel's AVR microcontroller series but I wanted to avoid too much complexity when creating my first robot.

There are a few differences between my robot and the one in the book:

  • Flat, hardboard body instead of a plastic sandwich box
  • Handmade hardboard wheels & plastic motor mounts instead of Lego wheels and axles
  • The circuit is built on two small pieces of breadboard instead of a single breadboard
  • To reduce friction, a third, trolley style wheel has been added to the front



Robot underside view

Robot side view
Robot side view



Circuit layout on a solderless and solderable breadboard

Solderless breadboard circuit
Solderless breadboard circuit

Here is a photo of the line following circuit on a 1660 tie-point solderless breadboard.

The Schottky barrier diodes can be seen connected to jumper leads on the left and right of the helping hands, as their leads were too large to fit into the breadboard.

I wasn't able to obtain the DC gearhead motors specified in the book but based on the stated criteria, I finally sourced alternative motors from a local manufacturer.

During my testing of the motors I came across a handy method of measuring RPM (revolutions per minute).

Here is a video (1.23MB, no sound) showing me testing the solderless breadboarded circuit.

As mentioned in the Description section, the body of my robot is quite different from the one in the book. After sketching an initial design of the robot I knew that I couldn't build the circuit on a single 72mm x 92mm breadboard. It would have been too large and the sensors wouldn't have fitted in the correct position to detect the line. Therefore I experimented and was able to fit the main part of the circuit in half of the space, as you can see here:

Half of breadboard with 2 new mounting holes
Half of breadboard with 2 new mounting holes
Using half of the fullsize breadboard
Using half of the fullsize breadboard


Using the halfsize piece of breadboard mean't that some of the components' leads were close enough in the circuit to solder together. I did cover some of these leads with insulation tubing to prevent them from touching other parts of the circuit.

Underside of the main soldered circuit
Underside of the main soldered circuit
Topside of the main soldered circuit
Topside of the main soldered circuit

The circuit's remaining components, four cadmium sulphide (CdS) photoresistor sensors and their two white LED 'headlights' , were placed on a separate strip of breadboard and I used Molex KK connectors to connect this 'sensor' circuit to the main circuit.

I made four test points (metal loops) in total. One each for the positive and negative buses and one for each of the two pairs of photoresistors.

Completed circuit
Completed circuit

Here is a photo of the completed circuit, with all of the parts attached.



TOP

Body Building

The flat body and the wheels are made from the same material, hardboard. It's a 3 1/2mm thick fibrous board with a smooth surface on one side.

After laying out the robot's parts on the board and marking their positions, it was easy to saw the board to the right size and to drill the various holes.

For the wheels, after drawing two 48mm diameter circles and cutting them out, I was left with lot's of flat edges around their circumferences. To round off the edges, I drilled the centres of the two wheels and passed a small bolt through both and fixed it in place with a washer and nut. I then inserted the bolt with the attached wheels into the jaws of a power drill and placed the drill in my bath! - I live in an apartment and don't have a workshop. After donning a dust mask and goggles and powering on the drill, I then used a hand file to remove the wheels' flat edges! Et voila, two 'perfect' wheels :)

Underside of Robot
Underside of Robot
Topside of Robot
Topside of Robot

You can see fairly clearly the robot's body in these two photos.

You might have noticed in the above right photo that I used a 4AAA battery holder unlike in previous photos. The 4AAA and 9V battery holders are attached by a single screw which makes them easy to swap.

The motor mounts are made from a plastic watch box! I used a hacksaw and a handfile to shape them and then carefully marked and drilled the mounting holes for the motors and the body. I was very happy with the final result :)

Last but not least was the 25mm diameter 'trolley' style, castor wheel at the front of the body. It rotates smoothly and the swivel has ball bearings so turning is also smooth.




Test Run

Once the robot was built, I conducted various tests on it as prescribed in the book.

I created courses for the robot to follow out of black and white electrical insulation tape, using one colour per course. For each course I initially balanced the robot's left and right sensors and adjusted the brightness of the headlight LEDs.

One of the tests was to determine the ability of the robot to sense lines under various conditions.

For this, I measured the voltage at each of the robot's sensor test points after placing it directly over the top of a straight line in a course, with it's motors switched off. I repeated the test with the robot pointing slightly to the right and then to the left of the line.

The measurements were taken with a box covering the robot to shield it from all ambient light and then with the box removed so that I could measure the impact of the room's lighting.

Preparing to test the sensor's voltages
Preparing to test the sensor's voltages

This photo shows the robot with test leads connected but before being placed on a line and powered on.

Another test was to determine the load current i.e. the current being used as the robot follows a line. For that test I had to walk behind the robot with a multimeter :)

The final test was the battery discharge (drain) test. This was very simple.

I measured the voltage of a 9V rechargeable battery before connecting it to the robot. The one I used was a NiMH rechargeable rated at 8.4V and 170mAh. Then I powered on the robot and flicked the line-following switch to follow white lines and timed how long the robot accurately followed a simple, elongated oval course.

I had a long wait!

After 2 hours and 49 minutes the robot drifted off the course. I finally switched off the robot after I had placed it back on the course twice and it had left the course at the same point on each lap. I then removed the battery and measured it's voltage.

The starting voltage was 9.13V and the finishing voltage was 7.41V.

Here is a video (1.73MB, no sound) showing the robot following a simple course and another video (920KB, no sound) taken at ground level, that shows the benefit of using a castor wheel.

BTW, the reason there's no sound in any of the videos is due to using a USB webcam on an extended cable, as the course was in another room from my PC :) In future videos I intend to add sound and figure out a way to sync both and compress the final result into a reasonable size!

Conclusion

Well, I'm very satisfied with my first robot and have learn't a lot from the process of building it. From the early stages of reading the book, through designing the body, sourcing the components and parts, to my first ever soldered circuits and the successful 'maiden voyage' of my robot (on a figure of eight course and before it was calibrated!) ;-)

Like most people, there are things that I'd do differently if I was to build the same robot again but most are quite minor. The main change I'd make would be to build the circuit on a PCB (printed circuit board) instead of using point-to-point soldering on a breadboard.

Soldering the components to the breadboard was the most time consuming and fiddly part of building the robot, partly due to my decision to fit the main circuit on to a piece of breadboard which was half the recommended size (but it was worth it) :)

Due to my preference to 'build from scratch' though, I'd probably make my own PCB but this raises it's own problems. The biggest of which, and one I'll ask my local environmental protection dept about, is how to safely dispose of used etchant's (ferric chloride) sludge.

As for my next projects, I'll probably build a 'solaroller' (micro-sized, solar powered car) in the near future. I'm also quite keen on building an Atmel AVR based robot for a number of reasons, one of which is due to the very low entry cost i.e. the chips are cheap, I can create my own simple programmer using a parallel cable and some resistors and program in Basic for free, up to 2K (that's good enough for me to start with).

If you're considering becoming a robotics hobbyist, I hope this article has helped to convince you to begin and for those already involved in this great hobby, perhaps it brings back some early memories :-)

Bye for now,

KD



No comments: