After the Sonoff Basic and the Sonoff 4CH Pro, we’re now flashing the MagicHome RGB LED Controller to install the ESPHome firmware on it. With this device, we can control the color, the intensity and the effects applied to the LED strip. So here are the details to have it available on Home Assistant.
What is ESPHome ?
ESPHome is an ecosystem which allows to control the hardware connected to ESP8266/ESP32 devices.
Using simple configuration files, it’s able to control LED strips, temperature sensors, inputs, outputs, i2c devices and a lot more.
Have a look at their site to see what it can do.
Regarding the wiring, we first have open the controller. There is no screw to remove, we only have to remove the cover.
Then, on the bottom side of the PCB, we can find 5 pads required to flash it :
On each of these pads, I soldered a wire in order to be able to connect it to the serial adapter.
Once done, make sure that the serial adapter is using 3.3v. Otherwise, a 5v will damage your device.
To use Python to upload the firmware, we need a Python 3 installed, this can be found here if you don’t already have it.
A Python package already exist to manage everything around the configuration and the upload. I can be installed by running the following command :
pip install esphome
Here is the a minimal configuration for this controller. With this, on Home Assistant, we can choose the color, the intensity and select an effect (I added slow random colors, fast random colors and an “In Alarm” mode which flash red and blue).
Just copy-paste that file on your computer and set your WiFi SSID and password.
Here’s the GitLab Snippet : https://gitlab.com/snippets/1958055
Enter in the Programming Mode
To enable the programming mode on the MagicHome LED Strip Controller , we have to :
- Disconnect the serial adapter.
- Connect GPIO0 to the ground.
- Now, reconnect the 3.3v.
- After few seconds, you can disconnect GPIO0 from the Ground.
🎉 Then, the programming mode should be enabled ! 🎉
Upload the Firmware
Your device is now ready for the firmware upload, it can be done with this command :
esphome magichome_led_strip.yaml run
Exit the Programming Mode
Once the firmware is uploaded, we can disconnect everything, remove all the wires that we soldered and put it back in its case.
If we have to upload a new configuration, we can use the OTA (over-the-air) feature which we enabled in the config file.
What's next ?
Right now I’m working on my next tutorial. This time, I’ll not flash an existing device. With an ESP-01, I’ll control 16 relays with the I2C port.
If you like these tutorials, don’t forget to subscribe to see my next projects !