I want to detect a specific PWM signal by electronic circuit components i.e. transistors, opamps, capacitors. update: I want to build simple ID system. I want to detect specific PWM signal for example 65% with 5% resolution at 1kHz. If 65% PWM signal comes as an input I want to make output circuit on. Other than 65% with 5% accuracy, I want to make output circuit off(low).
-
1\$\begingroup\$ What are the specific parameters about the PWM signal that you want to detect? For what purpose do you want to do that? What are you building? What are you ultimately trying to accomplish? \$\endgroup\$– Nick AlexeevCommented Dec 17, 2015 at 21:55
-
\$\begingroup\$ We know the input is a PWM signal. Still need to know (1.) What is being measured -- frequency, duty cycle, or amplitude? And (2.) What is the output of the circuit -- a voltage, a binary number, an on/off toggling LED? \$\endgroup\$– Keegan JayCommented Dec 17, 2015 at 22:09
-
\$\begingroup\$ I updated, sorry for not enough information \$\endgroup\$– er dedeCommented Dec 17, 2015 at 22:18
-
1\$\begingroup\$ It's good enough for someone to answer now. Sounds like an RC filter on the PWM voltage followed by a comparator/schmitt trigger to set the on/off threshold. \$\endgroup\$– Keegan JayCommented Dec 17, 2015 at 22:31
-
\$\begingroup\$ You could charge a cap during the pulse and feed the value into a window comparator and latch the result, but it might be better to use two triggered pulse generators (one at the short limit and one at the long) and some logic looking at the results then feeding a latch. Or you could digitally count periods of a faster clock and use a numeric window comparator. More realistically, for a real application you will have trouble doing better than the tiniest SOT-23 MCU, unless you already have an FPGA or a still-under-design ASIC in the system to which you can add this functionality. \$\endgroup\$– Chris StrattonCommented Dec 17, 2015 at 23:20
2 Answers
You need a low pass filter follwed by a window comparator.
Here is a low pass filter:
This will greatly attenuate the 1 kHz pulse frequency leaving mostly its average value. The rolloff frequency of a single 10 kΩ 1 µF low pass filter is 16 Hz. The PWM frequency is about 63 times higher, so will be attenuated by about 63. Two of these in series will attenuate by the square of that, or by about a factor of 4000. For 5 V PWM in, the ripple should be less than 2 mV out.
To get a signal that indicates this smoothed output is between 60% and 70% of the supply, use two comparators to compare it to 60% and 70% of the supply. A resistor divider chain can make these reference signals:
Feed OUT and 70% into one comparator, and OUT and 60% into the other. A little hysteresis on each comparator is in order. You want it to be more than the remaining ripple on OUT at a minimum. Maybe 10 mV would be good.
Now you only need the appropriate logic gate to take the two comparator signals and make a single signal that indicates OUT is between the two thresholds. What kind of gate depends on what polarity you connected the inputs of the compartors with. For example, if OUT goes into the + input of both comparators, then you want a XOR gate. The output will be high when the outputs of the two comparators differ, which only happens when OUT is in between the 60% and 70% reference levels.
I would use a RC low pass filter to get the linear voltage from the pwm, followed by a window comparator (2 comparators set at 65+5% and 65-5% and logic AND gate after them), followed by an on -delay timer to prevent quick sweeping pwm input from opening the circuit. The longer the delay of the timer, and tighter the tolerance for the pwm, the safer is the lock. Lot of opportunities for optimization of this circuit exist. For example using comparators with open collector output the two outputs can be connected to a single pull-up resistor and create the "AND" functionality. The the before mentioned pull-up resistor could be fairly large and be also used for charging a large capacitor creating the on-delay timer. small protective resistor that will discharge the same capacitor should be added to prevent burning output transistor of the comparators. Schmitt trigger with rail to rail output, powered by the same reference voltage used for comparator's reference points would increase accuracy of the system.