Security lights automation - Sunrise/Sunset

Over a year ago, I got so frustrated with photocell controlled lighting the could not tell the difference between day and night that I decided to do something about it and put together a project using a Raspberry PI (RPi) and a Solid State Relay (SSR) board to automatically turn on/off lights based on accurate calculations to determine sunrise and sunset for a given lat/long (and height) position. The original project controlled 50 watt High Pressure Sodium light fixture(s). It’s been working well for over a year now.

Recently I started using LED lighting - my backyard security light is a ~ 90W equivalent LED bulb that consumes about 9 watts of power. Running an RPi 7x24 that consumed ~ 4.5 watts of power to control a 9 watt LED light does not make sense (today). So enter the Particle Photon and a couple of revisions to the original RPi code and we have a power efficient security light controller! See the autolight-photon project here. My first implementation is actually running in the cloud and using the Particle I/O API to control the light.

I’m interested in knowing if anyone finds the code useful and/or has suggestions on how to improve it.



Apologies for the crappy documentation - most of which was copied from the original Raspberry Pi project. It’s been updated with improved software installation notes and also an updated hardware parts list that includes the required Photon (duh!!!) and a couple of alternative relay boards that are based on mechanical relays - including the awesome Particle Relay Shield.