FoTW: LED Strips Make Awful Servo Drivers

We must all have at some time or another spotted a hack that seems like an incredible idea and which just has to be tried, but turns out to have been stretching the bounds of what is possible just a little too far. A chunk of our time has disappeared without trace, and we sheepishly end up buying the proper part for the job in hand.

[Orionrobots] had a conversation with a YouTube follower about LED strips. An LED strip contains a length of ready-made PWM drivers, they mused. Wouldn’t it be great then, if each of the drivers on a strip could be connected to a servo, making the strip a ready-made single-stop SPI servo driver. With a large multi-servo robot to build, he set to work on a strip of WS2801s.

If you are in the Soldering Zone and have elite skills at the iron, then soldering a wire to a surface mount driver chip is something entirely possible. For mere mortals though it’s a bit of a challenge, and he notes just how much extra time it’s added to the project. The fun starts though when the servo is hooked up, the best that can be said is that it vibrates a bit. On paper, the LED drivers should be able to drive a servo, because they can create the correct waveform. But in practice the servo is designed to accept a logic level input while the driver is designed to sit in series with an LED and control its current. In practice therefore the voltages required for a logic transition can’t quite be achieved.

He concludes by recommending that viewers splash out on a servo driver board rather than trying an LED strip. We applaud him for the effort, after all it’s a hack any of us might have thought of trying for ourselves.

15 thoughts on “FoTW: LED Strips Make Awful Servo Drivers

  1. I assume the pwm signal feeds to a transistor which connects the LED to a constant current source (all inside the chip) since that’s what I did when i designed an led driver recently. It should be possible to convert that to a constant voltage with a resistor but it would be inefficient.

    1. When you are driving something on-off, there is no substantial difference between voltage-limited constant current source Ic(Umax) and current-limited constant voltage source Uv(Imax), if the nominal voltage Uv of the voltage source is the same as voltage limit Umax of the current source and current limit Imax of the voltage source is same as nominal current Ic of the current source. U/I characteristics of the two are completely different, but they cross each other at exactly the two points of interest for us: 0,0 and Uv=Umax,Ic=Imax (well, actually, if resistance of the load is R > Umax/Ic, then position on current axe of the second point would be Umax/R instead).

      Hence, if you can modify the PWM current source to provide high enough current for the servo, and supply the constant current source with voltage high enough to assure maximum output voltage of the PWM is proper for the servo, then it should work the same as voltage-supplying PWM.

  2. I don’t think the problem is with voltage. The problem is with your pulse widths. I can see that your ‘scope is set at .1 ms/div, and the pulses are around a division wide. That’s .1 ms pulses. RC servos don’t operate on duty cycle, which is really what’s being varied in an LED controller – they work on strict pulse widths. .5 ms = one extreme, 1.0 ms is centered, and 1.5 ms is the other extreme. There’s also a minimum dead time required between pulses. This probably varies between manufacturers, but a typical RC receiver only sends a pulse to each servo every 10-50 ms or so.

    1. It helps to know what servos will respond to before you try to drive them with extreme waveforms.

      Officially, pulses for RC servos go high for 1.0ms to 2.0ms with 1.5ms being centered. These are sent about 20-25 pulses a second. This provides the user with an operating range of about center +/- 45 degrees.

      In reality, servos can accept pulses in the range of 0.5ms to 2.5ms, repeating 10 to 50 times a second. Outside the official range pulse width range, proportionality (or linearity) goes out the window, but center +/- 100 degrees may be possible.

      If pulses stop, the servo goes into a low power state and can be pushed around. When pulses resume, the servo will snap back to the desired position with considerable force (and a corresponding current draw).

        1. This! Servo signals are 1-2 ms _once_ per ~20 ms, and it’s the pulse length (rather than the fraction of on-time) that matters.

          PWM works great for servo control, if: a) you set the PWM period to ~20 ms, and b) you have the bit-depth to get sufficient resolution in the 1-2 ms range. An 8-bit PWM gets you roughly 20 steps, while with 16-bit PWM, each step is smaller than the servo’s dead band.

          With these light thingies, you have no control over the PWM period.

          For my money, a small microcontroller with good timer/counter hardware is probably the way to go. $20 for a servo controller is pretty steep, even for 16 channels.

          Has anyone tried driving multiple servos with a shift-register?

          1. Elliot: I can’t think of a way to do this with a shift register, but it shouldn’t be TOO difficult to do it the way RC systems do it: the transmitter sends out a sequence of pulses of varying lengths, each pulse representing one channel. The receiver then just passes each pulse to the appropriate servo. This could be done using two I/O pins on a microcontroller, but then it takes a shift register and some and gates to separate them – one pin is the clock, which just triggers the shift register. The shift register is set up with a NOR gate so that the shift-in pin gets the nor of all of its parallel outputs. The parallel outputs will then sequence, with only one output high at a time. These then feed AND gates to gate the second I/O pin, which has the variable-width pulses.

            Yeah, that’s way too complicated; it’s easier to just use a separate microcontroller for however many output pins it has available.

            But maybe it can be done with a 555 … ?

          2. I guess a small micro could do a few – although generally only have a few dedicated PWM outputs, not sure how many bit bang channels you’d get. I was looking for 18 channels total. And yes – I was kind of bodging to make things happen, I can’t claim to have thought out the waveform with rest points and pulse lengths.

          3. I have used a Johnson counter (CD4017) which looks a lot like a shift register to translate a single serial stream from a Beaglebone PRU to drive 9 servos. Different RC receivers that I have looked at use either a shift register or a Johnson counter to make the translation between a serial stream from the receiver circuit and the parallel outputs to the servos.

            In a real RC system (non PCM anyway), there is a sync period of around 4-5mS sent between frames of channel data that resets the output logic to channel 1. This sync period is what allows you to talk to an 8 channel receiver from a 4 channel transmitter, and still get consistent operation. The sync period is what reloads a logic 1 into the first bit of a shift register or resets the Johnson counter to the first channel.

            BobH

          4. Decoding a single wire multple servo signal is meant to be simple. Tie the signal to the clock input of a three bit counter. Tie the three output bits of the counter to a 1:8 selector and feed it the input signal too. Only thing left is to reset the counter if the input signal is low for say longer than 2ms. One RC, two LSI chips thats all.

      1. orionrobots: Yeah, and if you don’t mind having absolute positioning to a desired angle, you can just remove the electronics and potentiometer, and whatever stops there are in a commercial hobby servo, and be left with a motor and geartrain already suitable for many tasks. But if you want it to act like a real servo, i.e., to be able to set it at a precise angle, you’d have to use some kind of feedback mechanism. Also, using LED drivers would give you only unidirectional motion.

  3. Stick a zener diode in place of the LED at the breakdown voltage of the logic input to the servo and make sure the zener can handle the wattage of what was required of the LED.

    Also assuming a higher than LED voltage (Likeliest to be)…. the wattage goes up if the current stays the same and the voltage increases. This assumes that the PWM isn’t auto filtered by parasitic conditions for the LED to “see” constant current at that pulse width.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.