Previously I wrote how I designed and implemented a 12 Volt trigger for an NAD D-3020 audio amplifier and on the PCB version to automatically switch the amplifier on and off. In response to those posts I occasionally receive comments asking why I am not using an IR remote control instead of the 12V trigger input. The advantage of IR is that it also allows switching to the corresponding input, and allows to control other devices as well.
A lot of the available IR blasters come with some form of cloud-based integration such as Amazon Alexa, Apple Siri, Google Assistant or Tuya. I am not a big fan of those and prefer to implement my home automation without big tech looking along. Tasmota is a great platform for that; it implements a firmware that can be combined with all sorts of sensors, switches and actuators based on the ESP8266 or ESP32 modules. In the past low-cost IR blasters based on Tuya would have an ESP8266 module and could be flashed with Tasmota, but nowadays many Tuya devices use another non-compatible wifi module.
There are also ready-made ESP8285 IR blaster modules, which are very cheap on Amazon or Aliexpress. I decided to implement my own and learn a bit more along the way. I ordered 6 of these IR LEDs and this HX1838 IR receiver. After an initial design and test on a breadboard, I implemented it as a shield for a Wemos D1 mini.
While translating the initial working design from the protoboard to the perfboard, I initially made the error to use pin D3 for “IRsend” and D8 for “IRrecv”. This would not work for both, seemingly because of their special functions and/or internal pull-up or pull-down resistors of the ESP8266. This page has a lot of details and here is a clear list that orders the best input and the best output pins to use. I switched “IRsend” and “IRrecv” to the neighboring pins D2 and D7, after which it worked fine again.
Note that the old Wemos that I still had lying around is a cheap clone with the micro-USB connector on the opposite side as the ESP12F module. Modern ones have the ESP chip directly mounted on the PCB rather than in the form of an ESP12 module with a metal cap, making the whole design more compact. Due to the way I soldered the stacking pin headers, the pinouts on the board are left-right mirrored compared to what I would consider the normal orientation.
This shows the top and bottom of the IR shield:
The photo below shows the IR blaster mounted underneath the corner of our couch, using a paperclip and some safety pins. The couch is about 3 meter distance from the TV and audio setup.
Hello, i followed your instructions.
Ir receiver is working, but i can’t send ir signals.
I placed the remote right next to the tv, and it’s still not receiving any signals.
What could I be missing to get it working?
Hi Keel,
I see a number of options:
Your IR LEDs might be the incorrect wavelength. Or your LEDs might have a different forward current or voltage drop than mine. In that case they might be too dim to be picked up, or alternatively you might have fried them with a too high current. So perhaps you need a different series resistor. Mine were specified as 0.9-1.3 V and with three in series that would be somewhere between 2.7-3.9 V, which can be supplied with the 5V from the USB interface. On https://www.luxalight.eu/en/resistor-calculator you can find a calculator for the series resistor.
An alternative could be that the transmitted codes are not understood by your TV. Perhaps you can split your receiver (which you say works) and your transmitter over two ESP8266 boards. That allows you to use your own receiver to check on your transmitter. If the receiver does not see anything, it is likely to be an analog problem with the LEDs. If the receiver _does_ see the codes you are sending, it is a problem with the protocol.
I hope this helps,
Robert
Thanks, i don’t think there’s an issue with the protocol since it gets sent and received just fine by the tv if I’m using a different remote (tuya remote flashed with tasmota)
i will verify again by adding a second remote to check if the ir signal is sent and also replacing the ir led.
Is there any indication if they’re fried? Looks fine to me
Hi, apparently I was using 10k resistor instead of 1k and the optocoupler was in the wrong position.
I’ve rectified the optocoupler but I’ll need to order a few 1k resistors. Could using the wrong resistor be the reason why ir transmitter wasn’t working?
The resistor between the ESP8266 output pin and the base of the BC337 transistor being too large (10k instead of 1k) could indeed explain it, the current into the base and the voltage would be much lower and the transistor might not switch on. If you have some visible LEDs, or even replace just a single IR led with a visible one, you would be able to see whether it blinks or not. For background you may want to look up how to use the transistor to switch a load that is too heavy to be driven straight from a MCU pin, see for example this.
I am not sure about the optocoupler that you mention; there is no such thing in my design.
My apologies, it’s bc337 transistor, not octocoupler.
I’ve replaced with 50 ohm resistor (2 units 100 ohm in parallel) & using the 1k resistor but I’m not getting better result yet.
For the next step of testing, i should use color led and see if it blinks when sending ir command?
Yes, I suggest that you replace one of the IR LEDs with a visible color LED. Rather than testing with Tasmota and sending an IR code (which is a short and very fast flicker), you can flash it with the standard “Blink” sketch. In the sketch you should update the LED pin to the one that is connected to the transistor. If that works, you should see the color led blinking.
Hi, i switched to d1 mini (previously lolin esp8266 devboard)
And now it works even with just 1 IR LED.
I’m not sure why it wasn’t working with esp8266 devboard using the VIN pin for IR LED.
I think i’ll stick to d1 mini now and thanks again for the compact design.
👍🏻
Hi, I wanted to include 5 LEDs in series (4 pointed to all direction and 1 pointed upwards) with 1 unit of 50 ohm resistor.
But I noticed when I start adding 4th LED, the transmit seems to be weaker? My AC/TV doesn’t seem to respond at all compared to just 3 LEDS
What’s the proper method/wiring for this setup or if I need to add more LEDs in series?
Hi Keel,
There will be a voltage drop over each LED that you add to the series. In my case, with 5V supply voltage and the specific LEDs that I have, I was able to connect three LEDs in series with a small resistor, and that repeated twice in parallel.
You can use https://ledcalculator.net to compute the required resistor(s), it will also automatically determine whether you can wire them in series or in parallel, or a combination thereof (as in my case).
best regards,
Robert
Hello Robert, I’m trying to implement an IR blaster on esp8266 using 4 IR LEDS and and one IR receiver. I’m new to all this. Can you help me with a circuit diagram and explanation please.
Hi Samuel,
There is a circuit diagram in the blog post that shows how to connect three LEDs as a chain in series (D1, D2, D3), which is then replicated with D4, D5 and D6. The two chains of LEDs are connected in parallel and are driven by the same transistor.
The reason for using the transistor is that the LEDs require more current than the digital control pin of the ESP8266 (or a similar Arduino-like board) can supply. So the digital pin does not drive the led directly, but it opens the transistor (you can consider this as a valve) which then allows the current to flow from the +5V to GND through the LEDs. The R1 resistor (and similarly the R2 for the other chain) serve to limit the current through the diodes. The current-limiting resistor value that you need depends on the LEDs, you can use https://ledcalculator.net to calculate it.
In the schematic you also see resistor R3 which limits the current that flows from the ESP8266 or Arduino digital control pin into the base of the transistor. The transistor “valve” only needs a bit of current to open. The R3 resistor value depends on the transistor, not on the LEDs.
Websites like https://www.learnabout-electronics.org and https://www.electronics-tutorials.ws provide very good explanations on this in general.
I hope this helps and good luck with your baster!
best regards,
Robert
Hi Thanks for this!
Had the following things to say 🙂 :
– Too bad the transistor bc337 was not order able trough tinytronics, or did you order something else for it ?
– Made a quick PCB for this in kicad with this schematic so that it becomes flatter, and with some m3 holes in the PCB I could mount it / create a 3d box for it!
– Do you happen to test like the max distance you could send IR commands from ?
Anyway thanks I hope when all parts come in that it will be a nice slim package hidden somewhere 🙂
Hi William,
The BC337 is a general purpose NPN transistor that can be replaced by many alternatives. The main thing to look for is that it can handle the current; the BC337 can handle 800 mA, which is way more than needed. My IR LEDs are designed according to their specification sheet for 30-60 mA, so the parallel design would not need more than 120 mA. In reality the IR LEDs are not continuously on but blinking at a very fast rate (and that only for a short time), so the effective current they draw would be even lower. I think that the 2N3904 would do fine; it can handle 200 mA.
Note that I did not specifically select and order the BC337 for this project, it was just a transistor that I still had in my small supply box with components.
I have not systematically tested the operating distance. I mounted the IR blaster under the corner of the living room couch, at approximately 2.5 meter from our TV. But I did notice upon installation that the reception is not terribly strong: I had to properly point the blaster in the direction of the TV. The biggest problem I continue to face is that we have a pouf in the middle of the room, which tends to be moved around (depending on where we sit and where we want leg support). Quite often it happens to be just in the line-of-sight from the blaster to the TV. The IR reflection off a white wall is not enough to trigger the TV and the set-top box.
I am curious what you designed in terms of PCB and box. If you finalize your blaster and post some details and photos online, I would appreciate getting a link to it.
cheers,
Robert