Joined: 21 Jan 2010
|Posted: Wed Feb 24, 2010 8:55 am Post subject: Hack your servo v2.00 – Add 10-bit incremental / absolute en
|Modified continuous-rotation servos are used extensively by roboticists due to their small form-factor, enclosed motor-gearbox, ease of mounting and high-availability. Some users keep the original drive electronics and the potentiometer feedback element but this approach allows for limited position control and velocity control / profiling. Others tend to remove them and use external control/drive boards and custom-made encoders. Ideally one would prefer to have the feedback element and the new drive electronics enclosed inside the servo. Unfortunately hacks involving optical devices and code-wheels have very limited resolution and require a lot of precise work.
Magnetic encoders use spinning current Hall technology to measure magnetic flux distribution across the surface of the chip. They typically come in high resolutions and require very few external components. The operational setup requires a small disk magnet with circumferential field distribution to be attached on the rotating element whose angular deflection is to be measured, and in close proximity to the sensor IC.
This hack utilises Austrian Microsystems’ sensor IC as feedback element for a modified servo. The servo to be hacked is the popular Hitec HS485 HB.
- Standard-size or ¼ scale hobby servo.
- AS5040 IC
- Circular Magnet with circumferential field distribution, 2.5mm high, 6mm in diameter.
- IC breakout board (download schematics from here: http://01mech.com/magenc)
- Styrene plate 2mm thick.
- Small piece of wood 10mm thick.
- Multi-strand cables.
- Flat file
- Sanding paper or abrasive disk.
- 5min epoxy.
- Hand-drill or press-drill.
- Drill bits: 3.5mm and 5mm in diameter
- Start by removing the control / power electronics from the servo.
- Remove the feedback potentiometer.
- If continuous rotation is required remove the mechanical stop from the servo’s output gear.
- Disassemble the potentiometer keeping the rotation shaft. This is going to be used as a support shaft for the encoder’s disk magnet. The magnet is going to be glued onto it.
- Carefully flatten the potentiometer’s base using sandpaper or an abrasive disk.
- Roughen the side of the disk magnet to be glued onto the potentiometer’s shaft by using sandpaper.
- Take a small piece of wood, 10mm thick and drill a blind 3.5mm diameter hole approximately 5mm deep. This is going to hold the potentiometer’s shaft and the disk magnet vertically while the epoxy settles.
- Prepare a small epoxy mix, insert the pot’s shaft to the hole and place the disk magnet on the pot’s shaft with a small drop of epoxy between them. Carefully centre the magnet on the shaft and leave to settle for at least 6 hours (for a 5min epoxy).
- Insert the pot’s shaft in the servo’s output gear. Make sure the flatten area of the shaft goes fully into the corresponding ‘pocket’ of the servo’s output gear like it did before the modification.
- Take the styrene adaptor plate and ensure that it can be placed inside the servo’s casing. Use a scalpel and a small file / sanding paper to trim as necessary.
- Take the encoder board (the schematics for the AS5040 breakout board are downloadable from here: http://01mech.com/magenc) and solder the power and sensor output signal cables. I will be using the Pulse Width Modulated output since it gives a clear indication of the absolute position of the servo’s output shaft.
- There are 5 pins exposed on the encoder breakout board. 5volts, GND as well as, ChA, ChB - used for quadrature inputs and a Pulse Width Modulated output, having its width modulated according to the position of the magnet around the 360-degree obtainable range. Even though the AS5040 offers additional functionality (like: Step/Direction/Index, 3-phase commutation, and Synchronous Serial Interface) these are not used here as an effort to keep the board’s dimensions down and fit it in the servo’s tiny available space.
- Take the encoder board and the adaptor plate and bring them together making sure the IC and the slot on the encoder board align with the corresponding holes on the styrene adaptor plate. Use a glue-gun and secure the board to the adaptor plate by depositing glue laterally to the slot of the encoder board.
- Drill a 5mm diameter hole on the servo casing, 10mm directly above the original cable exit hole.
- Use heat-shrink if so desired, to cover the cables and pass them through the 5mm diameter hole.
- Insert the styrene adaptor plate and the encoder board into the servo according to the diagram. Insert the locating screw and secure the assembly by placing a drop of heat-glue directly opposite to the locking screw.
- After the board is secured inside the servo pull the excess cable out of the servo and once its length is appropriate (allow a small extra cable length inside the servo) use your heat-gun and secure the cable on the servo’s casing at the point it exits through the 5mm hole. Assemble the servo and enjoy servo position feedback with 0.35° resolution
The magnetic encoder in action:
For a PDF version of this tutorial visit:
For Austrian Microsystems’ AS5040 datasheet visit: