How to monitor 8 240v mains lines

I would like to use an Arduino to monitor 8 240v mains lines, ideally a prebuilt shield!

I need to know if the are live or not, it would be a bonus to know the actual voltage but it's not essential!

Any shields for the Nano or uno?

Usually we would suggest using an old phone charger to bring the voltage to a safe level to feed the Arduino input. This also isolates the high voltage.

Can you give more description on your project?


Here is a safe way to monitor line voltage, and if you add a current transformer, you can also monitor power consumption.

An Arduino Uno does not have enough analog inputs to monitor 8 lines.

thanks for the replies Weedpharma & jremington.

here is a high level of what i'm trying to do:
as an electrical engineer some of the single phase 204V 50Hz machines I work on use a combination of relays, timers and external sensors to implement crude logic. e.g. after relay 1 fires sensor 1 has 15 seconds to detect the presence of an item else relay 2 will fire and sound an alarm... yes these are old machines!

if the timing is off or the are fired in the wrong order I have no way of knowing what the sequence of events was.

so my idea was to use an Arduino with an RTC to monitor up to 8 input lines, logging when each line went high (240V) and for how long, then i should be able to deduce what the sequence was that lead to the failure.

space becomes an issue too I would not have room for 8 phone chargers inside the panel and leaving it outside would not be allowed!

so i was thinking of a voltage divider into a bridge rectifier, but no isolation so is a bit risky! so would need to add an optoisolator or an isolating transformer.

or using something like a MID400, never used one before and i would need 8 of them.

views, other ideas?

If all you really need is a yes/no for the presence of mains then you can use optoisolators (with appropriate rectifier and voltage divider on the hot side) to drive digital inputs on the arduino. You dont get the mains voltage though.

If you choose arduino you may need some kind of real-time clock for accurate logging of timestamps.

If you go this digital route I would consider using a Raspberry Pi or Beagleboard instead of Arduino as these bring on-board storage, a real time clock and easy network access for not many more dollars.

There is an opto-coupler with bipolar input. I don't have the part number at the moment but can get it Friday. You will still need a divider/current limiter on the input and a simple filter on the output.

voltage would be good to have, as it would show me if there had been a drop in line voltage for any reason, but i can live without if it ups the complexity /cost!

anyone point me at a circuit diagram for this type of thing? i can only find low voltage stuff 24, 50v. I want to make sure i get the 240V RMS side correct...

if i use the MID400 i think i need a 47K 1.2w (min) resistor but that's a lot of watts / heat so have I got it wrong?

I will look at at pi too but have never code using one so may be fun!

if i use the MID400 i think i need a 47K 1.2w (min) resistor but that's a lot of watts / heat so have I got it wrong?

The MID400 with a 47K external resistor would be a good choice and 1.2 watts in not a big problem if there is some air circulation.

You should use a 2 or 5 watt resistor and leave long leads if possible for air cooling.

You can also use a modified capacitive divider using this calculator.

Where Z1 = 1 + j24000, a capacitor
Z2 = 320 + j0, a resistor
V1 = 240V

And, Z1 is a 0u11 capacitor capable of AC current, 10mA
Z2 is a 320R resistor
ZL is the opto with a 320R equivalent

When you add the opto input, 1V6 @ 5mA, in parallel with Z2 you will also have 5mA through Z2. The reason for having a divider before attaching the opto is this situation.

If one of the opto LEDs fails then the half cycle where the other is not conducting will see a PIV value far exceeding the opto rating. The second LED will fail and if there is enough destruction within the device, you could end up with 340VAC peak on the Arduino side relative to building ground.

A resistive divider should also have a 320R in parallel with the opto input. The resistor on the high side can be one of the DalOhm aluminum cased and bolted to the enclosure side for heat dissipation.

JRemington's suggestion is far simpler so treat mine as just an idea.

The opto-coupler is an LTV-814.

Thank you for the replies and help.

I have decided to order some MID400's to try, it think with the lower mA I have less watts and thus heat. However I like the lower cost and size of the LTV-814! So may also get some to try

Look at the DalOhm flange mounted resistors as they can be bolted to the side of a cabinet for heat dissipation. You can still use the calculator link I provided for resistors by making all the J values zero.

Good luck.

If it was my task, I think I would be much happier with a step down transformer for each one I was monitoring then monitor the lower voltage from the transformer output (say 240 to 6v). It would provide isolation as well as stepping the voltage down with less heat than using a resistive divider. When playing with mains, isolation is good - it helps keep you from letting the magic smoke out (and the spitzen sparken too !! )


Very true as direct connection is always a hazard when components fail.