Universal InfraRed IoT Learning Remote

The IR-receiver circuit

For receiving IR-codes an IR-receiver-diode is used. I chose the VS1838B which is a commonly used and available part that detects 950nm light at 38kHz.The VS1838B detects the 38kHz modulated IR-message and outputs a logic-pulse.

The VS1838B detects the 38kHz modulated IR-message and outputs a logic-pulse.


The IR receiver schematic

The output of the VS1838B is send to GPIO12 of the ESP8266 that will analyse and decode and eventually store the IR-message to a file. 

On the 1of!-Solderless board it looks like this. (mind you: The final design uses IO-14 for the green LED):

A green LED (D6) is connected to GPIO14 to give some visual indication the device is waiting for an IR-message to capture.

You can find a program (IR_receiver) to test this setup on github.

Compile and flash the IR-receiver sketch to the 1of!-Wemos (or 1of!-ESP12) board and open the Serial Monitor.

The IR-sender circuit

To be able to send IR-messages we need one or more IR LED’s. Using an IR LED is no different from using a “normal” LED, except for the fact that to get some reach the IR LED’s need far more current to do their job. Since the GPIO-pins of the ESP8266 are not capable of providing these high currents we need a driver circuit. Easiest is to use an opto-coupler like the 4N35 or 4N25 which doubles as a level-shifter from 3v3 (GPIO04) and 5 Volt to drive the Gate of the MOSFET switch.

The voltage drop over the IR LED is ~1.6Volt and the maximum current is 60mA. As we are using two IR LED’s in parallel and the duty cycle is 50%, the maximum current through R7 is 60*2*2=240mA. Therefor the value of R7 is (5-1.6)/240 => ~15 Ohm. 

The IR Sender circuit

The pulses come from GPIO04. If GPIO04 is “high” the led in the optocoupler will ignite and, in turn, sets the transistor to conduct (Pulls the Emitter to 5 Volt). The 5 volt on the Emitter makes the Gate of Q1 “high” and the MOSFET now also conducts pulling the Drain to ground and so powering the two IR-LED’s (switching them “on”).

A “low” on GPIO04 switches the led in the optocoupler “off”. The transistor opens (no current flows from Collector to Emitter) and R11 pulls the Gate of Q1 to ground. The MOSFET now also does not conduct and no current will flow true the IR-LED’s (switching them “off”).

This is how it looks on the 1of!-Solderless board

Mind you: in stead of an IR LED a normal LED is used for testing and therefor the 10 ohm resister (R7) must be 220 ohm!

You can find a program (IR_sender) to test this setup on github.

Compile and flash the IR-sender sketch to the 1of!-Wemos (or 1of!-ESP12) board and open the Serial Monitor.

As the basics are working we can solder the IR-sender and IR-receiver circuitry’s to a 1of!-Proto board.

First the signal LED’s

After confirming the signal-LED’s blink solder the rest of the circuit:

I must say, the range of the IR-sender circuit is not as good as I expected. Why is my TV-remote capable of switching channels by pointing it to the opposite wall and does my IR-sender needs to be pointed exactly to my TV? So I reversed engineered two of my remotes and was surprised that they use (almost) the same circuit to drive the IR-LED’s only they have both left out the serie resister (R7)!! As I do not want to blow my IR-LED’s I have reduced R7 to only 1 ohm and that enlarged the range quite a bit!

This entry was posted in Arduino, Computer, ESP8266, Hardware, KiCAD, WiFi. Bookmark the permalink.

1 Response to Universal InfraRed IoT Learning Remote

  1. Roland says:

    Hoi Willem!

    Leuk project, ik zocht nog zo iets! Ik wil mijn airco automatiseren op basis van sensoren van de omgeving (daarnaast ook de aansturing van een luchtbevochtiger en de automatische radiatorknoppen) om zo het klimaat op mijn kantoor optimaal te houden. Ik ga er zeker naar kijken!

    Gr, Roland

Leave a Reply

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