Skip to content
Lieven Hollevoet edited this page Sep 22, 2014 · 1 revision

See mh/lib/Servo_Item.pm and code/common/robot_esra.pl for some servo examples.

Some other thoughts on servo control.

An article in a website http://diy-zoning.sourceforge.net/docs/teasers/damper.html on control of dampers for HVAC illustrated the use of cheap servos. The site provides links to several servo control vendors but one thing that struck me was that it might be undesirable to have the servos permanently powered so additional power control might be required.

RC servos need a pulse between 1ms and 2ms, repeated a few times, with the position being proportional to the pulse length. No pulse freezes the position. Continuous pulses tend to make the servo hunt slightly about its position and wear itself out.

Also these controllers need another serial port. This sparked off a train of thought on how the port might directly control the servos in a crude way, all that is required for HVAC application. A serial port is normally ‘at rest’ at logic1, then a character output starts with a logic 0, followed by 8 data bits and a stop bit at logic 1. Lets forget about parity for a moment. Therefore sending ‘hex FF’ produces a one bit period negative going pulse, ie just the start bit. Then ‘hexFE’ will produce a 2 bit pulse, etc (FC,F8, F0, E0, C0, 80) up to ‘hex 00’ which will be 9 long. Parity is best disabled.

By suitable inverting and level shifting this gives a pulse from 0.1 to 0.9 ms if a baud rate of 9600 is used. This can be fed to a retriggerable monostable of 1ms length to extend the pulse to cover the required range.

OK it’s only 8 positions and they might be non linear but for an outlay of half a Euro that’s not bad and would do for quite a few applications.

Several servos could be hung off one port in parallel with their power switched via eg a WeederBoards to select them individually or in groups.

Pulses are normally sent with a 10 or 20 ms gap between so it would not be suitable to send a complete string. Also it would be necessary to make sure it didn’t send CR and LF.

Extra resolution With a bit of fiddling extra resolution can be had in the shorter pulses by using 19500 baud but the max length is of course shorter, but I guess the handshake lines could be used to put the monostable into extended length mode to cover the other half of the range.

Clone this wiki locally