Alexa IoT TV-Controller ESP8266




Introduction: Alexa IoT TV-Controller ESP8266

About: Hello! I'm Felix ;)

Recently I bought an Amazon Echo Dot during the Amazon Prime day for ~20€.

These small voice assistants are cheap and great for DIY Home Automation if you know what is possible and how to build smart devices.

I have an Samsung Smart TV but I wanted to make it even smarter. In this Instructable I will show you how to build a Controller for your TV to control it wirelessly using your voice. Some possible and useful commands could be:

  • Turn On/Off the TV
  • Volume Settings (Up/Down/Mute)
  • Switch to another source (HDMI Port, TV, etc...)
  • Turn on Netflix/Amazon Prime/YouTube...

In case your TV has an USB-Port that is always-on you have the jackpot! If not, you can use a a loong USB-cable or a small Power Regulator Board that steps down any voltage between 12.5 and 16V down to 5V. I used this because I already had a 12V power supply directly beneath at my bed for some LED-Strips :)

Another way and thats why I participate in the Battery-Challenge, is that my designed 3D-printed housing has the space for a 150mAh LiPo Battery and Charger Board. So you can keep it completely wirelessly!

Unfortunately though I have no pictures of it because my iPhone died during an iOs-Update and the photos were not uploaded to my iCloud :(

So the provided pictures are only without the battery inside, which I connected after the final assembly...

However, if you want to build your own Controller, here is what you need:


  • Further:

To build this project you need an system running the freeware "ioBroker". This is a free MQTT-Broker that allows the ESP8266 to connect to it and share it's data. ioBroker also has an Alexa-Adapter, which we can use to make our ESP wirelessly communicate to Alexa.

I run ioBroker on an old Laptop-Motherboard - but for small automations, a Raspberry-Pi would be enough to run it. You can download ioBroker on its official website here:

You also need the Tasmota-Firmware! You can download it here:

-->Choose your language!

If you want to use it with Alexa, you need to know what a physical Alexa device is needed! The Alexa-App doesn't work! Alexa-Connectivity is only optional - you also can switch your TV on by pressing a small MQTT-button like this one:

Step 1: Program the ESP8266

Because we are going to solder the ESP8266 to the PCB later, we have to program it first. To do this, I recommend you to use a cheap Programmer board - The one I used is not recommended! I had do modify it to make it work so check out the link on the top (see: Supplies).

At first plug the ESP into the programmer. Then start the Flash-Tool on your Computer. Now plug in the Programmer via USB and press the FLASH-Button on the PCB during plugging it in. Release it after a few seconds. Now there should be shown a COM-Port in the Program-Tool. Select it and continue by selecting the Tasmota-Firmware. Baud-Rate should be at 115.000 and Mode QIO selected.
When done, click on the Flash-Button on the Tool. Now the programmer starts.

When done, it will say DONE.

Now you can remove the Programmer from your PC and put it back in after you switched the programmer to UART-Mode (the switch on the PCB).

Step 2: Setup Your ESP - WiFi

Now that the ESP is programmed and plugged into your computer in UART-Mode, go to the wifi-settings of your device and search for a network which contains "tasmota" in the SSID (e.g. "Tasmota-31278D"). Connect to it, go to your browser and go to

In the following I explain what you have to do in the setup:

Wifi Settings:

  • WLAN1:
    • SSID of your Wifi-Router
    • Password of your Wifi-Router
  • WLAN2:
    • SSID of your (second) Router (optional)
    • Password of your (second) Router (optional)
  • Hostname: The name which is shown in the network - I recommend "TV-Remote"

Confirm your settings by clicking "Save" (green Button). Now the ESP tries to connect to your WiFi network.

If this process fails, the ESP will open it's own Tasmota-Wifi-Network again.

        Step 3: Setup Your ESP - Module Config

        When your ESP connected to your home network succesfully, you have to search for it's IP-Address in your Router-Menu.

        Type in the Adress into your browser. The tasmota page of the ESP will be shown. Now navigate to Settings --> Configure Module and select "Generic (18)".

        When done, search in the Drop-Down-Menu of GPIO-2 for IRsend (8) and select it.

        Press Save!

        Step 4: Setup Your ESP - MQTT

        The ESP needs to connect to our MQTT-Broker (ioBroker). We can configure the MQTT-settings on the tab Settings-->Configure MQTT. There you have to enter your Broker-IP, the Broker-Port, MQTT-User (if you dont know it you can find it at your MQTT-Adapter settings on ioBroker!). Furthermore you need to type in the MQTT-Password, the Client-Name (how the device is shown in ioBroker) and a topic. The topic is the name of the folder in iobroker. If you want to use more MQTT-devices, I recommend to declare full topics like livingroom/%topic% or kitchen/%topic%. But you dont need to do that but it will help you later when you have a lot devices connected to your Broker!

        Dont forget to save everything afterwards! :)

        And thats it! The ESP is ready to use now!

        Step 5: Setup Your IoBroker

        Now that the ESP is ready to use, we have to setup the MQTT-Broker- and optional the Alexa-Adapter.

        Go to your ioBroker-webpage (ip-adress + port (8081) like in my case).

        Navigate to "Adapters" and search for "MQTT Broker/Client" and "Alexa2".

        The MQTT-Adapter is needed, Alexa is optional.

        I recommend to start with the MQTT-Adapter. After installation a window will open where you have to setup your Broker.

        Select the options as shown in the picture.

        You can choose MQTT-User and password as you like!

        As always, don't forget to save your settings (left bottom corner).

        Step 6: Testing MQTT-Connection

        To test the connection from the ESP to broker, you need to remove the ESP from your PC and plug itback in with selected normal Startup-Mode again.

        Wait a few seconds and check the status of your iobroker page "instances" and look at the "light"-symbol of the MQTT-Adapter. If your ESP is listed there, it connected succesfully!

        The MQTT-folders will automatically appear on the "Objects" page!

        Step 7: Create MQTT-variable

        Navigate to the "Objects"-Tab of ioBroker.

        Open the folder mqtt.0/YourTopic/cmnd.

        Inside of this cmnd (command) folder, you have to create a new datapoint. You can do this by clicking on the + (plus)-Symbol on the top.

        Name: IRsend

        type: Datapoint

        datapointtype: string

        Btw sorry that the shown image content is in german, but I don't know how to switch to english for this instructable :/

        Step 8: Soldering and Printing

        Software is done - soldering next!

        The PCB should be in a circular shape with a 50mm diameter.

        Solder everything together like shown in the included schematic. Make sure you dont connect the IR-Emitter reversed! Maybe the LED wont survive that.

        I used small 2-pin-connectors for the IR-LED, Switch and the Micro-USB-Power-Board. If you want to do that too, make sure you mark your + and - connections on the side of the connector. The switch orientation doesnt matter!

        If you have a 3d-Printer at hand, you can use my provided files - It is a basic 3cm thick case which fits all the components nicely!

        Even a small battery and charging board fit inside!

        I printed it with my Anycubic I3-Mega and Black Anycubic Filament :)

        I glued the PCB, IR-LED, Switch and USB-Port inside using hotglue. Furthermore I sticked the case behind my TV with some double-sided tape. Works good!

        To start the device now, you need to push the Button during plugging it in for a few seconds. The switch disconnects the IR-LED from GPIO-2 when pressed that the ESP can start up. Tasmota only supports GPIO-2 and GPIO-0 on the ESP-01 for the IRSender so I needed to do it this way. Release the button after ca. 5 seconds...

        Step 9: Automation Time :)

        Now everything hardware-based is finished.

        Automation-Software now :)

        To make some cool automations, we need to download the Adapter "Scripts" in ioBroker. After you installed it, there will pop up a new field on the left side, called "Scripts". Open it and create a new Blockly-Script - this is a way for very simple programming using functional Blocks.

        In order to control your TV, you need to know it's IR-Codes. You can easily find them on the internet - search for your Model + IR Codes. I found the codes for my TV online too. But you can easily decode them with an IR-Receiver and an Arduino! If you dont know how to do it, search on Instructables ;)

        In my case, the signal to turn the TV on/off is "0xE0E040BF". The variable IRsend which we created earlier is now needed. The provided example program writes the Code into the variable. But before and after IRsend gets set to 0 with some delays. This is very important because the TV otherwise wont do anything.

        You need to use this Format for IRsend: {"Protocol":"NEC","Bits":32,"Data":YourIRCode}

        The trigger for the TV to turn on could be any variable in your ioBroker. If you want to do it with Alexa, basically create a new Routine in the Alexa-App on your smartphone and call it e.g. "Turn TV on".

        You can find this variable in your Alexa-adapter folder on the "Objects"-tab of your ioBroker. This variable needs to be selected as the trigger event on the top of my example script (if-condition).

        If you have an smart-TV you can also start for example Netflix, Amazon Prime, YouTube etc.

        You have to navigate the TV step by step as you would do it using the remote. Dont forget to set IRsend to 0 between the commands with a small delay. Delays should work with values between 500 and 1000ms. Simply try it out :)

        Step 10: Any Questions? :)

        I hope you can understand all the steps it takes to build my Smart-IR-Controller.

        If you have any questions, feel free to ask me in the comments :)
        Hope you like my project :D

        Btw. sorry for my bad english, I'm from germany :p

        Battery Powered Contest

        Participated in the
        Battery Powered Contest

        Be the First to Share


          • Game Design: Student Design Challenge

            Game Design: Student Design Challenge
          • Big and Small Contest

            Big and Small Contest
          • Make It Bridge

            Make It Bridge



          1 year ago

          It is posible to run ioBroker in a raspberry pi zero w?


          Reply 1 year ago

          Hi chicato,
          Maybe it would run on a rpi zero but I wouldn’t recommend you to do it. I think it would be very slow and not suitable for the use of multiple adapters and instances.
          My system runs on an old laptop which I upgraded with 4GB RAM, I5 dual core (perfect for this application) and a 60GB SSD.
          If you want to use a raspberry pi, use at least a pi 3 :)
          Felix :)


          Reply 1 year ago

          Thanks so much for sharing your project with us.
          I will use the raspberry pi 4 and 4GB or an old laptop.


          Reply 1 year ago

          Glad to hear that you like it :)
          Good choice for the system, you won't regret it!


          2 years ago on Step 10

          I can't connect to esp after connecting esp to wifi. please help


          Reply 2 years ago

          Hey there, what's your setup right now? Have you already soldered the circuit on the PCB or is the ESP01 plugged into the computer using the programmer? Best regards, Felix :)


          Reply 1 year ago

          2. adımdan sonra esp wifi'yi kapatır.


          Reply 1 year ago



          Reply 1 year ago

          Go to your router menu and search for a device whose name should contain “Tasmota” .


          Reply 1 year ago

          Yes, this is what the esp is supposed to do. It connects to your wifi according to the information you typed in :)


          2 years ago

          I did the same thing with google + IFTTT + particle photon. IFTTT just change their subscription model so my setup don't work anymore. really sucks. Well it's limited to only 3 command. My device is also behind the TV. I will look into iobroker. Thanks


          Reply 2 years ago

          Glad do hear that my instructable helped you :) My setup can handle unlimited commands so maybe it would be an upgrade for you too :D


          2 years ago

          Hi there, I think that your schematic has the 2n2222 transistor backwards?
          Typically the + rail is towards the top and the ground towards the bottom of the drawing.
          It looks like you have the ground connections at the top.
          Very creative and a nice project,
          Bob D


          Reply 2 years ago

          Hi Bob,
          thank you for your feedback :)
          You are right, the polarisation of the transistor is backwards. I will modify the schematic soon!
          Felix :)