My First Robot (with Arduino)
| Attachment | Size |
|---|---|
| First_Robot.pde_.bas | 4.19 KB |
This is based off of the "First Robot" tutorial and uses the Arduino Decima board instead of Picaxe; it's also the first robot I've ever built.
The Arduino board doesn't have a dedicated slot for the motor driver chip, so it had to be on it's own board. After doing that I decided to make that board the main one and use several pin/header rows to connect it to the Arduino board and peripherals (sensor, servo, motors). This way I could easily unplug the motor when I wanted to test the servo or reconfigure things on this fly. It ended up working very well.
At first I was having some trouble with the motor driver, so I added an LED to each of the 4 control pins of the driver chip. Now I can see which ones are high and low (see second video).
Programming the Arduino does take a little more code to control the servo, but I personally feel more comfortable with thta style of programming than Basic. Plus, since I'm a Mac user it's nice to have a development environment that works on my system. I am also learning Picaxe basic and will be building some robots with my Picaxe 18x project board soon. I've already built a controller to run a big brushless motor through an RC motor controller with the Picaxe 08m (will post pics and videos soon).
To judge distances the robot uses a Parallax Ping ultrasonic sensor that I picked up at my local Radio Shack. This sensor has 3 pins: 1 for data, 2 for power (vin, gnd). The results were very consistant until I plugged everything else in. I suspect that the electrical noise from the servo and motors were causing a slight "blip" (technical term) in the results, so I added a function to average it out.
To debug the code there are a number of Serial.println functions that send a message to the serial viewing window. It's very handy.
I've uploaded the code for anybody who might want to try it. You need to remove the "_.bas" extension -- I added this to get through the content upload filters. The code requires the Servo.h library that you'll need to download and unzip in the "hardware/libraries/" directory which is in the same directory as the Arduion IDE program.









@ Tue, 2008-07-01 04:13
How you made the head stand up
That thing you have on the servo that connects the head to the sensor... was $9 int the shops here!
theres supposed to be brackets for the Ping))) but i didnt want to wait for it in the mail
so i used rubber foam :)
@ Tue, 2008-07-01 05:45
Ping Stand
The Ping stand was actually pretty simple.
- I bought a cheap Perf Board from my local electronics shop (Radio Shack) and used my dremel tool to cut it down to that smaller size.
- Soldered the Ping to one side and a row of male pin headers (http://tinyurl.com/4rn7q5) to the other.
- The headers are optional, I could have soldered the wires straight to it. However, this way I can unplug it when I need.
- I attached the perf board setup to the servo with a couple of small screws through the existing holes and into the servo horn.
It makes for something that is very modular and can be moved between servos or other setups.@ Tue, 2008-07-01 07:11
Hey that is a pretty good
Hey that is a pretty good "ping stand" - you should make a walk through (just a short one) - Everyone are struggeling to mount their sensors, you have found a nice solution! :)
F.
@ Thu, 2008-06-26 16:31
Quote!
@ Thu, 2008-06-26 16:12
You should be able to upload
@ Thu, 2008-06-26 00:07
Cool, nice work, feels good,
Cool, nice work, feels good, doesn't it? Have made electric life.. :)
I hate videos shot in the dark - however, it is actually pretty funny and cool that in your first video the bot drives towards a sign that says "Track ->", and it turns that way and drives on :D
A new robot is born, it makes me happy :D Thanks for sharing!
@ Thu, 2008-06-26 00:26
Thanks, it does feel really
@ Thu, 2008-06-26 06:46
Sunlight is the keyword here