0
\$\begingroup\$

how to make circuit to output high(1) or low(0) for microcontroller depending upon whether there is ac signal or not. the ac signal amplitude is between 0 to 5V. it is not AC main line signal.

\$\endgroup\$
5
  • 2
    \$\begingroup\$ What is the smallest amplitude you want to have considered as a "signal present"? And what frequency? \$\endgroup\$
    – The Photon
    Apr 17 '17 at 4:32
  • \$\begingroup\$ frequency is around 15hz. why do you need smallest amplitude? it is ac signal with one peak at around 4.5V and 0.1V in negative cycle \$\endgroup\$
    – ravikumar
    Apr 17 '17 at 5:02
  • 1
    \$\begingroup\$ Because if you need to detect 1 uV signals it's more difficult than if you're trying to detect 5 V signals. \$\endgroup\$
    – The Photon
    Apr 17 '17 at 5:05
  • \$\begingroup\$ For your case (Vmax = 4.5 V and Vmin = 0.1 V at 15 Hz), you can do the whole thing in software and you likely don't even need any external circuit (maybe an external digital buffer to avoid lingering signals between valid logic levels being applied to the uC input). \$\endgroup\$
    – The Photon
    Apr 17 '17 at 5:07
  • \$\begingroup\$ A simple envelope detector circuit(diode (e.g. 1N4148), resistor and capacitor) should work in this case. For 15Hz try R = 100k, C= 4.7uF (time constant about 0.47 seconds) - output about 4.3V on, 0V off. Reduce time constant for a more rapid turn off delay. \$\endgroup\$ Apr 17 '17 at 15:04
3
\$\begingroup\$

In comments you specified

frequency is around 15hz. ... it is ac signal with one peak at around 4.5V and 0.1V in negative cycle

For this scenario, there's no external circuit needed except maybe a digital buffer (with a few mV hysteresis, maybe). If your micro runs on 3.3 V, use a buffer with 5 V tolerant inputs.

Detect the signal presence using a timer in the micro. Each time the input transitions low-high, reset the timer and consider that "signal present". If the timer ever reaches slightly longer than the maximum signal period, consider that "signal absent".

\$\endgroup\$
5
  • \$\begingroup\$ the signal path has a switch, when the switch is open there is 4.5V DC signal and then when the switch is closed there is ac signal as mentioned above. i want to detect the ac signal presence. would the 4.5V dc signal have affect on the solution you said? \$\endgroup\$
    – ravikumar
    Apr 17 '17 at 5:50
  • \$\begingroup\$ No, not really. You might rather use 1-0 transitions instead of 0-1 transitions to reset the timer, to avoid the switch being moved from "on" to "off" causing a timer reset and delaying the detection of the off condition for a few tens of milliseconds. \$\endgroup\$
    – The Photon
    Apr 17 '17 at 5:53
  • \$\begingroup\$ i cannot find timer used to detect ac signal. any tutorial link would be helpful. using arduino as micro. \$\endgroup\$
    – ravikumar
    Apr 17 '17 at 11:36
  • \$\begingroup\$ @ravikumar, I've given the outline of how to do it in my answer. You need to research how to implement that in your choice of micro. You also need to think about the details of the problem that you haven't shared and how they affect the design. What is the possible variation of the signal period that you want to allow and still consider it present? Is it more important to react quickly when the signal first comes present or when it switches from present to absent? What's the best way for the signal detect feature to indicate to the rest of the program what the state is or when it changes? \$\endgroup\$
    – The Photon
    Apr 17 '17 at 15:47
  • \$\begingroup\$ You should hire someone who knows what they're doing and be prepared to explain in more detail what the actual problem is in response to their questions. \$\endgroup\$
    – The Photon
    May 6 '17 at 3:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.