The Room Controller : Software

Mark Zachmann
Home Wireless
Published in
1 min readDec 1, 2016

The Photon Software is straightforward.

During setup it tries to figure out a few things. Which board rev — if there is a thermistor on A0 it’s a new V2 board. Which thermistors are connected — disconnected ports will read high due to the pullups. Finally, it can’t decide which occupancy sensors are connected so that is set in the database manually.

The code shown in the IDE

After setup the standard Arduino loop (which runs over and over leaving time to do Wifi synchronization) reads the sensors. If the IR sensors have changed or the temperature sensors have changed enough then the data is sent immediately. If not, then the data is sent every 20 seconds anyway.

The REST address is hardcoded to the known IP:Port of the NGINX server running on the Raspberry PI. This server converts it to a uwsgi service running a python script that does the actual REST code.

The code is here: Main.ino

--

--

Mark Zachmann
Home Wireless

Entrepreneur, software architect, electrical engineer. Ex-academic.