My Robot!

I have been interested in embedded electronics for a few years now, so I decided to build a robot. Right now, its fairly boring, but the great thing about it is there is tons of room for expansion. Let me know what you all think! All the parts are from radio shack, mouser and sparkfun, except for the wood, from michaels, and the tamiya gearbox, motors and treads, from amazon.com.

Top view, arduino and electronics are on a breadboard stuck to a piece of wood over the gearbox. Plenty of room for expansion. The motors run of 3 AA batteries, and the arduino runs from a 9 volt. THe motor driver is an l293d.

The photo below shows the gearbox and treads, and my paperclip and wire obstacle detector.

Oh, and my personal favorite part, the blue LED power switch:

So? What do you think? Anything i did horribly wrong? What is the first sensor/arm/expansion i should add?

Thanks!

EDIT: I included my code below:

int portmotor[] = {6,7}; //Left motor drive pins.
int starboardmotor[] = {4,5}; //Right motor drive pins
int portenable = 10; //Left enable
int starboardenable = 11; //Right enable
void setup()
{
  pinMode(portmotor[0],OUTPUT);
  pinMode(portmotor[1],OUTPUT);
  pinMode(starboardmotor[0],OUTPUT);
  pinMode(starboardmotor[1],OUTPUT);
  pinMode(portenable, OUTPUT);
  pinMode(starboardenable, OUTPUT);
}

void loop()
{
forwards(255); //Go forwards at full speed. For all motor functions, the speed is a PWM number. The motors need at least a PWM of 200, thus the speed range is 200 to 255.
delay(1000);
if(analogRead(3) > 900) //Every 1000 seconds, poll the obstacle detector, if it is pushed, run the avoid routine.
{
  avoid();
}
}


void avoid()
{
 stopall();

 portbackwards(225);  
  delay(2000);
}
void portbackwards(int speed) //Left motor backwards
{
  analogWrite(portenable, speed);
  digitalWrite(portmotor[0],HIGH);
  digitalWrite(portmotor[1],LOW);
}

void portforwards(int speed) //Left motor forwards
{
  analogWrite(portenable, speed);
  digitalWrite(portmotor[0],LOW);
  digitalWrite(portmotor[1],HIGH);
}

void portstop() //Left motor stop.
{
  analogWrite(portenable, 0);
  digitalWrite(portmotor[0],LOW);
  digitalWrite(portmotor[1],LOW);
}

void starboardbackwards(int speed) //Right motor backwards
{
  
  analogWrite(starboardenable, speed);
  digitalWrite(starboardmotor[0],HIGH);
  digitalWrite(starboardmotor[1],LOW);
}

void starboardforwards(int speed) //Right motor forwards
{
  analogWrite(starboardenable, speed);
  digitalWrite(starboardmotor[0],LOW);
  digitalWrite(starboardmotor[1],HIGH);
}

void starboardstop() //Stop right motor.
{
  analogWrite(starboardenable, 0);
  digitalWrite(starboardmotor[0],LOW);
  digitalWrite(starboardmotor[1],LOW);
}

void forwards(int speed) //Turn on both motors at the same time for a straight course.
{
  int newspeed = speed - 10; //Compensate for the robot's weight imbalance.
  analogWrite(starboardenable, speed);
  analogWrite(portenable, newspeed);
  digitalWrite(starboardmotor[0],LOW);
  digitalWrite(portmotor[0],LOW);
  PORTD = PORTD | B10100000;
}

void stopall() //Stop both motors, using port manipulation.
{
  
  PORTD = PORTD & B00001111;
}

I have been interested in embedded electronics for a few years now, so I decided to build a robot. Right now, its fairly boring, but the great thing about it is there is tons of room for expansion. Let me know what you all think!

Not too shabby for a desktop/floor rover.

All the parts are from radio shack, mouser and sparkfun, except for the wood, from michaels, and the tamiya gearbox, motors and treads, from amazon.com.

How is everything held together? You might want to think about using screws and such, so it can be taken apart, but still be held together tightly.

Top view, arduino and electronics are on a breadboard stuck to a piece of wood over the gearbox.

I would make the wood part larger (longer), to cover the tread completely, with a slight overhang completely around, and add a second level about 4-5 cm above that. Put two breadboards on the top level, put the Arduino and the motor controller (on a protoboard PCB, since you have it working in a breadboard fashion - move it off the breadboard).

Plenty of room for expansion. The motors run of 3 AA batteries, and the arduino runs from a 9 volt. THe motor driver is an l293d.

On the "lower level" where the gearbox is, put your batteries, to keep the COG (center-of-gravity) low. Replace the 9 volt and the 3 AA batteries with two parallelled 6V (4 AA) battery packs, or maybe a single 7.2V R/C pack. You'll have longer battery life, and better torque on the motors.

So? What do you think? Anything i did horribly wrong? What is the first sensor/arm/expansion i should add?

After you make the above modifications, you should also replace your cobbled-together sensor. If you want feelers, add those using a couple of leaf microswitches, front-and-back (so, four total). You could also look into adding some Sharp IR sensors. Finally, you could add a pan/tilt servo platform with a PING-type ultrasonic sensor or (if you have the money) a CMUcam. Finally, as you add parts, clean up and route the wires/cables as you work (use zip ties and mounting points).

The platform is probably too small for an "arm", unless you get real creative with some lightweight and small micro-servos attached to popsicle sticks or styrene structural parts.

Good luck, and have fun! Oh, and by the way - nice toes. ;)

The wood is superglued and the parts are electrical taped. As for your idea on the arduino and motor controller, this is intended to be a temporary solution. I have another atmega328p chip, and i was thinking of putting both chips together on a pcb protoboard. If i do this, how would you reccomend bringing the atmega pins up to the "second level" breadboard? About the batteries, I was thinking of the 4 AAs, but the lm7805 that i would use for my standalone atmega could take no less than 7volts, and the motors run ideally at 1.5v with a max of 3v. I am using the 3 AAs because the l293d has a vdrop of 2.6v putting me in the prime power range.

Thanks so much for your feedback!

The wood is superglued and the parts are electrical taped.

Ok.

As for your idea on the arduino and motor controller, this is intended to be a temporary solution.

The scotch tape everywhere seemed to indicate that to me as well...

I have another atmega328p chip, and i was thinking of putting both chips together on a pcb protoboard. If i do this, how would you reccomend bringing the atmega pins up to the "second level" breadboard?

Short ribbon cables, perhaps with header pins or connectors at each end.

About the batteries, I was thinking of the 4 AAs, but the lm7805 that i would use for my standalone atmega could take no less than 7volts, and the motors run ideally at 1.5v with a max of 3v. I am using the 3 AAs because the l293d has a vdrop of 2.6v putting me in the prime power range.

Then use two 3 AA packs (4.5V per pack) in series, tap the middle (4.5V) for the motors, and the end (9V) for the Arduino; if you can find a holder and the cells, sub-C sized cells would be an even better choice (larger capacity, but smaller than standard C cells). Another (and easier to implement) alternative would be to use NiMH AA cells, to give you a 3.6/7.2V pack.

:)

Instead of using the L293D series, you're better off using the SN754410 (exactly the same pin layout as the L293D) which can handle twice the output of the L293D.

Also replace the motors in the gearbox for solarbotics RM3 motors, which have a much lower stall and with the SN754410 h-bridge that will mean you won't have as many power issues with driving your motors

That then means you can run 9-12 volts for your motors and you can use a 9v DC power supply for the Arduino. And your robot will be much more responsive in terms of movement.

I did something similar with the same parts pretty much - though mine was even more basic than yours :)

http://luckylarry.co.uk/arduino-projects/obstacle-avoidance-robot-build-your-own-larrybot/

I made a very similar robot using the same Tamiya parts. It was a light seeker.

The gears would make some crazy noises and the treads would fall off when it performed a turn on carpet.

Does yours expereince these issues too?

I've been wondering how well the treads hold up aswell, as the tamiya treads appear to be the cheapest ones around... Admittedly, also the flimsiest looking ones around.. (haven't seen them in person though)

Looks like an interesting bot though =) Are you going to add something cool to it? perhaps a ping-pong ball artillery weapon? =P

Hi Folks. I got my Arduino Board a few weeks back and have done some basic things. All my parts for my first robot should turn up in the post in a day or two. Its based on the one on LuckLarrys page. Can't wait to get started. Stand by for details! Cheers form Australia.