Software

The ESP8266 in Olaf runs NodeMCU, or Lua. This allows for an very lazy programming and very short development time, but it isn't very efficient. For this purpose, it's perfectly fine, and it allowed me to do this project in a pretty short time.

I decided to do the alarm logic serverside, using a cronjob and some PHP magic. There certainly are many reasons why one would prefer to run all the code on the hardware itself, but I wanted it to work quickly and wanted to have the ability to change my code without connecting Olaf to a PC again. Another reason would be the small flash size on the ESP-01, which pretty much precludes OTA programming and updates. Running a fully-fledgded webserver on Lua would also be stretching memory pretty thin, so I chose to implement a very simple MQTT interface to change colors, and do the configuration part on the server.

All code can be found here: https://github.com/jjwbruijn/WiFiRGBOlaf

I've uploaded the used nodemcu firmware, that should work on all ESP-01 (pretty lightweight build). Its always good practice to build your own firmware instead of loading binaries, but I've included it for convenience. The Lua files should be edited to match the server configuration, and to specify the MQTT server.

The server part runs on two PHP scripts. One is started every minute by cron, the other runs on a webserver, allowing you to change the alarm clock settings. Config is saved as a json file. I am aware the page is shittily styled and barely works.

Minimum effort.

Post Comment