Does anyone have a good idea for monitoring if a wire is live 240v or not.

I'm wiring a PI relay in parallel with the room stats (8 stats in total) so that either the room stat or the relevant pi relay can call for heat.

That's all working nicely, but next I would like to monitor the status of the room stats (i.e are they calling for heat with the return wire at 240v)

Essentially a relay board where the control is 240v and it's switching a GPIO friendly 3.3v on/off

I'm struggling to google this as every result is for "normal" relays with LV controlling the mains.

  • 1
    Before I answer, is it 240VAC? is it continuous load? are you looking to sense the 240V? how much variation on the 240V line is there? and would you accept answers that involve analog input or A2D conversion?
    – j0h
    Sep 27, 2016 at 1:32
  • 1
    Could you be a bit more specific wrt the question, "are they calling for heat with the return wire at 240v". A schematic drawing would help us understand your overall question better & improve the quality of any answers you might get.
    – Seamus
    Jan 9, 2020 at 23:25

2 Answers 2


I have the same sort of issue with my future home automation plans for a Raspberry Pi to control/override some of my Domestic (MAINS!) Lights. As well as some suitably rated relays, correctly designed to safely operate across a "Mains Barrier" with Mains Voltages on the contacts and low-voltage on the coils I also need to monitor the Mains Input and the three switched outputs (which, as they will be parallel to the conventional light switches in the circuit would still be "live" when the RPi is NOT trying to turn them on if the relevant light switches are!)

At this point in time I am trying to track down a circuit that I saw somewhere here that uses an opto-isolator, a X2 capacitor and a series resistor to detect the Mains - importantly it is the capacitor that is used to drop the voltage/current passing through the LED in the opto-isolator. As virtually all the impedance in the circuit comes from the capacitor the current and voltage are nearly 90 degrees out of phase and so the power dissipation is very much smaller (though the current is largely the same) than the few Watts that would be lost in the series resistor if that was the right size to put 10 to 30 mA through the opto-isolator LED in a purely resistive circuit.

I hope to update this with more information when I have it...


How about a traditional step down transformer and rectifier? Well, not so smart maybe..

But an opto-isolator with few passives should also help. You will need to build it as there doesn't seem to be a breakout board. See this link: https://electronics.stackexchange.com/questions/150588/sensing-ac-high-voltage-to-microcontroller

Another option may be to use hall effect sensor but that will measure current rather than voltage. So useful if you have load connected and is drawing power. See here - https://www.sparkfun.com/products/8882

You can google for "AC mains sensing circuit" or similar.

Hope it helps.

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.