Return to

Devember SmartSpinach



Not quite vaporware, simply not enough time in the day. An extension of:




  • Familiarize myself more with git.
  • Brush up on C/++.

What I’m building

  • Instead of trying to remember to turn on/off the christmas lights ill use an arduino with relays attached.
  • Photocell input to turn on the lights at dusk and initiate a timer.
  • Lights shut off after the timer expires.
  • Web interface for basic configuration and control.




Main Devember Link


Since you’re interested is rolling your own IoT stuff, take a look at what a friend of mine is developing. You might find it useful when making your own smart devices api.


Fixed my repo.

Setup the hardware, an arduino mega with two relay module and a photocell. Will also add on an ethernet shield later.

Wrote the prototype for the dusk to dawn timer controller. Still need to add the timed delay and config variables. Then move on to the web control/config.


Added delay for input state changes. This negates bogus readings like a shadow over the sensor or fluctuation in the signal.

Added timeout for the on state. After the defined amount of time the lights shut off. The timeout resets when the sensor reads light again.


Thats neat, what made you want to add these changes? Based on the changelog I guess you had issues with shadows and timeouts?


The delays keep the sensor reading reliable. Another method could be averaging a sample of say 10 readings or something. Without the delays the lights could toggle on/off when the photocell signal has a spike or a shadow passes over the sensor temporarily.

With my HVAC controller the room temperatures sometimes fluctuates out of range. Or when the power dips from the relay coils activating, the sensors will read funny.

The timeout is a feature so the lights won’t run all night.


Not much going on the code front however I put together a receptacle with the relays and a couple fuses.

Mostly done, last step is to make a plug for the control wires.

Subsequently I have also invented renewable energy.



Hows the project coming along?


Still working on it. My PC had an issue with insufficient power, Threadripper and Vega 64 on an 850w power supply kept crashing. Put in a 1000w today the problems have ceased. So now the 850 platinum is going into the new server and the server needs to be setup for hosting the web interface. Tomorrow should be a good day for progress.



I had updates as well. I’m currently working on input validation.


This seems like a rollup of unfinished projects for me…

The controller will communicate to a web server that handles control, logging, authentication and configuration. My current server is an old phenom system with a pile of miscellaneous hard drives full of data.

I built a replacement server with a large ZFS pool, dual xeons and a modest amount of ram. The server has been mostly setup and tested. But I did a remodel of a couple rooms in our house before Thanksgiving and the server was shelved.

So I think now is a good opportunity to finish up the new server and utilize it for this Devember project. I cleaned and set it up and began finishing the transfer of files from the old server. I already have apache configured but still need to add php7, sql, git and rsync.

Link for the curious.


Finished getting the server setup today for web hosting. Had to beat phpmyadmin and mysql into submission, theres some issues with the system not allowing permission for the database user to login due to insufficient privileges because the users were not part of the unix system. WTF why is this even an issue these days.

Anyways got the permission issue sorted then installed git and moved my current site to the new server and cloned the repo so that i can work on it remotely. The old site is for older php5 and I decided to move to php7 so I need to update the database calls to use the mysqli functions.

Also learned a bit about using proxy settings in apache. The server runs plex and instead of typing ip:port/web I setup apache to redirect the root directory to the plex site. Set a few exceptions in the proxy for my sites and things like phpmyadmin.

Hope to get back into code tomorrow.


Today I finished converting the existing site to php7. This one provides an interface for my thermostat, and soon the lighting controller. The work mostly involved changing calls like mysql_query() to mysqli_query() and reversing the parameters connection, query instead of query, connection.
This is intended to retrofit the existing application until the rewrite is finished utilizing prepared statements.

I also had to remove the 850w platinum power supply, the one I thought was under rated for my workstation. Turns out its just bad and needs to be rma’d. Server would randomly restart… The existing 650w 80+gold should be plenty anyway.

So now the server is ready for production and something I can work with to finish up the lighting controller.


Added network code to the controller.