# AC Voltage Detection circuit

**URL:** <https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493>\
**Category:** General Electronics\
**Created:** [November 28, 2026, 8:47am UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493 "2026-11-28T08:47:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![azchrisf](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@azchrisf](https://forum.arduino.cc/u/azchrisf)\
**Post date:** [November 28, 2026, 8:47am UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/1 "2026-11-28T08:47:07Z")

</div>

Hi guys,

I was looking for a way to detect AC mains voltage (120V here in the US) when a fan in an enclosure turned on. I'm not measuring the voltage, just detecting it's presence.

Edwin Robotics had a breakout board I used for a little while since it was convenient, but now I am looking to bring to parts onto my own PCB. I know there is a necessary separation distance and board cuts that need to be done from DC.

> **[230v/110v AC Mains Detection Module Hookup Guide | Learn with Edwin Robotics](https://learn.edwinrobotics.com/230v110v-ac-mains-detection-using-arduino-raspberry-pi-and-esp8266-thing/)**

My question is, how would you rate this for safety, and what would you add or change?

 ![](https://europe1.discourse-cdn.com/arduino/original/4X/0/c/8/0c8f0f49252cdcfb40722b48d122201b9390ca6b.png)

Thanks

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [November 28, 2026, 8:59am UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/2 "2026-11-28T08:59:11Z")

</div>

You have opto-coupler as isolation. If you want more robust isolation, you may use a tiny 120V/5V PCB mountable transformer (Fig-1).

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/1/e/3/1e397941e8fef7d757b71757489ee611fd2c9f09.png)  
Figure-1:

**Zero Crossing Detection Circuit:** (tested for 240V/5V)

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/4/4/d/44dca17209372e182af2ceba073829b0f7f24273.png)  
Figure-2:

---

<div class="post-metadata">

**Author:** ![6v6gt](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/6v6gt/32/225488_2.png) [@6v6gt](https://forum.arduino.cc/u/6v6gt)\
**Post date:** [November 28, 2026, 9:04am UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/3 "2026-11-28T09:04:04Z")

</div>

Your circuit could use an AC optocoupler (say LTV 814) which has two leds reversed with respect to each other.

You could also look here: [Mains voltage detector (neon bulb based for 230v door bell repeater)](https://forum.arduino.cc/t/mains-voltage-detector-neon-bulb-based-for-230v-door-bell-repeater/1420033)

---

<div class="post-metadata">

**Author:** ![PerryBebbington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/perrybebbington/32/238766_2.png) [@PerryBebbington](https://forum.arduino.cc/u/PerryBebbington)\
**Post date:** [November 28, 2026, 9:35am UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/4 "2026-11-28T09:35:50Z")

</div>

I once did this by wrapping insulated (guaranteeing safe separation) wire around the live then connecting that wire to an input on a 40106 hex Schmitt trigger, with a 10M Ohm pull up / down (can't remember) and the whole circuit connected to earth (note 'earth', not 'ground'). Added some RC smoothing and a couple more of the spare Schmitt triggers and got a reliable output showing mains present or not. No connection to mains anywhere.

---

<div class="post-metadata">

**Author:** ![fatboy88](https://avatars.discourse-cdn.com/v4/letter/f/a8b319/32.png) [@fatboy88](https://forum.arduino.cc/u/fatboy88)\
**Post date:** [November 28, 2026, 10:13am UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/5 "2026-11-28T10:13:51Z")

</div>

That board was designed for 230V and most likely will not work on 120V.  
What optocoupler do you plan on using?

---

<div class="post-metadata">

**Author:** ![herbschwarz](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/herbschwarz/32/239314_2.png) [@herbschwarz](https://forum.arduino.cc/u/herbschwarz)\
**Post date:** [November 28, 2026, 3:42pm UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/6 "2026-11-28T15:42:37Z")

</div>

A simple SPDT relay with a 120VAC coil would work. There will be contacts closed for AC on and also for AC off.

---

<div class="post-metadata">

**Author:** ![Claudio\_FF](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/claudio_ff/32/239118_2.png) [@Claudio\_FF](https://forum.arduino.cc/u/Claudio_FF)\
**Post date:** [November 28, 2026, 4:52pm UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/7 "2026-11-28T16:52:02Z")

</div>

> [@azchrisf](#):
>
> what would you add or change?

Two high-power resistors BEFORE the bridge rectifier, to share the voltage and keep the temperature down.

 ![56418674864](https://europe1.discourse-cdn.com/arduino/original/4X/9/0/6/9069b9badd9f3beccdc10e0e4589a1929f9783c0.png)

---

<div class="post-metadata">

**Author:** ![LarryD](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/larryd/32/215550_2.png) [@LarryD](https://forum.arduino.cc/u/LarryD)\
**Post date:** [November 28, 2026, 6:18pm UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/8 "2026-11-28T18:18:55Z")

</div>

- If you have an old 5 VDC power supply, use it to monitor the presence of AC.

---

<div class="post-metadata">

**Author:** ![kmin](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kmin/32/1147370_2.png) [@kmin](https://forum.arduino.cc/u/kmin)\
**Post date:** [November 28, 2026, 7:42pm UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/9 "2026-11-28T19:42:57Z")

</div>

> [@PerryBebbington](#):
>
> No connection to mains anywhere.

Many multimeters /testers can detect mains live NCV without earth connection, without user holding the device. I wouldn't mind to learn how they do it.

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [November 28, 2026, 7:52pm UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/10 "2026-11-28T19:52:23Z")

</div>

![Mains detector](https://europe1.discourse-cdn.com/arduino/original/4X/7/5/3/753c9c6aadb4641faeb7147db6f17bdd2606b5ab.png)  
Any AC opto coupler.  
Pin with internal pull up (no 10k resistor).  
Zero crossing removal can be done in software (no capacitor).  
Two resistors for safety.

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [November 28, 2026, 7:53pm UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/11 "2026-11-28T19:53:49Z")

</div>

> [@LarryD](#):
>
> if you have an old 5 VDC power supply...

If you don't mind very slow detection (until the supply bleeds out).

---

<div class="post-metadata">

**Author:** ![azchrisf](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@azchrisf](https://forum.arduino.cc/u/azchrisf)\
**Post date:** [November 28, 2026, 10:19pm UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/12 "2026-11-28T22:19:40Z")

</div>

I think everyone here has put forth some good ideas, and can work in different scenarios.

@WaWa That's an even simpler solution eliminating the rectifier. This will work perfectly for future projects. The K814P is obsolete now (what isn't?), but Lite-On and others still make the LTV814 (as mentioned by @6v6gt), especially in DIP, which is a drop in replacement. I'll probably throw a picofuse on the L leg - 250V@250mA for added safety.

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [November 28, 2026, 11:30pm UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/13 "2026-11-28T23:30:26Z")

</div>

> [@azchrisf](#):
>
> I'll probably throw a picofuse...

Not needed. No significant current can flow because of the two resistors.

In some countries phase and neutral can be swapped (no keyed power plugs).  
There every wire of a power cord should be treated as live, hence one resistor in each leg.

I usually build these things inline with a power cord, with heatshrink.  
The pc814 could work, as do many others.

---

<div class="post-metadata">

**Author:** ![PerryBebbington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/perrybebbington/32/238766_2.png) [@PerryBebbington](https://forum.arduino.cc/u/PerryBebbington)\
**Post date:** [November 29, 2026, 7:24am UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/14 "2026-11-29T07:24:12Z")

</div>

> [@Wawa](#):
>
> In some countries phase and neutral can be swapped (no keyed power plugs).  
> There every wire of a power cord should be treated as live, hence one resistor in each leg.

Even with keyed plugs neutral should be treated as live. Faults happen. Wiring mistakes happen. You can't safely assume the neutral wire will always be neutral.

---

<div class="post-metadata">

**Author:** ![tigger](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/tigger/32/1104210_2.png) [@tigger](https://forum.arduino.cc/u/tigger)\
**Post date:** [November 29, 2026, 10:17am UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/15 "2026-11-29T10:17:59Z")

</div>

Broadcom HCPL-3700 is a chip designed to give a logic level output in response to mains voltage on its input side. It's basically an optocoupler.

Works fine on 240-V AC, but does need thermal management on the input resistors.

The specific application was for a no-neutral lights programmer that worked fine with halogen lamps but didn't like LED lamps. Can't remember the exact circuit, now replaced by a WiFi switch, but useful for the duration.

---

<div class="post-metadata">

**Author:** ![tigger](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/tigger/32/1104210_2.png) [@tigger](https://forum.arduino.cc/u/tigger)\
**Post date:** [November 29, 2026, 10:20am UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/16 "2026-11-29T10:20:52Z")

</div>

Yes, seen it.

Plug wired correctly, neutral and live swapped in the socket. No RCD.

---

<div class="post-metadata">

**Author:** ![azchrisf](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@azchrisf](https://forum.arduino.cc/u/azchrisf)\
**Post date:** [November 29, 2026, 11:14am UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/17 "2026-11-29T11:14:49Z")

</div>

@tigger,  
Good chip and solution, but not economical at over $12 each at Digikey, even for my projects. I'll keep an eye on it though. If it was cheaper I'd take it as the solution for sure.

---

<div class="post-metadata">

**Author:** ![fatboy88](https://avatars.discourse-cdn.com/v4/letter/f/a8b319/32.png) [@fatboy88](https://forum.arduino.cc/u/fatboy88)\
**Post date:** [November 29, 2026, 11:45am UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/18 "2026-11-29T11:45:04Z")

</div>

> [@azchrisf](#):
>
> I was looking for a way to detect AC mains voltage (120V here in the US)

Are you now working with 240V?

---

<div class="post-metadata">

**Author:** ![tigger](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/tigger/32/1104210_2.png) [@tigger](https://forum.arduino.cc/u/tigger)\
**Post date:** [November 29, 2026, 2:04pm UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/20 "2026-11-29T14:04:36Z")

</div>

Maybe have a look at how those "voltage sticks" work.

Battery powered, no contact, bleeps when AC mains voltage detected.  
Downside is susceptible to false positives.

---

<div class="post-metadata">

**Author:** ![tigger](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/tigger/32/1104210_2.png) [@tigger](https://forum.arduino.cc/u/tigger)\
**Post date:** [November 29, 2026, 2:19pm UTC](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493/21 "2026-11-29T14:19:58Z")

</div>

Not surprised, main distributor. UK Digikey has them at £3.14.  
Even RS, and they aren't cheap, have them at less than £3 and genuine.

AliExpress has them as low as £1 (£9.90 for 10 pieces).

I'd go with the optocouplers as suggested before. Worth doing a bit more research

[Next page](https://forum.arduino.cc/t/ac-voltage-detection-circuit/1469493.md?page=2)
