Pi with light sensor to trigger an email

Last year my son and daughter gave me a Pi 3 Model B+ “starter kit”. It has stayed in the box until now, because my programming experience, decades ago, was in Basic, and I know virtually nothing about Python or Pi’s operating system.
Now my son has suggested a useful project:
The power in my garage is on a circuit which has no connection to the panel of circuit breakers etc in my home. Because of the equipment in my garage, I need to monitor the state of the garage power when I am in my study, so that if the garage power goes off, I can investigate the problem and if ok, go to the garage’s circuit breaker (near the garage) and reset it. I have a USB power supply plugged into a power board in my garage. A long USB cable goes to my study, and on its way the cable passes through a hole that is so small that I could fit only the two wires for power through it. The other end of the USB cable has a “USB Mini LED light” (bought from Jaycar) connected to it. So I can keep an eye on the LED light.
That’s all fine when I am in the study, but when I am not there I want to be notified by email if the power goes off in the garage.

I propose using a PiicoDev Ambient Light Sensor VEML6030 directed at the LED light. However, it’s an Ambient Light Sensor. Would the LED’s output (120 Lumens) be too much for the sensor to handle?

Also, if there is a power outage in the garage, and the LED in the study stops shining, the sensor should sense the drop in light ouput. So I will some kind of “if” statement to send an instruction to the Pi, which would activate an email to me containing a simple warning message. How do I do all of that?

What bits of equipment will I need to make the system work?

1 Like

Hi George,

You could definitely do it the way you are suggesting, and I wouldn’t worry about “overloading” the light sensor, the VEML6030 chip on our PiicoDev light sensor boards is good for 120 000 lux, and a 120 lumen light with a 60 degree beam angle at 10cm is only about 14 000 lux. Lux/Lumens Calculator: How Much Light Do You Need?

A slightly neater (but a little more complicated) method would be to use a logic level converter on 5V and GND lines of your USB cable, and run the resulting 3.3V logic to an input GPIO pin on your Pi.

A bit more on those parts here:Bi-Directional Logic Level Converter Hookup Guide - learn.sparkfun.com