How do you get servo position in arduino?

I've finally managed to get my servo working, now im stuck at how do i get the servo position values from the arduino?

I basically need it to detect its at 90 degree's & stop at around 90 degrees

Is there anyway to detect the servo position?

thnx

Is there anyway to detect the servo position?

No, the servo has no way to send back it's position. Only the variable you use in the servo output command has the ultimate location of where you wish the servo to go. It's 'open loop' control only.

Lefty

What about attaching a sensor or something to the servo to detect the angle of the servo?

How are you using the servo? Typically, servos don't move unless you tell them to.

how do i get the servo position values from the arduino

http://arduino.cc/en/Reference/ServoRead

;)

servo.read() method returns the last position value written to the servo. This may not the same as the actual position. The Servo.attach() method lets you specify minim and maximum values for the positioning commands and these can be changed to adjust the relationship between the commanded positions and actual position.

Bear in mind that many servos will not mover over a full 180 degrees and that the servos can take a signficant fraction of a second to move over their full travel/ The read value will not indicate the actual position if the servo is moving

I need to find the actual servo position as a failsafe, or error correction, as im planning to build a servo arm with about 6 or 7 servos to begin with, then ramping up to 14+

I basically need actual feedback from the servo's

I also want to be able to move the servo's by hand & record the position i put the servo in.

Some servos can be hacked to provide a closed-loop access to the potentiometer position. I would describe it, but this guy does a great job with plenty of pictures.

http://www.eamaemirkin.com/site/serv/

The actual wiring may differ slightly between servo types, but you might get lucky by googling for information about a particular servo part number.

hi, thats an excellent site thnx halley

I also found this & it has actual arduino code to go with the servo!

http://forums.trossenrobotics.com/tutorials/how-to-diy-128/get-position-feedback-from-a-standard-hobby-servo-3279/

cool.

I look forward to hearing about your progess, please keep us posted

Will do, are there any substitutes for soldering lol, i h8 soldering ... might try some sticky tape first :)

Hmm why not just sticky tape a potentiometre onto the servo? Much easier then trying to hunt down the specs for the servo ...

Or any other alternatives to a pot meter i can stick to my servo?

any progress on this?

I have a similar problem. I am using a HS-645MG hitec servo and have the same problem. It is not accurate (it slows down a lot when it is close to the target), so reading its current position would be what I need to stop exactly when I want...

did you finally solve it?

thanks!

I just sellotaped a potentiometer to the servo, & read the feedback from the pot, the onboard potentiometers i wasnt very happy with

I just sellotaped a potentiometer to the servo, & read the feedback from the pot, the onboard potentiometers i wasnt very happy with

How does one tape a pot to a servo such that the pot does not interfear with using the servo horn? Do you have a picture?

I attached the pot to the servo horn, with some glue, so it rotates as the servo horn rotates, then sellotaped the two together

You could attach a servo horn to the pot too, & screw the two horns together

I'm using muscle wire servos now, attached to some pots, & planning to build my own servos using muscle wire, with integrated pots