# Regenerating the Gate of a Gated Pulse Wave

I'm looking for suggestions for alternative solutions to a design problem I have. Basically converting a gated pulse wave back into it's enabling gate. Bottom of the post lists the solutions I've come up with so far.

Background: Immediately following a user input to a black box, the box outputs a pulse wave @ 250Hz, 10% duty cycle for a duration of 70ms (all approximate values). I need to process this pulse wave output to create a gate output. A constant output gate length of anywhere under 70ms would work, but a cost effective solution for a user adjustable gate length (from say 30ms to 500ms+) is preferred. I sketched up a crude timing diagram to illustrate.

I'll need to implement the circuit 8 times per unit (8 channels of user input, 8 pulse wave outputs -> 8 channels of gate outputs,) so a priority is keeping things compact and cheap.

So far I've tried: Envelope follower into a Schmitt trigger - cheap and easy for constant gate length.

Non-retriggerable monostable - easy to implement adjustable gate lengths, but \$pendy, I haven't found any in quad or hex packages.

I've considered using a MCU; I'll already be using one elsewhere in the design to convert inputs on 8 channels to serial data (requires 9 pins or 2 + a mux). Add to that 16 more IO pins, or 9 + a mux, or 2 + mux + serial to 8bit converter. - This seems like the most spendy solution in terms of time investment and PCB real-estate.

Does anyone have any suggestions for other solutions I could look into?

Cheers!

• Keywords: "Missing Pulse Detector". You can actually make one using a simple 555 timer circuit. – Tom Carpenter Aug 17 '16 at 14:35
• @TomCarpenter but that would require eigth NE555 with external circuitry – not a cost- or space-saving option, I'm afraid. – Marcus Müller Aug 17 '16 at 14:47

Honestly, in this day and age, I'd go with the MCU – something with 8 more inputs and 8 more outputs can't be that expensive, especially when you then avoid having more separate components and board population doesn't come free. Any sufficiently sized Cortex-M implementation will probably do. In fact, for example, many chips come with PWM units that can be very easily programmed to output adjustable length "on" periods in a one-shot manner.

In the analog term: yes, getting the envelope should work. Assuming the drive strength of your 8 black boxes is reliable, you could do

black box 0 --> low-pass filter (RC) 0 --> Comparator 0
^
black box 1 --> low-pass filter (RC) 1 --> Comparator 1
|^
black box 2 --> low-pass filter (RC) 2 --> Comparator 2
||^
black box 3 --> low-pass filter (RC) 3 --> Comparator 3
|||^
black box 4 --> low-pass filter (RC) 4 --> Comparator 4
||||^
black box 5 --> low-pass filter (RC) 5 --> Comparator 5
|||||^
black box 6 --> low-pass filter (RC) 6 --> Comparator 6
||||||^
black box 7 --> low-pass filter (RC) 7 --> Comparator 7
MCU PWM --> low pass filter (low cutoff) ---+++++++^


You can get 4-channel analog comparators for but a couple of cents. Using two of them, you get your eight channels.

By adjusting the duty cycle of your MCU-generate PWM, you adjust the voltage that the negative input pins of your comparators see.

When an impulse train reaches a low pass filter, that filter will slowly raise its output voltage, and after the last pulse has passed, the filter's output voltage will fall again. If you design your filters to have roughly the bandwidth of 1/(impulse train duration/2), then you can choose any output duration smaller than the length of the output train. If you need longer output than your impulse train lasts, you'll need to build some hysteresis.

Regarding the 8 RC filters you'll need for your black boxes: use a resistor array. They aren't very expensive (again, you might be paying per component placed, and space wasted), nicely matched, and easy to solder. Same goes for capacitor arrays, where the matching actually is harder to get if using individual caps. I'd go for a 10nF network like this one and either eight individual 560 kOhm resistors (cheaper) or this array.

For the PWM low pass filter, simply use whatever resistor and caps you already have on your board and that give you a cutoff frequency sufficiently below your PWM frequency.

I quickly scratch-built a simulator of this whole idea: looks like this:

As you adjust the reference voltage, the duration of the output pulses change;

the underlying GNU Radio Companion/GNU Radio Flowgraph looks like this:

The left half of the flow graph is just generating the test impulses (blue in the visualization, which are then low pass filtered and compared to the reference voltage.

If this kind of job (counting impulses, synchronizing some logic output shape to some logic input shape, reacting to digital signals) really happens a lot on your board, considering CPLDs or even small FPGAs does make sense – and, of course, using the Free & Open Source Icestorm toolchain to program your own FPGA images without any vendor tools has a lot of designer street cred potential :D

• I think I may have cause some confusion about the 8 channels, MCU implementation. The part of the circuit where 8 inputs are converted to a serial data stream is completely separate. Different nodes/inputs from the ones for the pulse trains. Also, the 8 pulse train gate converters do not interact with one another in any way. Apologies if that was already evident. I'm confused however by your text diagram, specifically the meanings of the "||^" – Stephen Thomas Barnwell Aug 17 '16 at 21:21
• the | should denote a vertical line, ^ an arrowhead :D the idea is to feed the same voltage to all the 8 comparators – Marcus Müller Aug 17 '16 at 21:22
• Gotcha, I wasn't sure if they were somehow meant as logic operators. Had me wondering if you thought I was trying to do some kind of 8-bit DAC. Thanks for clarifying. Also I think you're right, just getting a more capable MCU will definitely offer the smallest footprint, and that should offset any added cost. Plus it makes my job way easier ;) – Stephen Thomas Barnwell Aug 18 '16 at 1:34