# ac signal detection and output high or low

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.

• What is the smallest amplitude you want to have considered as a "signal present"? And what frequency? Apr 17 '17 at 4:32
• 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 Apr 17 '17 at 5:02
• Because if you need to detect 1 uV signals it's more difficult than if you're trying to detect 5 V signals. Apr 17 '17 at 5:05
• 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). Apr 17 '17 at 5:07
• 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. Apr 17 '17 at 15:04