RalphBacon / Safer-Mains-Detection

How to detect the presence of mains electricity (in your home) using a RasPi or Arduino
GNU General Public License v3.0
8 stars 3 forks source link

Safer Mains (Home Electricity) Detection

How to detect the presence of mains electricity (in your home) using a RasPi or Arduino

See the accompanying video at https://www.youtube.com/RalphBacon video #114

(Direct link to video https://youtu.be/cDuObAR42Nw)

So I really want a SAFE way to detect mains in my workshop so can check whether I have left the lights, or more importantly, the heater on. Apart from the cost there is the fire risk too.

This method is a NO CONTACT method using just a handful of discrete components and costing a couple of pounds (or dollars), if that much!

It's easy to build on strip-board and runs from 3.3 volts to 5-volts. Actually you can power this with 9v if you want, it will still work.


LINKS LINKS LINKS LINKS LINKS LINKS LINKS LINKS LINKS LINKS

PLEASE NOTE THE CIRCUIT DIAGRAM STATES 2N2904 TRANSISTOR. THIS SHOULD BE 2N3904 TRANSISTOR (or any NPN general purpose equivalent, eg 2N2222).

This is what gave me the inspiration:
How to build your own non-contact voltage detector article (with video) by Kiran Daware
https://www.jameco.com/Jameco/workshop/JamecoFavorites/non-contact-AC-voltage-detector.html

1PCS 5A Over current Protection Sensor Module AC Current Detection 12V Relay Module
https://www.aliexpress.com/item/1PCS-5A-Overcurrent-Protection-Sensor-Module-AC-Current-Detection-12V-Relay-Module/32858449954.html

Assortment of transistors like the ones I use here (2pence or US 3c each!)
https://www.aliexpress.com/item/BC337-BC327-2N2222-2N2907-2N3904-2N3906-S8050-S8550-A1015-C1815-Transistor-Assortment-Kit-10value-200PCS-Transistors/32687065196.html Just watch as you open the lid so they don't all get mixed up (don't ask, no, really, don't)

The sketch I used is simplicity itself but does demonstrate the use of a boolean variable to keep track of the last state.
It's in the GitHub.

If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so :)

My channel and blog are here:


https://www.youtube.com/RalphBacon
https://ralphbacon.blog