{"id":6471,"date":"2019-10-19T14:38:15","date_gmt":"2019-10-19T18:38:15","guid":{"rendered":"https:\/\/dronebotworkshop.com\/?p=6471"},"modified":"2023-04-12T11:13:08","modified_gmt":"2023-04-12T15:13:08","slug":"analog-feedback-servo-motor","status":"publish","type":"post","link":"https:\/\/dronebotworkshop.com\/analog-feedback-servo-motor\/","title":{"rendered":"Analog Feedback Servo Motor"},"content":{"rendered":"\n
<\/a> <\/a> <\/a><\/p>\n Today we will look at a special type of servo motor, an \u201cAnalog Feedback\u201d Servo.\u00a0 This type of servo motor has an additional connection that outputs the motor position. Interestingly, this motor can also be used as an input device.<\/span><\/p>\n Servo motors<\/a> are pretty popular items here in the DroneBot Workshop. I\u2019ve used them in several projects and demonstrations, and have also produced an article and video that covers them in-depth.<\/span><\/p>\n There is a very good reason for their popularity, both around the workshop and among hobbyists in general.\u00a0 Servo motors are inexpensive, have a great size-to-torque ratio and, most importantly, can be easily controlled with a great deal of precision.<\/span><\/p>\n <\/p>\n But despite all of their virtues servo motors do have some limitations. They are essentially a \u201cclosed-loop\u201d system, so once you send them a command to move into a specific position you need to depend upon the servo motors internal controller to perform this accurately.\u00a0<\/span><\/p>\n You have no way of easily determining a servo motors\u2019 actual shaft position, you have to assume that the servo has obeyed your command and is now resting where you want it to. This may not be true, especially if the motor has been subject to an external force.<\/span><\/p>\n An Analog Feedback Servo Motor can resolve these issues.<\/span><\/p>\n An Analog Feedback Servo Motor is essentially a \u201cregular\u201d servo motor with an additional connection. This connection is an output from the servo motors internal potentiometer.<\/span><\/p>\n To understand this a bit better let\u2019s take a look at how a \u201cregular servo motor operates.<\/span><\/p>\n A servo motor operates using what is sometimes called a \u201cclosed-loop\u201d system.\u00a0\u00a0<\/span><\/p>\n <\/p>\n In this type of system, a microcontroller or other device is connected to the servo motors control input. A PWM (Pulse Width Modulation) signal is sent over this connection, the width of the pulse determines the desired motor position.<\/span><\/p>\n This signal is sent to the servo motors internal controller. The controller drives the motor, which is a DC motor with a lot of gearing on its output shaft. Most servo motors limit the amount of rotation on the output shaft, usually to 180 or 270 degrees of rotation.<\/span><\/p>\n The output shaft is also coupled to a potentiometer, which measures the shaft position. The output of the potentiometer is sent back to the internal controller, to let it know the position of the motor. The controller uses this information to move the shaft into the correct position.<\/span><\/p>\n For the most part, this arrangement works pretty well, however, a few issues can arise:<\/span><\/p>\n In many cases, most of these issues won\u2019t affect the performance of our project.\u00a0 But if precision positioning is a requirement then the Analog Feedback servo motor has some advantages.<\/span><\/p>\n The Analog Feedback Servo Motor is simply a \u201cregular\u201d servo motor that has been modified to bring the output from its internal positioning potentiometer out to an external connection. As the potentiometer rotates it will change the voltage on this output, and this can be used to dynamically determine the motor shaft position.<\/span><\/p>\n <\/p>\n By outputting the position information we gain a number of advantages over the \u201cclosed-loop\u201d system used in a regular servo motor:<\/span><\/p>\n Of course, it still isn\u2019t perfect, the feedback signal is coming from the same positioning potentiometer and is still affected by the pots tolerance.\u00a0<\/span><\/p>\n Essentially, an Analog Feedback Servo Motor brings the external controller into the feedback loop.<\/span><\/p>\n You can actually modify a standard servo motor to become an analog feedback motor, as long as you\u2019re willing to open up your motor and thus violate any warranty that it came with. Since most hobbyist servo motors are pretty cheap this usually isn\u2019t a great concern.\u00a0\u00a0<\/span><\/p>\n By connecting a wire from the center, or wiper, of the internal potentiometer, you can gain access to the feedback signal. You may need to \u201cclean\u201d the signal with a small filtering capacitor.<\/span><\/p>\n But the easiest way to obtain an analog feedback servo motor is to just go and buy one! They are not really that much more expensive than regular servo motors. In fact, you can ignore the feedback output if you wish and use them as a conventional servo motor.<\/span><\/p>\n For our experiments, we will be using the S1213 Analog Feedback Servo Motor<\/a>.<\/span><\/p>\n <\/p>\n The S1213 is a mid-sized plastic-gear servo motor with an additional feedback output. It operates on 5- VDC and has a torque rating of 4.5 kg-cm, which is robust enough for many applications.<\/span><\/p>\n The motor has four connections, three of them are on a standard servo cable and the feedback connection is on a separate wire.<\/span><\/p>\n If you need a smaller analog feedback servo motor you might want to take a look at the S1123 instead, it uses the same form factor as the popular SG90 servos often used in hobbyist projects.<\/span><\/p>\n Our first experiment using the analog feedback servo motor will be a simple calibration sketch.\u00a0 We will use it to correlate the position of the motor with the value returned by the feedback signal.<\/span><\/p>\n Wiring up our demo is quite simple.\u00a0<\/span><\/p>\n <\/p>\n In addition to the Arduino Uno and the S1213 analog feedback servo motor you\u2019ll also need a power supply. While you could use the 5-volt output from the Arduino it is much better to use a separate supply to keep any induced electrical noise from the motor away from the Arduino.<\/span><\/p>\n If you do decide to use the Arduino 5-volt output you should place a small electrolytic capacitor across the line, close to the motor. This will help reduce some of the electrical noise and will also provide a small current reservoir for the motor.<\/span><\/p>\n After everything is hooked up it\u2019s time to load a sketch to the Arduino.<\/span><\/p>\n The calibration sketch is pretty simple. It homes the motor to the zero-degree position, then steps it in increments of 5 degrees. On each step, the value from the feedback signal is read and displayed on the serial monitor.\u00a0 When we reach the 180-degree point (the limit of the servo motor travel) it returns to the zero position.<\/span><\/p>\n A one-second delay has been added in between each step, in order to make the display more readable and to give the motor time to settle into position, As the motor doesn\u2019t need a full second to stabilize you can always reduce this value if you wish.<\/span><\/p>\nIntroduction<\/h2>\n
Analog Feedback Servo<\/span><\/h2>\n
Regular Servo Motor Operation<\/span><\/h3>\n
\n
Analog Feedback Servo Operation<\/span><\/h3>\n
\n
S1213 Analog Feedback Servo Motor<\/span><\/h2>\n
\n
Calibrating the Servo Motor<\/span><\/h2>\n
Arduino Hookup<\/span><\/h3>\n
Motor Calibration Sketch<\/span><\/h3>\n
\/*\r\n Analog Feedback Servo Calibration Demo\r\n feedback_servo_calib.ino\r\n Uses S1213 Analog Feedback Servo Motor\r\n Results displayed on Serial Monitor\r\n\r\n DroneBot Workshop 2019\r\n
Welcome to the Workshop!<\/a><\/blockquote>