Let's Make Robots!

arduino robot questions

hi will i have being wanting to make a robot for a long time and finally got the cash together to get the parts and whatnot so i have an arduino duemilanove micro controller, 4 full rotation servos and 2 sharp ir range finders one 4cm to 30cm range and one 10cm to 80cm i want to make a 3 legged walking bot a bit like swashbot2 but autonomes but being that this is my first bot i thort i would start with a simple 2 wheel ir range finder sort of thing anyway i have a few things i would like explained to me 

1) the full rotation servos can i control how far thay rotate at what angle thay are etc if not can i modifie the servo to do so like you can modifie the half rotation ones to become full rotation servos?

2)wen i start the servo eg: (myservo.write(180);) how do i make it stop in my code once  it starts. (sorry if this is noobie:)~

 3) i wont to control the servos with the ir range finders but how do i check what there readings are to be able to no at what reading to control what the servo dose. 

 any advice or directions were i can fined answers would be appreciated 

regards Endura 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
  1. RC servos have a potentiometer inside to show or "feedback" the motor position. When a servo is modified to be continuous rotation, the potentiometer (variable resistor) is no longer attached to the shaft and cannot show how far the shaft has turned. Potentiometers usually are only able to physically turn around 270 degrees. To get servos to turn to a certain position, some other type of feedback needs to be added. Nubotics makes this quadrature encoder device to do so. 
  2. Stopping a servo can usually be done by myservo.write(90) if the servo has been modified appropriately or by stopping sending pulses somehow.
  3. Check the Arduino site for analog input to read and experiment with the readings from a GP2D12 sensor put in place of the potentiometer there.

Thanks for the info i appreciate it i looked into this quadrature device and for the price it is i would be better of buying 4 new servos but good info to no later on for bigger projects anyway i am starting to understand the code of the arduino a bit better now.

Thanks 

Regards Endura 

You can easily make your own wheel encoder for less than 2$. See here. The damn thing actually works :D

If you add an extra sensor to my setup you could turn it into a quadrature encoder. BTW there are similar cheaper sensors around than the ones I used...

And here is a function for reading a GP2D12 sensor. It needs to be calibrated specifically to your sensor, but it's a good starting point. The datasheet for the GP2D12 explains the voltage to distance conversion and calibration pretty well.