Let's Make Robots!

Intro

This is my second robot, sort of an improvement over my first one of which I unfortunately lost all pictures. This is a sturdy platform that uses a plastic box for its chassis. It has 2 wheels and a caster wheel at the back. So far it can move around and sense its environment, but I plan to add more sensors, maybe explore OpenCV when I add a camera. 

Design features

2 wheel drive, caster wheel, buzzer, LED, PING US sensor, arduino (with a couple of free pins left), motor controller, ON/OFF switch, FTDI input for quick programming, conveniently placed battery box, bumpers, high traction on wheels, APC220 RF Module

I think this stuff is very helpful for further experience in robotics.

What I learned

It's possible to extend microswitches by wrapping thin metal sheets around them (very helpful)

Jar covers have the same diameter as the Solarbotics wheels

Wrap an elastic band around the jar cover for traction (add some glue to fix in place)

Electronics

There are no circuits aside from two 10K pull-down resistors for the bumpers. Really, it's all just connecting the pins together through the breadboard. Of course, the breadboard method feels like hell when it comes to making the circuit, but it works, it's fast and sorta durable. If I had the money though, I would've printed the PCBs I made. I have made PCBs in hopes of making them myself with DIY methods but I gave up seeing how much of a pain they could be. In the future I still plan to learn how...

Mechanics

Well I can't say it's great, but hey! it's all recycled materials! I used a dremel tool/drill to cut/drill through the plastic. Sometimes I used polymorph or hot glue to replace nuts or to fix things in place. Not pretty, but still effective. 

Programming

Pretty straightforward so far. I use Arduino 1.0.2 for programming. I remember having tried to use Processing for serial communication through the APC220, but never managed to make it work. I'll hopefully find a solution this time. For some reason, I couldn't attach the .ino file so I'll paste the code here (it's the one executed in the video).

 

#define PWMa 3

#define PWMb 5

#define AIN1 9

#define AIN2 8

#define BIN1 7

#define BIN2 6

#define Buzzer 2

#define pingPin 4

#define PhotoLeft 3

#define PhotoRight 2

#define Battery 1

#define LED 11

#define BumperLeft 10

#define BumperRight 12

long ping;

boolean right;

boolean left;

int left_state;

int right_state;

 

void setup()

{

  analogWrite(PWMa, 255);

  analogWrite(PWMb, 255);

  pinMode(AIN1, OUTPUT);

  pinMode(AIN2, OUTPUT);

  pinMode(BIN1, OUTPUT);

  pinMode(BIN2, OUTPUT);

  pinMode(LED, OUTPUT);

  pinMode(Buzzer, OUTPUT);

  pinMode(BumperLeft, INPUT);

  pinMode(BumperRight, INPUT);

  right = false;

  left = false;

  int left_state = LOW;

  int right_state = LOW;

}

void loop()

{

  left_state = digitalRead(BumperLeft);

  right_state = digitalRead(BumperRight);

  ping = Distance();

  digitalWrite(LED, HIGH);

  Forward();

 

  if (ping < 19)

  {

    digitalWrite(LED, LOW);

    digitalWrite(Buzzer, HIGH);

    Right();

    delay(500);

    digitalWrite(Buzzer, LOW);

  }

 

  if (left_state == HIGH)

  {

    digitalWrite(LED, LOW);

    digitalWrite(Buzzer, HIGH);

    Backward();

    delay(500);

    digitalWrite(Buzzer, LOW);

    Right();

    delay(500);

  }

 

   if (right_state == HIGH)

  {

    digitalWrite(LED, LOW);

    digitalWrite(Buzzer, HIGH);

    Backward();

    delay(500);

    digitalWrite(Buzzer, LOW);

    Left();

    delay(500);

  }

}

 

long Distance()

{

  long duration, cm;

 

  pinMode(pingPin, OUTPUT);

  digitalWrite(pingPin, LOW);

  delayMicroseconds(2);

  digitalWrite(pingPin, HIGH);

  delayMicroseconds(5);

  digitalWrite(pingPin, LOW);

 

  pinMode(pingPin, INPUT);

  duration = pulseIn(pingPin, HIGH);

 

  cm = microsecondsToCentimeters(duration);

 

  delay(100);

  return cm;

}

 

long microsecondsToCentimeters(long microseconds)

{

  return microseconds / 29 / 2;

}

 

void Forward()

{

  digitalWrite(AIN1, HIGH);

  digitalWrite(AIN2, LOW);

  digitalWrite(BIN1, HIGH);

  digitalWrite(BIN2, LOW);

}

 

void Backward()

{

  digitalWrite(AIN1, LOW);

  digitalWrite(AIN2, HIGH);

  digitalWrite(BIN1, LOW);

  digitalWrite(BIN2, HIGH);

}

 

void Right()

{

  digitalWrite(AIN1, HIGH);

  digitalWrite(AIN2, LOW);

  digitalWrite(BIN1, LOW);

  digitalWrite(BIN2, HIGH);

}

 

void Left()

{

  digitalWrite(AIN1, LOW);

  digitalWrite(AIN2, HIGH);

  digitalWrite(BIN1, HIGH);

  digitalWrite(BIN2, LOW);

}

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Markamas's picture

Thanks for the great comments guys! By the way, I have more pictures at my blog, I'm just too lazy to put them here. I will put them here eventually...

Duane Degn's picture

That's a great robot. It was fun to see it navigate around your place.

I thought it was going to get stuck under the table with all the chair legs there to get its way but it found its way out without any problem.

It would be nice if you could provide a photo of the inside of your robot. 

What are you using as a third wheel?

What kind of motor controllers are your using?

Thanks for sharing your robot with us and thanks for sharing your code.

Markamas's picture

Here's a picture of the inside: http://s20.postimage.org/clhslffnx/Inside2.jpg

I am using a caster wheel, as can be seen here: http://s20.postimage.org/cufdbcsgd/Bottom_back.jpg

I am using the Pololulu TB6612FNG motor controller

Happy to share!

Duane Degn's picture

If I had thought to check your "URL to more information" link, I would have found the pictures. Thanks for pointing out your blog.

I keep meaning to find a way to enclose my robots better than I usually do. The box makes you robot look nice and clean. It also looks more finished by not having loose wire hang all over the place.

chickenparmi's picture

What a great idea for a body! My mum has a few of them lying around, pretty sure if I stole one though I would get a talking too :)

Great all in all learning platform.

Markamas's picture

Hahah I asked though... after I had drilled it inside out!

birdmun's picture

Thanks for sharing.