Ambient lighting controlled by Siri

In this post I will walk you through the moving parts required to build an ambient light system. The light will be controlled by any of the following:

  • Siri (via HomeKit) – voice activation and configuration (power state, brightness, colour)
  • HomeKit – software activation and configuration (power state, brightness, colour)
  • Touch sensor – hardware activation and configuration (power state, brightness)

This is not a step-by-step guide but rather a description of the components involved and how the whole thing is put together.


The image bellow describes the overall architecture depicting the MQTT server as the central integration point.

The communication pattern is designed to adhere to the MQTT Smart Home Architecture, described here.

Architecture diagram illustrating the ambient light system

Ambient lights architecture


The Arduino is the controlling unit and uses the ESP8266 chip to achieve wireless connectivity. There will be only one power supply (5v 10a) powering the Arduino, ESP8266 and the LED strip. Therefore, a 3.3v voltage regulator is necessary for the ESP8266 chip, a capacitor should be used together with the regulator to smooth out any ripples.

The WS2812B strip supports addressing every LED individually, however, this functionality was not used and the strip is controlled as a whole. The strip is by far the most power hungry of all components and special care should be taken to pair it with a suitable power supply.  Keep in mind that each LED is actually composed out of 3 coloured LEDs (red, green, blue) that draw up to 60 milliamps at maximum brightness white.

The capacitive touch switch is used to manually turn the strip on or off, or to adjust the brightness level. A short sensor touch will cause the power to be toggled on/off while keeping the sensor touched will cause the brightness to gradually increase.

The Raspberry Pi does not play an active role in the hardware setup. It is used to host various software programs and can easily be replaced by a desktop, laptop or NAS.


Controlling the ambient light system is performed by a suite of software:

  • LEDStripController – runs on the Arduino and is responsible for communicating with the LED strips, publishing and responding to MQTT messages, and responding to the touch sensor inputs.
  • Espduino – firmware and software for the ESP01 chip to avoid working with AT commands.
  • Mosquitto – MQTT server, running on the Raspberry Pi.
  • Homekit2mqtt – HomeKit to MQTT bridge, running on the Raspberry Pi.

If you are going for a similar setup, keep in mind that Espduino is discontinued! I recommend using an ESP12 instead of the Arduino+Esp01 combination.

In case of network loss ESP01 automatically tries to reconnect to the wifi, however there are times when the chip stops responding entirely. To mitigate this issue a “watchdog” was set in place to hard reboot the chip (power cycle) when it stops responding.

In the general usage pattern a burst of messages are sent to the controlling pair (ESP01+Arduino) and processing those messages is prioritised over updating the hardware (actually turning the LED strip on and configuring each LED according to the chosen colour and brightness). This debounce is controlled by the HARDWARE_UPDATE_DEBOUNCE parameter.

Touching the touch sensor for a short period of time triggers a power toggle, while keeping the sensor touched causes it to cycle the brightness in steps. It takes 10 steps to go from the lowest to the highest brightness level.


Here are a few pictures from the assembly process

Assembly process #1

Assembly process #2

Assembly process #3


Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>