
A robot driving on servo motors, controlled by an Arduino microcontroller
This is something I’ve always wanted to do: build my own robot! Inspired by some great videos I saw around the web, I finally started realizing my ideas. One of the first videos I saw of Arduino-powered robots was this Arduino Rumble Robots video:
Fairly easy, but nonetheless fun to mess around with. But for my final robot, I want some sort of combination between this, this and this robot. A semi-autonomous arduino robot equipped with several sensors and a camera, controlled by my Samsung Galaxy S smartphone (running android). By semi-autonomous I mean that it is possible to control the robot, however it will automatically detect walls and other obstacles and avoid them making it (almost) impossible to crash it into walls. Additionally the robot will also have a ‘full autonomous’ mode, where it will just do its own thing, drive around and avoid anything that comes in its way. Possible? Ofcourse! It will probably take me quite some time though. I currently have quite a lot of work to do for university projects and assignments. Building this robot has a low priority.
Last week I finally got me some parts to start working with! After doing some research online about powering a robot with an Arduino microcontroller I assembled a little list of parts I wanted to use. Because using standard DC motors would be just a tad too difficult for me (I have literally no experience in this field) I decided to go with continuous full rotation servos instead. These are really easy to connect as they only have 3 wires: power, ground and a control cable. To detect avoid obstacles I’ll be using an infrared distance sensor, possibly mounted on a third servo to enable 180 degrees scanning.

First test setup to test the continuous full rotation servos
Ofcourse, when I got the parts I immediatly started playing with the servos. Using the standard servo library that is already included in Arduino, it was quite easy to hook up 2 servos. I then built a quick control panel in Processing, so I could control the servos over serial (USB). Using this little control panel I could control the 2 servos to make the robot move forwards, backwards, turn left and turn right. The reason I’m using 2 servos (1 for each wheel of the robot) is to enable so-called “zero turning radius“, which means higher flexibility so it can move easier around the house.
I also already programmed the ‘avoidance sequence’. I’m using an infrared distance sensor with a relatively small range (10 to 80cm, a larger range isn’t needed for this project) to detect any obstacles in front of the robot. Whenever an obstacle is too close, the robot will stop and move backwards until the obstacle is far enough away. This also means that it can avoid objects that move in on the robot. After the obstacle is far away, the robot will make a 90-degree turn to the right and move on. The only downside of this whole thing is that the robot can only see what’s in front of him. To solve this, I’m planning on mounting this distance sensor on a servo so it can see a full 180-degrees around him. Then whenever something is detected, it will look to the left and right and turn to the side where the most room is.
About time to build the first prototype. I originally plan on taking a toy car apart and use its body and wheels, maybe one of my old RC cars if I can find one. However, I couldn’t find one at the moment and to be honest it is not needed just yet. Instead I built my first prototype with K’nex. Not kidding. You can quickly create a decent little robot with K’nex, in the exact shape and size you want! The only downside is that it is not very solid and can quite easily fall apart if you accidentally crash it into a wall.
Anyways, there was one little thing I did not think of. Power. During the testing, the Arduino always got its power through the USB cable connected to my laptop. However, it can’t be connected to my laptop when it needs to drive around. Ofcourse. No worries though, I hooked up a little 9V battery to power the Arduino, which also doubles as a nice counterweight to make sure the 2-wheeled robot does not tip over. Assembling the rest of the robot was fairly easy and I made a little video of my first test run (together with some pictures of the prototype):
There are still quite some things to do:
It’s been a while since the latest update on this project. Unfortunately I’ve been quite busy with university projects, exams and the like. And after all that was over I went on a nice holiday to France with my girlfriend. Anyways, I finally found me some time to further work on it. Oh, I’ve also decided to name it ShortCircuit. Actually, Nigel (a.k.a. Enzu) suggested it to me and I liked the double meaning it has. I’ll try to whip up a matching logo later. First things first.

The 'BlueSMiRF Silver'
So, in the mean time I ordered the stuff I needed to connect to my Arduino over Bluetooth. Pretty much all you need is a Bluetooth modem. Instead of ordering a cheap-ass module I decided to go with the BlueSMiRF Silver, because of the good documentation and tutorials available. It sound really easy, just connect the four wires and you’re good to go. As you can probably guess, reality was a bit different. I connected all the wires as stated in the example (Rx to Tx, Tx to Rx, Gnd to Gnd and VCC to the 5V on the Arduino). I opened up Putty (a really basic terminal program you can use to ‘talk’ to the Bluetooth module) and sent some commands. However, the module did not respond. At all.
I looked up a lot of different examples and tutorials and tried them all. None worked. I then found out about the baud rate. Having no experience with Bluetooth at all, I really had no idea what I was doing. I read somewhere that I had to change the baud rate to 57600, because that works best for the Arduino. But I had to use Putty for that, which didn’t work. I then found out that my connections were a bit sloppy. Because I don’t want to solder anything (yet) I connected the Bluetooth module with some headers to the breadboard, but apparently I had some loose contacts. I solved this by securing the module tighter to the headers. This didn’t solve the problems though. Lot’s of wasted hours (took me two full days of messing around) later I connected the VCC to the 3.3V on the Arduino instead of the 5V and… you guessed it, it worked! I did some Googlin’ on the matter but I still do not know why it did not work on 5V. But hey, who cares?! It works! I hooked up the servos and launched my little Processing sketch I will use to control the robot. This sketch is nothing more than 4 triangles, which correspond to the up, down, left and right button respectively. Whenever you press one of the arrow keys, the corresponding triangle will light up and will send data over Bluetooth to the Arduino. The Arduino then reads this data and controls the servos accordingly. I could now control the servos wirelessly from my laptop over Bluetooth.
I just have to build this all in the robot – along with an extra battery pack to power the servos.
No comments yet, be the first!