Projects Research & Design Hub

Build an IR-Based LEGO Train Controller (Part 1)

Figure 1 First prototypes used Heltec’s ESP8266 MCU with display, a Vishay TSAL6200 IR LED and a TSOP38538 IR demodulator to transmit and receive the LEGO Power Function (LPF) RC protocol.
Written by Jeff Bachiochi
Near-Wavelength IR in Action Near-wavelength IR is a technology we use every day, but how it actually works in an embedded control application is fascinating. Jeff explains. He then makes use of LEGO’s sets of electronic components and other devices to build an IR-based controller for LEGO IR remote-controlled trains. Topics Discussed How does NR IR work in an embedded control application?How to build an IR-based controller for LEGO IR RC trains. Tech Used Heltec's HTIT-W8266 (WiFi-Kit-8) Espressif Systems' ESP 8266M5Stack's Atom module, I2C display, I2C joystick and IR transmitterTSAL6200, IR LED and TSOP38538 receiver from Vishay When we deal with communication, especially with wireless comms, we normally want it to reach as far as possible. That includes passing through walls and other objects. Infrared (IR) light is invisible to our eyes, but we can think of it as part of the visible light spectrum because it is reflected off objects just as the rainbow of colors we can see. (A portion of the IR spectrum overlaps with the visible spectrum.) As discussed in my article “How Gun-Style IR Thermometers Work (Part 1)” (Circuit Cellar 374, September, 2021) [1], the IR region of the spectrum is sub-divided into five parts. That series concerned non-contact temperature sensing at one end of the region—the long-wavelength IR (LIR). This project moves to near-wavelength IR (NIR), just below visible red in the spectrum. You probably use this kind of IR every day, since most television/cable remotes use NIR. Radiated IR can fill a room by bouncing off the walls. Most hand-held remotes use an IR LED (940nm) as a transmitter. A sensor on the video equipment receives remote commands and decodes them into operations such as “change the channel” or “turn up the volume.” Each manufacturer has its own data format. I’ll be discussing one particular format, but this project has nothing to do with those remotes usually hiding between you
Become a Member or Log In to read the rest of this content.

Supporting Companies

Upcoming Events


Copyright © KCK Media Corp.
All Rights Reserved

Copyright © 2026 KCK Media Corp.

Build an IR-Based LEGO Train Controller (Part 1)

by Jeff Bachiochi time to read: 15 min