So I've successfully made a Motion Activated CAMERA that I've installed in my garage for various irrelevant reasons. The thing sends me an email when it detects motion, and sends me recordings of said motion afterwards. It works flawlessly, except for one thing: At night, the camera cannot see a thing. It can see flashlight rays (and that triggers motion), but it doesn't show much else. I've tried tweaking the brightness and stuff like that, to no avail.

So I've come to the idea of hooking up a Spotlight to the Raspi3. It has a regular on/off switch, and I'd like the Pi to turn the Spotlight on whenever the camera detects motion. I've already got python scripts that work on motion events, so I just gotta plug in some code that also flips a switch on the same event and turns off after a certain amount of time... And this is where we get to my problem.

I don't know how to code. At all. I can read and mostly understand what code does, but I've no idea how to write anything from scratch. So 95% of my success in making code work in this project is attributed to my stitching together various tutorials. Whenever I google anything about making a Raspi turn something on or off through GPIO, all I get are tutorials about making power switches for the Raspi itself, which is not really what I'm looking for.

And this is why I'm here. Does anyone know of a tutorial somewhere they could point me to? All I need is to copy some code that uses WiringPi to flip a switch and plug that in into my already made python scripts that do stuff on motion events. I doubt it's very hard to do, but when you've zero knowledge like me it might as well be impossible. It doesn't help that I'm on a time crunch as well, we're moving out in a few days and I need to get this done before that.

NOTE: I'm not looking for the Raspi to POWER the Spotlight, that will be done through regular means as I don't have relays and no time to get any. I'm just looking for the Raspi to basically flip and on/off switch through its GPIO.

Hope someone can point me in the right direction, and thank you for your time!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.