1
$\begingroup$

I am building a collision avoidance system for my robot. As a part of this system I am using a pan and tilt kit

(http://www.robotshop.com/en/lynxmotion-pan-and-tilt-kit-aluminium2.html)

My aim is to pan the sensor attached to this kit, and thus plan the route the robot should take.

In order to pan this sensor, I need to know the angle the kit has panned, and need to be able to call upon that angle at point in time.

Basically the sensor keeps panning, and at a point in time when certain conditions are met, it stops panning. When those conditions are met, I need to be able to extract the angle the sensor is panned at.

The servo being used on is: http://www.robotshop.com/en/hitec-hs422-servo-motor.html

If someone could help me find a way to extract this information that would be helpful. I did read somewhere that the servo could be hacked and changed into a closed loop system where the effective angle would be shown, but that option is not viable.

Thanks

$\endgroup$
2
  • $\begingroup$ Hooking a potentiometer on the axis could be the option? $\endgroup$
    – Eugene Sh.
    Commented Dec 8, 2014 at 16:15
  • $\begingroup$ BTW, servo IS working in closed loop, so if you are not working with high loads, the position will be the actually commanded position, so you don't really need to read it. Hacking the servo can give you readings from the internal position sensing potentiometer. $\endgroup$
    – Eugene Sh.
    Commented Dec 8, 2014 at 16:18

2 Answers 2

2
$\begingroup$

Servos are by definition, in the position you told them to go (or in a fault condition). This is the difference between a servo and a stepper. You tell a stepper to move 1 step at a time and do not know if it did or not. A servo on the other hand will continue trying to get to the position you asked. For hobby Servos, you are setting a pulse width / duty cycle in some part of the code. You can assume that IS the servo position for all intents and purposes. The standard servo's low value is 1000, high value 2000, and obviously 1500 in the center position.

Taken from Servo motors and controlling them with PWM

They have one really great feature: the interface to control them is super simple, just the pulse width of a digital pulse sent to the motor at a rate from 50-200Hz. The pulse rate is not that important. The important thing is the pulse width. The range of the pulse width is from 1-2ms. 1.5ms is the middle servo position and 1 or 2 ms are the end positions.

You cannot control the torque, rate, or anything else; as soon as the servo's electronics detects the pulse width (which can require several pulses) it tries to get the servo to the new position as quickly as possible. You also cannot sense the servo's position, current or anything else; control is open-loop as far as the servo is concerned; all control is handled inside the servo.

Servo PWM control


Just as a warning, most modern servos DO NOT use potentiometers. Today, most use optical encoders for positional sensing, so reading an analog signal is going to be difficult (impossible).

High end servos such as the HiTech do provide feedback (positional) information.

$\endgroup$
0
$\begingroup$

Servos use potentiometers to get information about the output shaft position and makes the internal feedback loop. In order to retreive the servo position, you will need to open and extract the output value of the potentiometer in order to use it for your own purpose.

enter image description here

You will need to solder a cable to the output of the potentiometer and connect it to your own circuit. You will get an analog signal relative to the position of the servo. Position can be found using the relation

$$\theta = \theta_0 + \frac{V_{out}}{V_{max}}$$

  • $0 \leq \theta \leq 360°$
  • $V_{max}$ is the maximum voltage at the potentiometer end. Usually, it is $V_{DD}$, the voltage of the servo.
  • $\theta_0$ is the initial position and depends on the servo.
  • If used with a microcontroller, you will need an ADC input (analog input).
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.