Scaling pwm pulse width ranges input output

Thread Starter

ilbs

Joined Jun 26, 2017
2
Hello all,

I have a 50Hz PWM signal with a pulse width that ranges from 1100-1900 us (1.1-1.9 ms). I would like to build a circuit that can take this signal as an input, and linearly map that range to an 50Hz output signal with a range of 1500-1900 us (1.5-1.9 ms). Additionally I would like to build another circuit that can take the same input and map to an output range of 1500-1100 us (1.5-1.1 ms) intentionally reversed.

For example: for an input width of 1800 us I would like one circuit to output 1850 us and the other 1150 us.
Another example: input 1300, one circuit outputs 1600, the other 1400.
1100 would result in outputs of 1500 in both circuits

I am aware that I could probably do this with a microprocessor, but I would like that to be my back up plan due to latency and weight.

Additionally, I will have 4 of these signals, each needs to be scaled, so if one circuit could take 4 inputs and have 4 outputs that would be ideal but not necessary as I could just build 4 of them.

Lastly, the exact range values are subject to minor change +- 50us so I would like instructions on how to pick component values for an arbitrary range

I am aware that the solution will likely involve 555s and op amps but I am not well versed enough to identify the exact configuration or values of resistors/capacitors.

Any advice would be helpful, thanks a lot!
 

OBW0549

Joined Mar 2, 2015
3,394
I am aware that I could probably do this with a microprocessor, but I would like that to be my back up plan due to latency and weight.
Actually, a μC-based design would probably give you the least latency. It could also turn out to be the smallest, lightest and least expensive approach.

A PIC16F1847 would be a good candidate for the job: it's got four capture/compare (CCP/ECCP) modules and could handle two of your incoming pulse streams and generate two outputs; so two of these chips (18-pin DIP, $1.75 ea. at Digi-Key) would do the job. Not much would be required besides the PICs, other than a 5.0V or 3.3V voltage regulator (assuming you don't already have those voltages available), and whatever input/output circuitry is needed to interface to the chips. For each channel, software would use an input capture to measure the incoming pulse width, do appropriate math to accomplish your mapping, and then use an output compare module to generate an output pulse of the calculated width. Each input pulse produces an output pulse, with a gap between the two while the processing is taking place-- perhaps a few hundred microseconds.

I can think of two analog approaches to accomplishing the same thing. Both involve significantly more hardware than the PIC approach.

One version is fairly simple, but has quite a bit of latency: run the incoming pulse through a low-pass filter to develop a steady DC voltage proportional to the average pulse width, then process that voltage in an op amp circuit to scale and shift it appropriately, then apply the resulting voltage to the Control pin of a 555 timer operated as a monostable triggered by the falling edge of the input pulse. This would work but would have a long response time due to the filter, perhaps as long as a second.

The other version is more complex, but would yield minimal latency. Here, the low-pass filter of the other analog version is replaced by a circuit which instantaneously measures the duration of each input pulse. This would be implemented as a gated integrator which develops an output voltage proportional to the pulse width, then holds that voltage while the output pulse is generated by the 555. The voltage scaling and shifting, and the output pulse generation, would be done the same as before. The falling edge of the output pulse would be used to reset the gated integrator back to zero in preparation for the next input pulse.

If minimizing latency is a major design goal, the first analog version will probably not be acceptable. Given a choice between the second analog version and a PIC implementation, I would probably choose the PIC because of its hardware simplicity and the convenience of being able to arbitrarily determine the pulse width input-output mapping in software.

That's my take. Perhaps others will have better ideas.
 

Thread Starter

ilbs

Joined Jun 26, 2017
2
I would probably choose the PIC .
I looked into the chip you suggested, this is excellent advice, thank you! Just to clarify it would be relatively intuitive to have an input on one of the pins toggle the mapping algorithm on the chip right?
 

OBW0549

Joined Mar 2, 2015
3,394
I looked into the chip you suggested, this is excellent advice, thank you! Just to clarify it would be relatively intuitive to have an input on one of the pins toggle the mapping algorithm on the chip right?
You'll have to read up on how the input capture and output compare work for the details but yes, in general you'd run everything off an interrupt from the input capture.
 
Top