Let's Make Robots!

How to read servo angles

I am thinking to build a robot arm or similar construction which can perform pre-recorded moves.

So, my question is if there is any way to read the servo angle/position and store it in a value (lets say in the EEPROM) and later just run the program to read these values to perform the same moves than before.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

This might be interesting: http://www.youtube.com/watch?v=czfHGPT-VZ8

I am using modifid servos as rotating encoders. To read that ADC values into an EEPROM is quite simple.

Thanks Markus, this is what I was looking for. Did you hack the "sender"servo to just use the pot inside to give you the position? What value do you get from this?

 

Yes, remove everything from the servo, just use the pot and solder the 3 wires on it. This project might be quite interesting: http://letsmakerobots.com/node/22346

What values you get depends on your micro controller. I have an ADC value of 0-255 (8 bits). As the servo needs an input between 75-225, I break down the ADC value with following formula:

(ADC output*10)/17+75

that you will say this ;-)

I really thought there is a way without to take all the guts out of the servos... thanks again...

I have done exactly what you want to do.

Don't take any guts out of any servos.

http://letsmakerobots.com/node/4228

http://letsmakerobots.com/node/22176

http://letsmakerobots.com/node/24128

My links are not linking right (in the comment above)

and I can't seem to find the exact post I wanted to show you...

Working on it.

By the way --I have seen the hacked servos with extra wires on the pots --they work well and it is a simple fix but I could never get past the fact that you are driving the gear-train the wrong way (when moving the servos by hand).

To cut to the chase, and in case I can't find the post, the solution is to build a second arm (possibly smaller and to scale) and put pots on the joints instead of servos. The robot brain's loop is to simply check the position of all the pots, and write those values to the eeprom. All the data is written sequentially, so all you need is to know the end number of each routine. --The start number for each routine is the end number (from the last routine) +1. Now, to play back your routine, you just run the procedure in reverse.

The eeprom is read back, step by step and the values are sent to your servos. You will have to play a bit with some pauses between each of the steps. This is to replicate the time it took for the micro processor to get through each loop when it was recording. A few tests with a stopwatch and you can easily play back at the same speed you recorded at. --or-- you can "puppet" the arm (when teaching) in slow motion. When played back, you lessen the pauses. This will give you the "regular" speed you want, but at much higher resoulution.

 

Thanks Patrick and Chris, will see if I can do it. The thing wih the pots on the second arm seems the best solution, so you can assamble the arm and program it with the other one...and see right away the result.

Hi Lumi,

My idea was to use the modified servos on the second arm (use the cheapest servos you can find and remove everything except the pot, solder the 3 wires on the pot). The pot's of servos are linear and you can re-build exactly the same arm and you don't need to worry how to make joints on common pot's.

I got mini servos for 15 RMB per piece, they would be cheap enough to try this ;-)

Thanks Markus