60 Hz AC Presence Detector - Arduino Digital Input
getpausebox
·
Created Aug 8, 2026
·
Updated Aug 8, 2026
Details
Components
6
Schematic
Yes
Simulation
Transient analysis
Copies
Not copied yet
About this circuit
Switched 60 Hz source, half-wave rectified, divided by 22k/10k, filtered by 1uF and clamped to +5 V, feeding a digital input stage. Recreation of a hand-drawn mains-sense sketch.
Circuit notes
60 Hz AC Presence Detector (Arduino Digital Input)
What this circuit does
A 60 Hz AC source is switched, half-wave rectified, divided down, filtered, and clamped so an Arduino digital input can tell whether AC is present.
- SW1 stands in for the mains connection.
State = 1is closed (AC present),State = 0is open. Open the switch and the sense node collapses to 0 V, which is the state the original sketch was drawn in. - D1 half-wave rectifies, so only positive half cycles reach the divider.
- R1 / R2 divide by 10k / (22k + 10k) = 0.3125.
- C1 holds charge between half cycles. Discharge is through R2 alone (t = 10k x 1uF = 10 ms) against a 16.7 ms period, so the node still swings — the Arduino sees a 60 Hz pulse train, not a steady DC level.
- D2 clamps the sense node to +5 V + one diode drop. In normal operation it never conducts; it is there to protect the input against surges.
- U1 is the Arduino input stage. VTH = 2.5 V matches a 5 V logic input.
What to look at
Sense node(analog) is the conditioned voltage at the Arduino pin.Arduino input(digital) is what the pin actually reads.
The one assumption I had to make
The original sketch only labelled the source "60Hz" with no amplitude. V1 is set to 24 V peak (about a 17 Vrms transformer secondary). At that level the sense node swings 1.5 V to 4.0 V, which straddles the 2.5 V threshold cleanly and leaves D2 idle as pure protection.
This is not a direct-mains circuit as drawn. At 170 V peak (120 Vrms) the sense node never falls below 2.4 V, so the input stops toggling, and R1 has to dissipate over a watt. If a direct mains connection was the intent, R1 needs to be roughly 1 M and the divider re-proportioned.
Components used
Components used
6 components
Try this circuit yourself
Free to get started. No download — runs in your browser with a full SPICE engine.