#114 No contact mains detector for Arduino & Pi 🥧(just 10 components)

Safer Mains (Home Electricity) Detection How to detect the presence of mains electricity (in your home) using a RasPi or Arduino 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. 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 stripboard 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 ------------------------------------------------------------------------------------------- PLEASE NOTE THE CIRCUIT DIAGRAM STATES 2N2904 TRANSISTOR. THIS SHOULD BE 2N3904 TRANSISTOR (or any NPN general purpose equivalent, eg 2N2222). Everything here is in my GitHub: https://github.com/RalphBacon/Safer-M... 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/worksho... 1PCS 5A Over current Protection Sensor Module AC Current Detection 12V Relay Module https://www.aliexpress.com/item/1PCS-... An assortment of transistors like the ones I use here (2pence or US 3c each!) https://www.aliexpress.com/item/BC337... 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: https://github.com/RalphBacon/Safer-M... 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: ------------------------------------------------------------------    / ralphbacon   https://ralphbacon.blog ------------------------------------------------------------------