During the late autumn of 2016 I finally got the opportunity to fiddle around with the ESP8266. There are several ways to write code for the chip, but I decided to go for the open-rtos-sdk since it got the perks of being open source and based on FreeRTOS which I’m already familiar with. I bought some cheap RGB light bulbs based on the ESP8266 chip online, together with an USB to TTL cable to be able to flash my custom firmware to it.
The project, which I decided to call Alfred Home Assistant, consists several light bulbs with ESP8266 acting as MQTT clients, and a Raspberry Pi Zero acting as a MQTT broker (using Mosquitto). The RPi also runs a server to host the web application that is displayed on the smartphone. The ESP8266 outputs four PWM signals, one 8-bit signal for each RGB color and one for white. The app displays three different bars:
1. The color spectra in range 0-255 for all the three colors.
2. Saturation, which is the intensity from 0-100 of the color. 0 gives only white, 50 gives 100% white and 100% color, and 100 gives just 100% RGB color but no white.
3. Brightness 0-100.
The source code for the ESP8266 can be found here. Some parts are not beautiful, especially the fact that the ESP8266 seem to have only two timers (really?) caused problems in order to have four individual PWM signals.
Demo on YouTube: