You definitely need to isolate between the mains and GPIO. An optical isolator would seem to be the ideal device. http://electronics.stackexchange.com/questions/50782/ac-detection-for-microcontroller
I am not an electrical or electronics engineer, I know just enough to be dangerous. On 4 February 2013 21:49, James Courtier-Dutton <james.dut...@gmail.com>wrote: > Hi, > > I have found lots of web site detailing how to drive a relay from a > Raspberry PI, for example, turning 240V AC mains devices on and off. > What I cannot find is how to have the PI detect if 240V is on a wire > or not. I.e. If a 240 AC wire is powered or not? > It is a useful function for home automation purposes. > For example, I could use it in order to make a log of when the heating > is switched on, or use existing 240V AC main light switches to provide > inputs to the Raspberry PI, and let the PI control something else as a > result. > > Done anyone know of any sort of "detect 240V AC" adapter for the GPIO > of the Raspberry PI? > > Kind Regards > > James > > -- > Please post to: Hampshire@mailman.lug.org.uk > Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire > LUG URL: http://www.hantslug.org.uk > -------------------------------------------------------------- > -- Philip Stubbs
-- Please post to: Hampshire@mailman.lug.org.uk Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire LUG URL: http://www.hantslug.org.uk --------------------------------------------------------------