# Using a pulse-width modulated signal to possibly reverse polarity

I'm trying to help an artist control a simple DC motor using a single signal. The signal is a digital output, 0/5V, and the motor runs with max 36V. The motor needs to run forwards and backwards. There is only 1 digital output available per motor.

I know how to generate a PWM signal, and wire it up to a transistor (with resistor at the base) so that the motor spins slowly or quickly, that much is working. We have a simple circuit for motor speed in one direction.

Also thanks to this site I just learned about H-bridges and found a few good pages on using 4 transistors to switch a motor's polarity.

My thought was to have the output signal be pulse width modulated 0% = full reverse, to 35% = slow reverse, and 65% = slow forward, to 100% = full forward.

To make that control the motor, I think about splitting the signal into two isolated parts. I "smooth" one part and use it as a "direction control" signal, low=reverse, high=forward. The other original PWM signal just modulates the power, for speed control.

I can't get it working in my circuit simulator. First problem is that my "smoother" is a filtered rectifier, and it always produces the same output voltage regardless of the duty cycle, which makes sense, because the diode bridge just converts everything to the same voltage. The second problem I have is how to make the "low" parts of the duty cycle make the motor run "fast" when it is in reverse- pretty sure I can fix that with a NOT gate and another transistor, but it feels like there must be a more elegant way. The fewer parts in this design, the better.

(Main problem is that I'm in over my head. Haven't built any circuits in 20+ years.)

The question is- how would you make this work, using a 36V power supply and some components to convert a 0-100% 5V PWM signal into a -36V to +36V PWM power source?

FYI, We do have the option of just buying a second microcontroller, which would give us more output pins, which would let us use one pin for a "forward" signal, and another for "reverse." It's just frustrating me that I can't make the single-signal idea work.