Skip to the content
2 layers32 × 48 mmDiyIrTower, the printed circuit board in 3D

Do-it-yourself infrared serial communication tower (compatible with LEGO IR serial tower)

Size
32 × 48 mm
Copper layers
2
Thickness
1.6 mm
Parts
17
Nets
13
Pads
45
Tracks, vias
53, 0
Pours
2
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
19 Apr 2024
Updated
8 Feb 2026

Overview

DiyIrTower is an open-source printed circuit board by maehw, from the maehw/DiyIrTower repository on GitHub, published under the GPL-3.0 licence. It is a 2-layer board of 32 × 48 mm with 17 parts on 13 nets, routed with 53 tracks and 0 vias.

It is built around the ATTINY13-20PU and TSAL6200. Its parts include 3 resistors, 3 diodes, 2 ICs and 2 connectors. It belongs with the interfaces and adapters boards and the AVR (ATmega, ATtiny) boards of this library.

Main components

2

README

README.md

README

Can be used as a replacement of the original LEGO IR serial tower with programs and platforms such as

to load user programs and firmware on the yellow LEGO Mindstorms RCX programmable brick.

RCX firmware download setup

Hardware

⚠️ Warning: Exposure to infrared light can cause harm to humans. Prolonged or intense exposure may lead to damage to the eyes or skin. Always use proper safety equipment when working with infrared light sources. Make sure to limit the current through the infrared TX LED!

Pin Assignment

At the heart of the DIY solution, there's an 8-pin ATtiny13A microcontroller.

Pin Assignment Table for the ATtiny13A:

IC PinPinPurposeDirectionSide of ICISP Usage
1PB5ResetUnusedLeftReset
2PB3IR_LED_TX_PINOutputLeft
3PB4PHOTO_RX_PINInputLeft
4GNDGround-LeftGND
5PB0UART_RX_PINOutputRightMOSI
6PB1UART_TX_PINInputRightMISO
7PB2IR_ACTIVITY_LED_PINOutputRightSCK
8VCCSupply Voltage (VCC)-RightVCC

The column "ISP Usage" shows what pins need to be connected for programming ("flashing") by a 6-pin AVR In-System Programmer (ISP).

Hardware Parts

  • ATtiny13A microcontroller as the "brain" (calibrated internal 9.6 MHz oscillator as clock source; other uCs such as the ATtiny85 may work as they have more SRAM and more flash memory, but timing values will need to be adjusted)
  • Vishay Semiconductors TSOP4338 or TSOP4838 38 kHz infrared receiver (others 38 kHz infrared receivers may work)
  • Vishay Semiconductors TSAL6200 940 nm infrared TX LED (others 940 nm infrared TX LEDs may work)

If you've built a working DiyIrTower yourself with these or different parts, please let me know! The first design has used the TSOP4338. As it's not available everywhere, it has also been tested to work with the TSOP4838.

In my case, the circuitry is powered by a USB/serial converter cable which is also used to transfer the data over a virtual COM port (USB CDC interface). Please note that the converter cable of choice uses TTL voltage levels and not RS-232!

Classic Breadboard

For the breadboard version see the image at the top. The Fritzing breadboard diagram looks as follows (please also pay attention to the hints inside the image):

Fritzing breadboard diagram

Solder Breadboard

An alternative would be a solder breadboard to make something semi-permanent (the green activity LED is hidden in the next photo between the jumper wires of the USB/serial converter cable):

Solder breadboard top

Solder breadboard bottom

CAD PCB with KiCAD

Since January 2026, there's a KiCAD project with all necessary files (i.e. schematic, PCB layout, pre-generated Gerber files). So instead of putting the components together on a breadboard, a PCB can be ordered. At the time of writing, some prototype PCBs (Rev. 1.0) have been ordered. But I cannot guarantee, that the design is free of bugs.

PCB (front) without components

PCB (back) without components

PCB (front) with THT components

I've decided to keep through-hole components, as they are easier to solder for beginners. It may make sense to add a DIP8 IC socket for the uC. The power and activity LEDs (and their resistors) are optional, as is the ISP header for initially flashing the IC. So a setup with the minimum of components would look like this:

PCB (front) with minimum of THT components

By the way, I'd choose a rectangular connector for J1. Also, you'll have to bend the TX photo diode D2 sideways, so that it points to the same side as the IR receiver IC.

Firmware

Find the productive firmware in folder ./firmware.

Prerequisites

  • GNU C cross-compiler for AVR 8-bit gcc-avr (other build toolchains may work as well)
  • avrdude: program for downloading and uploading the on-chip memories of AVR microcontrollers (or another similar tool)

Build

To build, run:

shell
avr-gcc -g -Wall -Os -mmcu=attiny13a -o main.elf main.c

(Append the verbosity flag -v to see what's going on behind the scenes.)

Want to check if it will it fit into the internal flash?

shell
avr-size main.elf
   text	   data	    bss	    dec	    hex	filename
    776	      0	      7	    783	    30f	main.elf

Make sure to burn the microcontrollers fuses so that

  • the calibrated internal 9.6 MHz oscillator is selected
  • clock pre-scaler set to 1 (device is shipped with CKDIV8 programmed).

Reading fuses with avrdude (and in this case an ehajo-isp in-system programmer):

shell
avrdude -c ehajo-isp -p t13a -U hfuse:r:-:h -U lfuse:r:-:h

The default values for the two fuse bytes of the ATtiny13A are 0xff (high), 0x6a (low). The required settings however are: 0xff (high), 0x7a (low). Writing fuses with avrdude:

shell
avrdude -c ehajo-isp -p t13a -U hfuse:w:0xff:m -U lfuse:w:0x7a:m

(Hint: If the avrdude version being used gives "avrdude: AVR Part "t13a" not found.", try using t13 instead of t13a.)

Finally, flash the firmware:

shell
avrdude -c ehajo-isp -p t13a -U flash:w:main.elf:e

Test firmware

Please note that under ./test/firmware, there are some more code files to test the assembled hardware. The commands from above can be reused, only the filename needs to be changed.

blink.c will blink the activity indication LED and hence allow to check if the LED is working and the compilation and flashing mechanisms also work.

pulsed_ir_tx.c will blink the activity indication LED and also transmit modulated infrared light at 38 kHz for 0.5 seconds and then switch the transmitter off for another 0.5 seconds. This allows to check if the fuse bytes have been set correctly or the blinking is way slower and the default CKDIV8 may not have been overwritten.

serial_echo.c will echo the serially received UART characters. Please note that this example does not make use of any uC UART peripheral but only relies upon GPIO pin edge detection on the "UART" receive pin. This can be used with any terminal emulator that works with serial devices or with the Python script /test/scripts/serial_coms.py to send and receive binary data:

shell
$ python serial_coms.py -h
usage: serial_coms.py [-h] serial_device data_to_send

Send binary data over serial and receive response.

positional arguments:
  serial_device  Name of the serial device (e.g., '/dev/ttyUSB0')
  data_to_send   Binary data to send in HEX format (e.g., '55FF00609F609F')

options:
  -h, --help     show this help message and exit

Example:

shell
$ python serial_coms.py /dev/ttyUSB0 11223344
[TX] 11 22 33 44 
[RX] 11 22 33 44

The same four bytes should be received that also have been transmitted before - just as you'd expect from an echo application! Check the command line output!

Design details

The following timing diagram shows four signals from top to bottom:

  • UART_TX_PIN: the UART transmit (=TX) signal - as sent by the PC, coming from the attached USB/serial converter
  • IR_LED_TX_PIN: the modulated infrared transmit signal on the IR TX LED, on–off keying (OOK) modulated at 38 kHz, 38 kHz carrier is active during low periods of UART_TX_PIN
  • PHOTO_RX_PIN: the signal on the (already demodulated) infrared receiver
  • UART_RX_PIN: the UART receive (=RX) signal - as sent by the DIY IR tower to the USB/serial converter

Timing diagram

The diagram shows the message 0x55 0xFF 0x00 0x10 0xEF 0x10 0xEF being sent from the PC to the RCX (left half). It also shows the response from the RCX to the PC: 0x55 0xFF 0x00 0xEF 0x10 0xEF 0x10 (right half).

In the left half one can also see that the signal transmitted by the DIY IR tower is reflected and directly received by itself. This is due to the arrangement of IR TX LED and IR receiver - and afair can also be seen with the original IR towers. This "echo effect" must/can be handled in software!

Zooming in (less time for the same screen width) reveals the delays between the signals:

Timing diagram with details

Disclaimer

LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this project.

Parts

17
QtyValueFootprintReferences
3680Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR1, R2, R3
2brick-1x4brick-4_9id-6_0od:brick-1x4MH, MH
1ACT LEDLED_THT:LED_D3.0mmD1
1ATtiny13-20PPackage_DIP:DIP-8_W7.62mmU1
1AVR-ISP-6Connector_IDC:IDC-Header_2x03_P2.54mm_VerticalJ2
1Conn_01x05Connector_PinSocket_2.54mm:PinSocket_1x05_P2.54mm_VerticalJ1
1LOGOIrLed:Danger_4mmG***
1LOGOIrLed:DontStareIntoLight_9.0mmG***
1POWER LEDLED_THT:LED_D3.0mmD3
1SolderJumper_3_Bridged12Jumper:SolderJumper-3_P1.3mm_Bridged2Bar12_RoundedPad1.0x1.5mmJP1
1TSAL6200IrLed:LED_D5.0mm_IRBlueD2
1TSOP43xxOptoDevice:Vishay_MOLD-3PinU2

The 15 most common of 17 parts.

Similar boards

  • 2 layers45 × 29 mmIM100 Override, the printed circuit board in 3D

    IM100 Override

    pointcheck/IM100_Override

    Paslode IM100C vendor lock-in override

    20 parts7MIT
  • 4 layers112 × 72 mmDk spot welder, the printed circuit board in 3D

    Dk spot welder

    sini6a/spotwelder

    An easy-to-assemble, through-hole spot welder capable of switching high currents for welding nickel strip to lithium-ion cells. Controlled by an ATtiny13 microcontroller.

    51 parts3
  • 2 layers117.5 × 28.3 mmTrasser, the printed circuit board in 3D

    Trasser

    dmitry131131/Trasser

    Трассерная насадка для игры в страйкбол. Подсвечивает специальные трассирующие шары при вылете из ствола при помощи УФ подсветки, а также иммитирует вспышку выстрела.

    30 parts1
  • 2 layers100 × 100 mmAS NES Mapper474-SM1, the printed circuit board in 3D

    AS NES Mapper474-SM1

    Akerasoft/AS-NROM-368

    Mapper 474 - Submapper 1 - NROM-368

    17 parts
  • 2 layersMoodeAudio, the printed circuit board in 3D

    MoodeAudio

    DmaEvilCorp/MoodeAudioBuild

    Case Hammond 1455T2202BK (220x165x51.5mm) black aluminium. Front and back are in plastic, much easier for working. I've used FrontPanel from Schaeffer to make the design.

    13 partsGPL-3.0
  • 6 layers73 × 50 mmSoft starter, the printed circuit board in 3D

    Soft starter

    Susensio/soft-starter

    Arduino project for soft start led strips, imitating incandescent bulbs

    24 parts
  • 2 layers17.8 × 20.3 mmATtiny PCB, the printed circuit board in 3D

    ATtiny PCB

    wiredlab/attiny13-breakout

    ATtiny13A breakout board

    8 parts

Questions

How big is the DiyIrTower PCB?

It measures 32 × 48 mm and has 2 copper layers, 1.6 mm thick.

What parts does the DiyIrTower use?

17 parts, built around the ATTINY13-20PU and TSAL6200. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the DiyIrTower KiCad files?

From the maehw/DiyIrTower repository on GitHub, at the commit this page was made from: the board is pcb/DiyIrTower.kicad_pcb and its schematic pcb/DiyIrTower.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the DiyIrTower design in my own project?

Its repository publishes it under the GPL-3.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).