Arduino-based robot with IR radar
The robot prototype in this Instructable is my second Arduino-based "slumbot" which is an autonomous robot. It's attached together with household items and scraps. The robot "sees" with an IR scanning sensor rotated by a servo. It looks left, forward, and right for obstacles and distances then decides where to go.

The code name for the robot is Faz3a-X. Faz'ah is slang for a sudden collective fit of rage and lunacy :)

After reflecting on my design themes for this and my other robot, words such as junkyard and Mad Max come to mind.

So let's get started.

MAIN PARTS
- Arduino UNO: $28
- Turnigy TG9e servos (2 modified for continuous rotation): $2 each = $6
- Sharp IR sensor GP2Y0A2 for about $14
- Arduino prototyping shield is optional. You can use a mini breadboard: $15
- 9V battery and pack $3
- 6V Alkaline or 4.8V NiMh 4 X AA batteries and pack $4
- 10uF cap for IR sensor: $0.2
- 0.01uF ceramic caps for for servos X 3 = $0.30

TOTAL: about $70 (in Jordan, expect to pay almost double after shipping, handling, tariffs, taxes, clearance fees)

PLATFORM
- External 3.5" USB hard drive enclosure
- Table leg slider pin (caster)
- Toy car wheels X 2
- Construction set parts for wheels axle and servo mount

TOOLS
- Velcro (what a great invention for prototyping)
- Paper binders/clips
- Rubber bands to give plastic wheels traction
- Stapler to staple rubber bands
- Glue
- Tape, single and double sided
- Wires

WHAT'S NEXT
Next phase of this prototype will involve refining the attached Sketch for better radar/movement coordination and finer obstacle detection instead of the simplistic Right, Front, Left scanning algorithm used here.

Also, the robot platform needs to go on a diet to shed a few ounces but to do it with household items or office supplies. As in my previous robot project, in which I used Arduino to control a cheap toy car, I try to make sure as much of the robot as possible is made up of readily available items in Jordan considering commercial robot parts are nonexistent in local markets and the tariffs and taxes (corruption money) and shipping costs would discourage most Jordanian Makers from pursuing their robot projects.


Step 1: The robot IR radar module

Arduino-based robot with IR radar
Arduino-based robot with IR radar
Arduino-based robot with IR radar
Arduino-based robot with IR radar
Arduino-based robot with IR radar
Arduino-based robot with IR radar
Arduino-based robot with IR radar
Show All 7 Items
I made use of the plastic cover of a MiniDV tape as a mount for the Sharp IR radar. I used a drill pit to make the screw holes, and sand paper to taper the edges of the plastic cover. It's a rough job but it works.

The servo spins the IR sensor left, forward, and right and reads distance in each direction. In this project, the robot will turn in the direction where there's more space.

I used construction set parts to create a mount for the sensor and servo.

In the video below, I test the IR radar scanner connected to the Arduino and rotated by a TG9e micro servo. It's sending back distances for each direction.

With a piece of Velcro attached to the bottom of the mount, using glue, I can affix the whole radar mechanism on the robot platform and change its position with little hassle.



Step 2: The robot platform

Arduino-based robot with IR radar
Arduino-based robot with IR radar
Arduino-based robot with IR radar
Arduino-based robot with IR radar
Arduino-based robot with IR radar
Arduino-based robot with IR radar
The aluminum external USB drive enclosure had the added benefit of the cavity which allowed me to tuck wires in. While making this robot prototype, I was not ready to trim any wires until I was done affixing all parts to the platform.

For the robot caster, I used a furniture leg glider/slider pin. I glued a piece of IC shipping foam/sponge to the bottom of the USB enclosure and just stuck the glider pin into it. Works great on smooth surfaces like my marble floor. I considered round drawer handles and even deodorant roll on sticks as casters.

To hold the various robot components on top of the platform, I covered it with pieces of Velcro using double sided tape. For this sort of prototyping, Velcro and double sided tape are useful.

Then, I wrapped the two battery packs(9V and 4xAA) with Velcro. I taped a small Velcro piece on the bottom of the Arduino Uno and the IR servo mount.

Now, everything can be affixed to the platform surface. Best of all, I can rearrange the parts with little effort.

Step 3: The robot wheels

Arduino-based robot with IR radar
Arduino-based robot with IR radar
Arduino-based robot with IR radar
Arduino-based robot with IR radar
Arduino-based robot with IR radar
I had to modify two TG9e servos for 360 rotation. For that, I followed the instructions of Nicolas "ndupont" Dupont. I discovered his page after I destroyed two TG9e servos while trying to do the impossible: squeezing two resistors inside a very compact servo case. For those who attempted to do this, you know what I mean. The TG9e case is too tight to accommodate standard resistors, unless you are highly skilled or use smd resistors.

These servos are good for disposable use since they are cheap but they emitted so much noise to the point my IR sensor was giving erratic readings even with decoupling capacitor. So I ended up powering the servos separately then I added decoupling capacitors to each servo between VCC and GND, same for the IR sensor.

As for the wheels, I pulled them off a toy car, then I retooled their axle hole with my dependable drill pits and screwd them onto the servos. With the help of rubber bands, they got traction. Without the rubber bands, sometimes the robot would skid during turns on smooth surfaces such as marble.

To hook up the servos to the platform, I used construction set parts with the help of electric tape. I did not wish to make any permanent attachments to this platform yet. So the tape did a good job of holding the axle to the wheels. And with the help of two paper binder, I attached the axle to the USB enclosure.

Step 4: Integrating the robot brain with the platform

Arduino-based robot with IR radar
Arduino-based robot with IR radar
Arduino-based robot with IR radar
This is the fun part (after hours of frustrating trials). I assembled the parts, without the robot platform, and tested the connections. After a few wiring adjustments and Sketch debug routines, it worked.

Then came the hard part: coding the Arduino to control the 3 servos and the IR sensor.

NOTE: I started the tests with one 9V (6 X AA) power source but decided to separate power to Arduino/IR from a 9V while powering the 3 servos from a 6V (4 X AA) or 4.8V if using 4 AA NiMh. The noise generated from the servos was throwing off the IR sensor readings and based on the experiences of others, it's better to separate the power sources.

In this video, I am testing the fully assembled robot in the lab to ensure wheels are reacting correctly to information from the IR radar. Of course this only tests the accuracy of the wheel spin directions. Without wheel traction, it's not possible to know how long the wheels need to spin to make a good turn. This data can be measured only when you test the robot on the target surface. In my case, marble floor.


Step 5: The Sketch code to run the robot

Arduino-based robot with IR radar
After so much trial and error and research...

THE ARDUINO SKETCH CODE

This beta code drives the Arduino-based servo-driven sweeping IR radar to perform obstacle avoidance and servo control.

Latest Version: Beta 0.8 Oct 22, 2011

This code was written to be as self-documenting as possible. I used verbose and expanded syntax instead of compact code to make it easier to understand and to port to other programming languages. With the exception of the IR reading code, this Sketch was not copied from any project but I benefited from the collective experience of many others. Anyone can use and modify this code with attribution.

This robot moves using differential steering. To make it turn, one wheel must move faster than the other in same or opposite direction for a period of time. I used trial and error to find this time value. it will be different for your own robot.

These time values depend on many factors such as wheel size, robot weight, surface qualities, traction, etc. It's best to test your robot on the target surface (eg sumo disc, marble floor) to arrive at working values so you don't have to change them later.

NOTE: To stop the servos, I simply "detach" them in the program then "attache" them when I need them to move again. This was better than the headache of trying to figure out the stop point of each servo I modified for continuous rotation.

The pseudo logic works as follows:

SETUP
Setup environmental and physical constants such as timing of wheel spins, safe distance to obstacle, etc;
Start robot;
Scan Left, Forward, Right;
Move in direction of greater space;

LOOP
Keep moving Forward while scanning ahead;
IF Obstacle reached THEN Stop and scan in All directions (Left, Forward, Right)
Move in direction of greater space;
IF Obstacles found on All directions THEN Backturn 360 degrees then scan in All directions agin (Left, Forward, Right)
IF Obstacle found in all directions THEN STOP;
REPEAT LOOP

That's it.

On the logical level, I have 3 main section of the Sketch code:

1) Setting up constants, physical and environmental variables.
2) Logic to turn IR servo and read distances and obstacle warning.
3) Logic to turn wheel servos forward, left, right, 360, and simply reverse.

Again, this is beta code but it works.

Here's another video recording, but poorer quality (taken with Nokia 5800 camera)

Arduino-based robot with IR radar
Faz3a_X.pde10 KB
 
 

Tag cloud

make build easy simple arduino making homemade solar laser printed portable cheap mini building custom cardboard wooden create super lego turn paracord chocolate your paper light intel