IR Blaster with Tasmota

Tasmota can connect to lots of useful sensors such as temperature and humidity sensors and amongst these is the ability to send and receive infra red signals. My feeling is that this is under-utilised by people and is not as complicated as you might expect to setup.

The possibilities for this are pretty endless. I use it to control my TVs through Google Home and a Remote Control “app” on my phone created using NodeRed Dashboard.

This post does assume a few things. It assumes that you are using Tasmota connected to an MQTT broker and finally Home Assistant to make it useful. If you don’t have all this then I highly recommend you check out Dr ZZs videos to get them all up and running.

In this post I’ll go through what I did to get the rest up and running.

IR Receiver

I set this up so that I could get the right codes from my existing remotes. I started off trying to find the right codes on the website, which I did manage to get to work for my TV (eventually), however I could not get the codes for my set top boxes (Sky Q). Using the IR Receiver with Tasmota I was able to grab the info for any of the buttons on any of the remotes.

The first thing you’ll need to do is buy an IR Receiver module and your esp8266 device of choice with Tasmota on it. (Here’s an example of what it looks like

  1. Connect up the GPIO leg (left leg as you look at it) to one of the GPIOs on the sonoff (I am using a sonoff basic so used GPIO14), connect the ground (middle) and VCC (right). I didn’t use any resistors for the receiver
  2. In Tasmota go to Configuration -> Configure Module and select “47 IRrecv” for the GPIO pin you have attached the receiver to
  3. Go to the Console, point a remote at the receiver and take a look at the MQTT message generated. You will get something like this:


To grab you remote control codes, that’s it! You will be using the data you have gathered for each button later on.

Now if you want to control other things with a remote you can listen to the relevant mqtt topic and whenever you press a specific button on a remote control you can trigger an automation.

However, the main purpose of this post is to emulate a remote control press so let’s move on…

IR Sender

If you have enough gpio pins available you can also keep the IR Receiver connected when doing the next step but it’s up to you.

  1. You will need the following:
    1. An IR Transmitter Diode, I used a 940nm one (They are very cheap and usually comes as a pack of 10 more, good in case you fry a couple, which I somehow didn’t do)
    2. A pn2222 transistor. I’m sure you can use others but this is what came with a cheap Arduino/pi electronics kit I bought and appears to be quite common
    3. A couple of resistors. The values of these will depend on how powerful your LEDs are and how far you need them to transmit. Mine only transmit about 20cm, but for my setup that’s actually fine
  2. I thankfully found a diagram of what I did:

  1. Once connected up like the above diagram then go into Tasmota and configure the gpio pin to “08 IRsend”
  2. Now you just need to send the right data to your mqtt broker for the Sonoff to pick it up!
  3. The data that you send via mqtt is slightly different to what is shown in the console when you retrieve the codes from pointing your remote at the receiver (Note the “0x”). Here’s an example Home Assistant yaml script I created which sends a button press, waits 3 seconds and then sends a different button press:

  alias: Sky On
  - service: mqtt.publish
      topic: 'cmnd/bedroomremote/IRsend'
      payload: '{"Protocol":"RC6","Bits":32,"Data":"0xC0081A80"}'
      qos: 2
  - delay: '00:00:03'
  - service: mqtt.publish
      topic: 'cmnd/bedroomremote/IRsend'
      payload: '{"Protocol":"RC6","Bits":32,"Data":"0xC0081A83"}'
      qos: 2

This should be enough information to get you going and figure it out but I will definitely add to this post over time and make it more comprehensive.

That’s all for now!

No One

Leave a Reply

Your email address will not be published. Required fields are marked *