# 555 PWM Checker/Filter

I need to design "PWM Checker" or filter - that will check that the input signal is at specific frequency (let's say 1 kHz) and specific duty cycle (let's say 33%) and the design has to use 555 chip (or 556) if the signal matches then it will pass it onwards.

The tolerance is +- 5%. I was trying to think of a solution using one 555 to measure the Ton time and another one to measure the Toff time. Each 555 circuit has two RC branches with different charge time that are feeding from the input signal (or input signal inverse for the Toff) - one connected to trigger and calculated to charge to VCC/3 after time-5% and the other branch is calculated to reach 2/3 VCC after time+5%. This is where I got stuck - how to pass the signal if both time constraints are met, or how do I make sense of the result of the two 555s?

By the way this is my solution, it doesn't have to be the only / best solution.

• Hi! For such homework-style question (otherwise, having to use a 555 makes no sense at all), we do have to expect you to explain exactly how far you've gotten with your own attempts, and where you're stuck. So, your own attempt must be clear from the question! Commented Jul 22, 2021 at 10:56
• No matter how you proceed, you will also have to specify with what tolerance you're accepting a frequency as correct – there's not a single oscillator in this universe that oscillates at exactly 1 kHz! There can't be; measuring frequency or time becomes very drastically more complicated with the precision you need, so this is a very important piece of information missing here. Commented Jul 22, 2021 at 10:59
• i have edited both answers into the original post Commented Jul 22, 2021 at 11:25
• Hi Ron, thanks! So then, the solution would be OK if it used the same components that you're currently using, just not the 555? Commented Jul 22, 2021 at 12:35

Not quite an exact duplicate, but this question should give you a lot of hints: Finding frequency of a series of pulses (3 - 60 Hz) without using a microcontroller or frequency-to-voltage converter

For your requirements, you're going to need a total of four timers; two to set the limits on the frequency you'll accept, and two to set the limits on the duty cycle.

You'll also need some logic to combine the results of all of these tests and create your final output signal.

Additional details: The four timers are all triggered by the falling edge of the input signal. As each timer times out, it samples the input signal using a DFF. If all of the DFFs contain the correct value, then the input pulse is within the specifications.

simulate this circuit – Schematic created using CircuitLab

• this is basically similar my solution in the original post, though how would you interpolate this on 555 or 556 ? Commented Jul 22, 2021 at 12:40
• I'm not really following the description of your solution in the question -- how can one 555 circuit have two RC branches? If you mean that each circuit has two 555s in it, then yes, what I'm talking about is very similar. Commented Jul 22, 2021 at 12:57

Stream of thought:

• Duty cycle detection is probably the easiest part here: an RC low-pass filter will give you a voltage proportional to the duty cycle (assuming the signal is sufficiently low-impedance driven, which you can make sure of by using a large resistor in your RC). Cut-off should be fairly low – just high enough that if the duty cycle changes, you can follow that change.
• You can convert a "circa target frequency" PWM signal to a pure sine wave by means of filtering out all its harmonics, leaving you with the fundamental. So, another low-pass filter, cut-off above 105% nominal frequency, and below 200%.
• OK, say we now have a pure sine wave that we want to know to be within 5% of a nominal frequency, ie. whether for $$\f_{actual} = x\cdot f_{nominal}\$$, the deviation is $$\0.95 < x < 1.05\$$. Problem: a 5% bandwidth analog filter needs multiple stages, and hence is a) hard to build, and even worse, b) depends on component tolerances very much
• We could ease that problem by mixing (i.e. multiplying) it with another oscillation (this is what you can use a filtered output of your 555 for!), which we, say, put at a frequency 20% above the nominal frequency. The product will contain a frequency component at the sum of the reference and unknown frequency, and at the difference.
• We can filter out the sum frequency at \begin{align} 1.2\cdot f_{nominal}+f_{actual} &= 1.2f_{nominal} + x\cdot f_{nominal}\\ &=f_{nominal}(1.2+x) \end{align} easily (yet another RC low pass, the result is more than twice as high as our nominal frequency), and stay with the difference frequency \begin{align} 1.2\cdot f_{nominal}-f_{actual} &= 1.2f_{nominal} - x\cdot f_{nominal}\\ &=f_{nominal}(1.2-x), \end{align} because that will end up at a range of 0.15 to 0.25 of the nominal frequency. If we hit the nominal frequency just right, we end up at $$\0.2 f_{nominal}\$$, so now the $$\0.05f_{nominal}\$$ are a 25% bandwidth around its center – that's much, much easier to do with an analog filter.
• So, build an analog band-pass filter that passes $$\0.15 f_{nominal}\$$ to $$\0.25 f_{nominal}\$$. analog devices has a nice tool.
• rectify the output and average it (another RC low-pass)

For this approach, the BOM would be:

• A couple opamps, I think you'll need 4 (which means you can work with one quad-opamp:
• 1 precision rectifier at the output
• 3 for the final band-pass (sounds like a 6th order Chebyshev to me, see the filter tool above)
• one source of reference oscillation (I'd recommend dividing down a quartz oscillator, because the 555 is itself around 3% accurate only, making a 5%-accurate detection questionable; but for a prototype, use the 555)
• 4 appropriately designed RC filters:
• DC average for the duty cycle detection
• harmonic removal to convert PWM to sine
• mixer output filtering
• rectifier output DC averaging
• three AC coupling capacitors
• a mixer (SA612, maybe?)