Full Version : Handy Andy Robot (AVR ASM)
avr >>ROBOTS & AUTONOMOUS VEHICLES >>Handy Andy Robot (AVR ASM)


AVR_Admin- 04-27-2006
Handy Andy an AVR-based Robot

Every Easter in the UK, there is a big SF convention known as Eastercon, which in recent years has featured Beyond Cyberdrome, a popular event featuring "fluffy things hitting each other". Once a year, a motley selection of remote controlled, uncontrolled, and just plain bizarre contraptions made of Lego, cardboard, chipboard, plasterboard and lots of Gaffer tape do battle.

Some people take it more seriously, though. Andrew Langhammer (a.k.a. "Hex") has produced some extremely deadly remote controlled machines over the past couple of years, for example. But I wanted to do something new. Something self-contained if not self-aware, and just cunning enough to survive.

So, with this year being 2001, I finally got around to it.

The finished machine was nicknamed Handy Andy because it is semi-intelligent and made hurriedly from MDF.

(Note for non-Britons: "Handy Andy" is one of the stars of British TV series Changing Rooms, a show where neighbours compete to make a complete pig's ear of redecorating each other's homes on a ridiculously low budget. MDF, medium density fibreboard, is Andy's staple construction material due to its low cost, despite being toxic when cut or drilled, non-durable, water-absorbent but paint-repellent and generally a bit crap.)

Beyond Cyberdrome Report

Before we plunge into the minutae of hardware and software, how did the thing work on the day? Well, OK. Sort of.

It trundled around quite happily, but the "personality" loaded into its little brain was, shall we say, a little reluctant to risk physical harm.

OK, it was completely cowardly. It spent most of its time dithering about in one corner of the arena, being startled occasionally by a terrifyingly small and fluffy toy which shared its little dancing area and never once moved. Back to the drawing board before we tackle Robot Wars methinks.

Of course, when being demonstrated after the event was over, it immediately did a very good job of attacking one of my friends' feet. That's what you get for incorporating pseudo-random behaviour.

So, if anyone else builds one of these things, my three top tips are: agression, AGGRESSION, AGGRESSION. Attack the furniture. Attack people's feet. Attack the walls of the arena. And maybe then it will accidentally attack one of the other contestants. You never know.

Hardware Overview

I decided to implement this as separate boards with reusable connectors because then I can reuse components later on, cheapskate that I am.


The processor module is based on an Atmel 90S2313 microcontroller, a 20 pin chip which combines processor, flash memory, ram, eeprom, serial port, analog input, and digital I/O for a mere £7 or so. It can even be reprogrammed in situ.

The eyes are actually photoreflective sensors, and can detect objects at a range of around 10-20cm depending on what the object is made from, and what the lighting conditions are like. In addition, a couple of bump switches should pick up anything the eyes miss and we blunder into.

The motor controller is based around another chip, the L298N dual bridge driver, which turns out to be cheaper than the 8 power transistors it would take to do its job otherwise. It is also much more compact.

Motors are small 3v motors with 100:1 gearboxes attached - the wheels are attached directly to the output shafts.

Finally, an RS232 level converter chip makes up the RS232 module, which acts as a buffer to relay information to an external computer

All of these were implemented on Veroboard (stripboard), with the layouts planned using the Eagle design and layout package.

Software Overview

The software again can be split up into basic functional blocks:

The central state machine receives inputs from the eyes, bump switches and timer modules, and issues commands to the motors. Debugging information is fed back to a monitor subsystem, which transmits it out through the RS232 serial port.

The monitor also allows the state table, which is held in the EEPROM on the chip, to be updated without the device itself having to be reprogrammed. This allows you to reload the machine with a different "personality" very easily. Events can be triggered from the RS232 input as well as the usual event sources, for debugging purposes.

The software was written in AVR assembler using AVR Studio 3.22 (freely available from Atmel) and loaded into the chip using PonyProg, a freeware serial programmer which was developed by Claudio Lanconelli.

Link: http://homepage.ntlworld.com/seanellis/avrrobot.htm



Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.