NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Sensors, Actuators, and Robotics » First Robot - Avoids Collisions

January 21, 2012
by Mindale
Mindale's Avatar

Just wanted to show you guys my first robot. It avoid collisions using voltage division with the photoresistor. Basically when it gets close to walls, the LED scatters off the surface causing a voltage spike in the photoresistor. When this happens, the robot backs up and turns a bit.

Here is a video link

Sorry for the darkness of the video, the robot works a lot better in low, constant light.

Picture of the board

To control it I am using the nerdkit to talk to an H-bridge which powers the two motors with 6V. The dip switch was used for testing, but isn't in use for this project.

Might not be the most amazing project in the world, but I am glad that it works. If you guys have any questions feel free to ask.

January 21, 2012
by Pr0ject
Pr0ject's Avatar

This is a very neat project! One question though, how did you program the photo resistor?

January 21, 2012
by Mindale
Mindale's Avatar

The reason I used the photoresistor was to put it in series with another resistor. Then I used the analog to digital converter on the microcontroller to monitor the voltage between the photoresistor and the regular resistor. As the photoresistor receives more light, it loses resistance. When this happens the microcontroller will see a higher voltage.

This is why the LED is there. As the robot apporaches a wall, the LED light scatters off the wall, and some of it goes into the photoresistor. This causes less of a voltage drop because the photoresistors resistance has increased. The MCU sees this as a higher voltage and tells the robot to stop, backup, and turn right.

January 23, 2012
by Ralphxyz
Ralphxyz's Avatar

I am surprised the CDS (photo cell) can sense the diffused led light in ambient room lighting.

I am going to have play around with a CDS, I have some I salvaged out of solar yard lights.

It looks like you have the breadboard laying on a sled, could you post some more pictures?

Also a wiring diagram would be great.

You should write this up as a Nerdkits Community Library project.

Ralph

January 23, 2012
by Mindale
Mindale's Avatar

Here are some more pictures of the robot:

Bottom:

Bottom

Side:

Side

Side:

Side

I glued a piece of cardboard on the bottom of the breadboard then I glued the motors to the cardboard. The reason I used the cardboard was just to make sure the motors had a more stable plane to attach to. The layer of plastic that is on the sticky breadboard stuff just didn't seem strong enough.

I want to add a ball bearing in a socket on the back because right now the robot just drags itself along which doesn't seem like the most efficient system.

Eventually I'll get a wiring diagram up, but overall the wiring wasn't too complicated.

Here is a link to the H-Bridge datasheet

The MCU talks to the A pins of the H-Bridge. I also had to add a capacitor between the 6V and ground (pin 8 of the H-Bridge) because the power kept dipping, if the motors changed direction, causing the MCU to reset.

The photoresistor can easily pick up the LED light, but the room has to be pretty dark and have constant lighting.

Thanks for suggesting this as a library writeup. I should clean it up some, but that would be a nice eventual goal.

January 24, 2012
by Ralphxyz
Ralphxyz's Avatar

Well what I like about it first of all is that it works!!

It doesn't appear overly sophisticated (i.e. I could probable do that).

It certainly would be a good mcu motor control project plus light sensing.

I was picturing a ball bearing rear wheel also.

I would certainly appreciate a Library Project write up with code, wiring diagram and pictures.

Of course I am already picturing modifications, I have some distance sensing led modules which have been discussed here in other threads. They would work in place of your led and cds cell, probable they would work in ambient (normal) room light as they use infra red.

But I like your concept, but most of all you got it to work,

Thank You.

Ralph

January 24, 2012
by Mindale
Mindale's Avatar

Thanks for the encouragement. I would like to make some modifications too. I just sort of cobbled it together with what I had, but the infrared LEDs to sense distance would be a great addition and I don't think they would be too expensive. Before you mentioned them, I was looking into the Parallax Ping ultrasonic distance detectors, but they are around $30 a piece, and I would like to have three of them. My eventual goal is to have sensors on the front and sides so the robot can react more dynamically to the situation.

If you want I can post my source code.

Also, I discovered that the robot also has an unintended use, which is that it will stay in shadows if I angle the photoresisor down. What I can do is hold a flashlight in one hand then make a fist below it so that it creates a dark spot on the floor. Later today when I have an extra pair of hands I'll post that video.

Thanks

January 24, 2012
by Ralphxyz
Ralphxyz's Avatar

Well you could easily make up your own using a infra red led and a infra red photo detector.

The modules I have are Sharp Distance Sensor 2D120X (4-30cm).

If you google Sharp 2D120X you'll see some neat discussions and sites.

I want to make a robot that can/will parallel park, I have seen one that will back in to a parking space and that would be cool to do also.

Ralph

January 24, 2012
by Mindale
Mindale's Avatar

Making a parallel parking robot would be a really fun project.

I made another video of the robot, where it stays in the shadow cast by a piece of paper.

Here is the video

The smacking noise is it bumping against the table when it changes direction.

I ordered some more parts and ended up going with the IR LED and phototransistor pairs that were used in the NerdKits theremin tutorial. I would like to build a robot that can sense distance from all sides, and will run away if you get close to it.

I think a shy robot would be pretty interesting.

January 25, 2012
by treymd
treymd's Avatar

Gearing up to enter the Micromouse Competition? The speed these little bots learn and then navigate the maze is astounding. Last Years Winner posts information about all of his bots. Min7 was the bot that won the micromouse portion of the competition.

Post a Reply

Please log in to post a reply.

Did you know that one NerdKits customer controlled a laser pointer with his computer using a microcontroller? Learn more...