This is a nice weekend project to supercharge your home lighting with voice controlled lights that are super cheap and fun to build — within hours you’ll have voice controlled lights that are sure to impress.

High Level Overview

We are going to get some RGB LEDs, connect them to a programmable WiFi board, which will talk to Google Home Mini, via some online services. When you say the phrase “Turn the kitchen lights on”, a message will be sent, the wifi board will receive it, and will turn the LEDs to the colour you specified.

Mega. Let’s start.

Step -1. The kit we need

I’ve listed the parts I used, but you can use different ones as the core concepts are the same . I’ve added links to the ones I bought.

Step 0. The Approach

There are three core parts of this project—

  • The voice side — converts a spoken phrase you choose into an action and sends it.
  • The action side — receives the action sent from the voice side and then does something with it.
  • Finally, there’s the communication between the two. This is where we will start.

Step 1. Set up the communication channel

The first thing is to set up the communication channel between the two sides. We will be using Adafruit IO, an online service that handles the technical details and gives us a nice way to send and receive messages. You could also use an MQTT server if you wished.

Once you have an account on Adafruit IO, log in, and click on “View AIO Key” the sidebar and copy it— this key means only apps you authorise can send messages to your devices. Don’t post, upload or commit this key! You’ll need to add that into your code later on.

We are going to set up a feed, which is a place where messages can be sent to and received from. The voice side will post messages, and the action side will receive them.

  • Click “Feeds” in the sidebar
  • Under the “Actions” dropdown, “Create a New Feed”. Name it such as “kitchen” or something relevant to where your lights will be going.

Now we have a feed set up, we have the channel between the two sides. Let’s now look at the voice side, which will convert your spoken phrase into an action and post that action to the channel.

Step 2. Converting words to actions

I’m using IFTTT (IF This Then That) to convert spoken phrases to actions. In IFTTT you create applets; each one has a trigger (such as what you say, time of day, or hundreds of others), and an action which is fired when the trigger condition is met. Our aim is to get an applet with the rule: when I say “turn the lights warm" -> send 'warm' to the channel we specified.

  • Log in to IFTT, click “My Applets” and then “New Applet”.
  • Click the “this” text in blue, to create your trigger, and search for “Google Assistant”. Click Google Assistant and authorise it if it asks you to.
  • Click “Say a phrase with a text ingredient” — this means you can have a variable in your phrase, such as “Turn kitchen lights warm” which would also work for “Turn kitchen lights white”.

IFTTT — choosing a trigger. Select “Say a phrase with a text ingredient”

Now you can enter the phrase you want to say to trigger the lights — this can be anything. In my example I chose “Set bedroom lights to $” where $ represents the ingredient. I also added a second shorter one “bedroom lights to $”. You can also add a phrase that the voice controller will say when your action is complete, I set mine to “Done, bedroom lights are now set to $.” — where $ is the colour of the lights.

Click save, and on the next screen, click the text “that” which is blue. This will be what happens when you say the phrase you’ve just set up — and we want it to send a message via Adafruit IO.

Search “Adafruit”, and click it. Authorise if needed.

Next we click “Send data to Adafruit IO” which means we will be creating and sending a message when you say your voice command.

Choose the feed name you set up earlier in Adafruit IO, and under the “Data To Send” click “Add Ingredient” and choose the text ingredient you added earlier, but nothing else. This means the message that is sent to the feed is only the ingredient you specified — if you say “Turn the kitchen lights to warm” then the message will just be warm — so everything that subscribes to your feed will know what colour to go to, meaning you can have many lights change colour at once — lovely!

Click “Create Action” and then “Finish” to save your new applet! Congrats!

Step 3. Testing that voice becomes an action

Now we are going to test that messages you say to your voice controller come through to Adafruit IO, which will then pass them on to the LEDs.

In your web browser go to Adafruit IO and click on the feed you created, and at the bottom of the page all messages that have been sent to the feed are listed — we’ll be looking here to ensure voice commands get turned into messages.

Plug in your voice controller and say the command you set up earlier in IFTTT. If your accounts are linked properly, the voice controller will reply with your custom message and a message should appear in your feed.


  • Voice controller doesn’t understand — speak clearly, and try simplifying your phrase — Google Home had trouble understanding some of what I said
  • Voice controller doesn’t trigger a message — I had to disconnect my Google account and re-connect it before the phrase I set up in IFTTT became available to Google Home. I found Google Home buggy to get going with so I don’t think that was related to IFTTT.
  • Message doesn’t appear — try refreshing the feed page and scroll down to the list of messages. If it doesn’t appear then check that the right Adafruit feed is selected in the IFTTT applet settings.

Step 4. Action side — setting up

Now we have the voice command being converted to a message and posted to a feed, we now need to get the WiFi board to subscribe to our feed, meaning anything posted to the feed gets received on the WiFi board.

The nodeMCU I used — connected to a LED to test that I can upload code and that it works.

I am using a nodeMCU (ESP8266) to connect to the WiFi, and wired to the LEDs — but you can use many others. The benefit of the nodeMCU is you can use the Arduino IDE which has libraries available to use cutting down development time. I uploaded a blinking LED example to prove it worked.

I used the Adafruit Arduino library and the FastLED Arduino library — these make receiving messages and setting our addressable LEDs easy. We will install the libraries, detailed below, and connect the Adafruit library to the FastLED library and together we have controllable LEDs.

  • Make sure if using a nodeMCU that you have set up the Arduino IDE to handle programming of nodeMCUs — I used this tutorial which was simple
  • Install the Adafruit IO and FastLED library: Arduino program-> Sketch menu-> Include Library -> Manage Libraries.
  • Search for Adafruit IO, and FastLED and install both
  • Restart the IDE
  • Any problems you have, Google is your friend.

Step 5. Getting the hardware right

If you’ve used an Arduino/nodeMCU before you’ll know wiring stuff up is quite easy.

I suggest using a breadboard, but you can just solder wires to the pins for the nodeMCU, or solder pins to the wires and plug them into the Arduino.

The WS2812B LEDs have three lines: +5v, Ground (0v) and Data. Note that date lines are directional, one side of the LED strip has D+ and the other D-, getting it the wrong way round will mean the lights just won’t light up. They’re pretty robust in my experience of wiring them incorrectly and that’s one of the reasons why I like them so much.

The lights! They work! This is me using a test sketch from the FastLED library to make sure they work. Ignore the other circuitry on the breadboard.
  • Wire the +5V to the VV or VIN of your nodeMCU — this will mean the potentially high current draw won’t go via the on board power supply which could cause problems. For really long stretches of lights, use a supplementary power supply.
  • Wire the Ground/0V to Ground on the board.
  • Wire the Data line to a GPIO port that you want to use
  • Using a test sketch, ensure the LEDs light up. Sample code can be found in Arduino, clicking on File -> Examples -> FastLED, and selecting Blink. This will let you test that the WiFi controller can talk to your LEDs.

If you’re not using adressable LEDs, and just want something to turn on and off, you can find tutorials online:

  • 12v/24v LED lights that can be controlled with a transistor or MOSFET
  • Mains voltage lights that will need a relay board — only do this if you are competent with mains electricity as it is dangerous. 🔥 Disclaimer here that I’m not responsible if you kill yourself or burn your house down!

Step 6. The code

My sample code is available on my GitHub, it should be easy to follow what it’s doing: I encourage you to fork, refactor, make it better!

At a glance, the code has three main methods:

  • setup— this is run once when the controller is started. It sets up the WiFi connection, LED library, and any other things that only need to happen once
  • loop — this is continually run. is the only thing we need in this, as the final function is where we place any logic
  • handleMessage — we have initialised the io library to run this every time a message is received. In here we get the message from Adafruit IO: data->value() and this is the string such as “purple” or “warm”.

Lines of code to note:

  • 04 — Here we access our feed by its name.
  • 27 — here we tell the IO feed to run the handleMessage function on every message.
  • 39 — initialising the FastLED library with the array of LEDs, each item in the array being a LED — the color stored in there is sent to that LED on the strip.

Don’t forget to edit config.h which contains your WiFi details, and Adafruit IO details.

Step 7. Give it a go!

Say your phrase to your voice controller, wait for the reply, and then your lights should change! The voice command got turned into a message by IFTTT, sent over Adafruit IO to the nodeMCU, which then changed the light colour!

You did it! 🎉

Conclusion and next steps

Presumably if you’re reading this far, you’ve either done it or you’re now excited to do it yourself.

It’s an awesome project, it’s a great introduction to developing voice commands and IoT devices, and it looks really impressive when you try it out!

I’ve morphed this project into a new one, which I’ll post about soon… as a sneak preview check out a video I recorded of my prototype controller board turning my water heater on!

Happy hacking!