www.flickr.com
tres frijoles' photos More of tres frijoles' photos
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script -->
You are here: tearsoffire.org > Projects Web > ElectronicsProjects > AvrProjects > AvronicsFirstBot r6 - 06 May 2007 - 11:44 - ChristopherPepe


Start of topic | Skip to actions

AvronicsFirstBot

AVRonics Simple Robot

370161147_9bd47e01f3.jpg

Now that the AVRonics board is in full swing it's time to start stretching it's legs. This is not the robot to do that but it's a start. I threw this together in about an hour (after many months of thinking) and spent about 10 minutes writing the code to control it. No, no, I'm not just that good - it's just that simple. This robot is now used for AvronicsMicroMouse development.

money shots

purpose

the purpose is 5 fold

  • 1. provide a quick and dirty platform for testing out the AVRonics board
  • 2. i haven't built a robot in a long time and i needed a fix
  • 3. this platform is intended as a prototype for a future cheap swarm
  • 4. this platform is to be used in behavioral tests for a robot we are designing at work
  • 5. everyone needs a robot running around their house

hardware

  • 2 modified servos (glorified gear motors - with drivers built-in! )
  • sheet metel folded into a channel
    • houses the battery/electronics
    • holds the servos together
  • 2 ice tea bottle caps
    • i punched holes in these to screw them into the servo
    • 'spot welded' in place with JB Weld
  • 3.6V rechargable battery from a cordless phone
  • and of course the AVRonics main board

hardware that's missing

  • any type of sensor!
  • 5V+ battery (motors spin faster when they have more juice)
  • traction - the bottle caps are slippery metal
  • caster - right now it drags its arse
  • communication - swarms need to communicate preferrably wirelessly

software

the built-in h-bridges are inverting so a 0 turns the motor on, 1 off... that is why 0xfc turns the motors (using pins B0 and B1) on and off. this is a really poor way to drive your robot! don't do it if you have built in pwm! don't do it even if you don't have pwm - hack some code together. this code sucks for a real robot! i think you get the point.

hflag is a variable that is incremented whenever the heartbeat thumps. The heartbeat is a system timer that normally flashes an LED to indicate that the program is still running. It is also on port b so this code keeps the led on all the time, however, the heartbeat still thumps away even though you can't see it.

/* probably the simplest program to drive this thing.
 * this code wont last for more than one or two tests
 * but will get the mouse rolling.
 */
void main(){
        DDRB = 0xff; //all outputs
        PORTB = 0xff; //inverting h-bridge
        configure_rti();
        PORTB = 0xfc;//motors on
        for(;;){
                if((hflag%6==0) || (hflag%7==0) || (hflag%8==0)){
                        PORTB = 0xfd; //right motor off
                }
                else{
                        PORTB = 0xfc;
                }
        }
}

update

ok it's only a hour later but i've updated the code to use the pwm built into the ATmega32. The power of this is really lost on this robot (the hacked h-bridges are pretty much on or off) but it was important for the avronics board that this be done. The robot now runs a program called left-right-left in which the motors fire one at a time to make a zig-zag straight line.

watch the video and you'll note that the wheels get stuck a few times. this is due to the fact that they have no traction. this will be remedied soon.

-- ChristopherPepe - 17 Mar 2006

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r6 < r5 < r4 < r3 < r2 | More topic actions
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding tearsoffire.org? Send feedback