Go Down

Topic: Roving robot (Read 8112 times) previous topic - next topic


The code looks great.  
So to build the rover, I will use two continuous servos and one regular servo for the sonic ping.  I do not know where the arm fits in.  Maybe an updated photo will help.

Q1) The continous servos:  Do I need to calibrate them so that they can go forward and backwards?  Maybe your code only handles forward.  


Answer: Yes, you need to calibrate them for forward and baclword operation


Sorry I've been quite busy lately. The "arm" in the code is just referring to the servo that moves the ultrasonic sensor. And yes, the code will tell the robot to move backwards under certain conditions.



Very cool project! I will definitely use some of these ideas for my HummBot project.
My HummBot will start with two IR sensors, but having seen this I will also add a Ultrasonic sensor.
The sensor you used is nice and small and seems pretty accurate.

Thanks, Mega


I know this is an Old topic but this is exactly what im trying to do. I get a "problem uploading to board" error when trying to upload the code from this thread. im using the latrest arduino board and the latest software 0013.

avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x00

is there any working code to make a robot like this floating around?


Go on this page there is a code source for a robot.



Feb 25, 2009, 12:31 am Last Edit: Feb 25, 2009, 12:33 am by zitron Reason: 1
If you are getting that error, it usually means you have something wrong in the hardware, the computer is having difficulty communicating with the arduino. If the code compiles, the code is not the problem.


hello everyone,

im dealing with a similar project yet i am going to be using 5-6 servos.  i know there is an easy program that can control servos on pwm pins nine and ten but how can i control all six.  I was wondering if i could buy a motor controller to couple with my arduino, is this possible? What type of motor controller would you suggest? Or, if there is a easier alternative please let me know.

btw I know very little about what i'm doing and researching this is hasn't gotten me much luck.


You can control 12 servo motors with digital pins without motor controller.

On this projets I controle  5 servos :


You can control 12 servo motors with digital pins without motor controller.

I don't think its practical for an Arduino sketch to drive that many servos in software if it needs to spend much time doing other tasks as well. The problem is that each servo needs to be driven for 1 to 2 milliseconds and all the servos should be updated every 20 milliseconds. That doesn't leave much time to do anything else if lots of servos need servicing

This  thread has a library that drives up to 8 servos using a Arduino hardware so that the sketch does not need to spend time pulsing the servos : http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1230479947


I agree with you. I dont spend time to wait the servos, there is the source code here :

It's not so difficult to write your own controller to do that without to have a library.


Feb 25, 2009, 10:50 am Last Edit: Feb 25, 2009, 10:51 am by mem Reason: 1
shenakan, I did look at that code before posting my comment.  It handles the refresh nicely but still blocks for the duration of each servo pulse.  8 servos pulsing at 2 milliseconds will only leave 20% of the available processing time to do anything else.


You'r right I don't spend time 20ms to wait but I spend between 1-2ms for pulses.

With 8 servos, this means I spend between 8-16ms for pulses every 20ms. So I still have between 55%-71% to execute my code and not 20% (if my operations are correct). It is not so bad. It was enough to control my robot with sensors.



Feb 25, 2009, 11:41 am Last Edit: Feb 25, 2009, 11:42 am by mem Reason: 1
with 8 servos:
20ms frame - 16ms pulsing leaves 4ms, 4 ms is 20% of 20 milliseconds.

I just wanted to pointing out that if you pulsed 12 servos by waiting for each pulse to finish you would have little time to do anything else.
Another issue with the sketch directly pulsing the servos is that it needs to be structured to service the servos every 20ms or so. As your code demonstrates, that can certainly be done, but for some it may be easier to only have to consider a servo when a new value needs to be written.

I also think that an advantage of a library is that it assists the grouping of the major systems of an application into separate components. This can make a complex application easier to understand, maintain and enhance because it reduces the likelihood of unintended interaction between components by providing a clear set of interfaces.

Anyway, good to read about your robot - have fun!


Nice work!
Im just wondering, is an ultrasonic sensor adequate for detecting when it has run into something, or is it better to have contact sensors as well?

Go Up