Full PWM to servo

Hello, the topić may seems confusing because servos use PWM but my case is different. I have an 8 channel rgbw dmx Control board for led strips and want to Control 2 servos from the W outputs. I can build something to turn the negative switching signals to a 5 v PWM signals but i cannot find anything for converting the 0-100% duty cycle to a servo signals. It should be cheap and note to big, allegro or aliexpress links would be nice.

For starters what type of servo motor and post a link to the technical details.

The servo is a typical chinese 90g one

Pretty sure it's a tower pro sg90, but why does it matter?

Please read this: Types of Servo Motors and Their Working Principles | Linquip you will discover that there is more then one type of servo motor. There is no standard servo signal for all of them. So you can now answer your question why does it matter.

It's a positional rotational one

There are at least two contexts for "PWM". For brightness control of LEDs the important parameter is "duty cycle", that is, how long each pulse is relative to the period (pulse high + pulse low times). For servos the important parameter is simply how long the pulse is high, which typically is between 1 and 2 milliseconds, but may be different for some servos.

So your problem is to measure the duty cycle of the "W output". This can be done with the "pulseIn()" function by sequentially measuring the pulse width for the high state and then the low state and calculating the duty cycle as (width_high / (width_high + width_low)). In addition there needs to be some handling of the full on and the full off states.

Once you have the duty cycle, then map that to the servo pulse width. Using the Arduino Servo library full off (0% duty cycle) would map to 0 and full on (100% duty cycle) maps to 255 as the parameter to servo.write(parameter).

Servo signals are NOT normal PWM but PPM (Pulse Position Modulation)
the interval is 20000 microseconds and the pulse width varies from 544 (zero degrees) to 2400 µs (180 degrees), so the duty cycle would be 544 / 20000 (2.7%) to 2400 / 20000 (12%). and there are 8 2500µs channels distributed through the 20000µs interval.

In fact you are describing another form of PWM (Pulse Width Modulation) where the transmitted pulses themselves vary in length.

With (PPM) Pulse Position Modulation the pulses themselves have a fixed lenght and it is solely their position in time that specifies the servo position of the channel.

As visualized in this picture

The position of one pulse specifies the start and the end of a channel (except for the first and last pulse in a frame. Then there is a silent window, or you would never know what puls belongs to the start of channel-1

The inputs is PWM and outputs needs to be ppm.

The thing is that i don't know the frequency on the outputs of the DMX LED controller board. And i don't have an oscilloscope, but i do have a raspberry pi pico and Arduino Uno but the Uno is my temporary dmx controller

Yeah i found that but an Arduino ain't cheap. I feel like three is a solutions for 2-5bucks not 20

Did you look for Arduino Nano?

What part of the world do you live?

Thanks.. Tom.. :grinning: :+1: :coffee: :australia:

Now i checked it's about 4-5 bucks. I live in Poland. I just think that a specialized chip/module is better than a programmable chip because it's just more robust than the microcontroller based solutions.

TNX for that. Do you have a similar chart for RC servos?

Servomotor_Timing_Diagram.svg

Source Wikipedia (they host the bigger image)

1 Like

TNX again, here it is for geriatric vision. :slightly_smiling_face:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.