
Hold down boot.
Press Reset.
Release Boot.
Select the board type "Olimex ESP32-C3-Dev". Enable USB serial via Tools -> USB CDC on Boot.
// IrDA to USB Dongle
// Eirik Taylor, 04.03.2026
#include "soc/uart_struct.h"
// ESP32 C3 Super Mini on-board LED. Is active LOW
const int ledPin = 8;
HardwareSerial IrdaSerial(1);
void setup()
{
HWCDCSerial.begin(9600); // Set up USB, remember to enable USB CDC on boot
IrdaSerial.begin(9600, SERIAL_8N1, 6, 7); // Pick the IO pins to use
UART1.conf0.irda_en = 1; // Enable IrDA
UART1.conf0.irda_tx_en = 1; // Enable TX
UART1.conf0.irda_dplx = 1; // Enable RX
UART1.conf0.irda_rx_inv = 0; // RX inversion selection
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
}
void loop()
{
// IrDA transmission of USB received data
if (HWCDCSerial.available())
{
digitalWrite(ledPin, LOW);
while(HWCDCSerial.available())
{
IrdaSerial.write(HWCDCSerial.read());
}
IrdaSerial.flush();
digitalWrite(ledPin, HIGH);
}
// USB transmission of IrDA received data
while(IrdaSerial.available())
{
HWCDCSerial.write(IrdaSerial.read());
}
}
I was able to purchase an ESP32-C3 locally for the same cost as a TFDU4101 IR module alone, and coupled with some parts from my junkbox I quickly had a working prototype. The circuit is a simple high pass filter with adjustable threshold.
The idea being that ambient IR can be filtered out, meaning the threshold can be set based on dynamic response instead, which is more static (hehe). The tuning potentiometer is used to set the sensitivity and tune the pulse width at the same time. Since I only have the one IR device to test with I'm not sure if this needs adjustment for each IrDA device or if it could be set to a fixed value.
I simply placed the dive computer as far away as I could while still seeing decent pulses on the IR transistor, and then tuned the potentiometer so the threshold was roughly at this level. The use of an IR phototransistor over an photodiode was simply due to availability. The response time of the phototransistor is 15µs, which is almost as long as the entire on period for a data bit at 9600 baud.
Fortunately the filtering squares up the signal nicely, and the resulting delay between input and output is negligible in terms the total dataword length, meaning duplex communication works fine. The response time and corresponding tuning mean the circuit is only really tuned to 9600 baud and no higher. I assume lower baud rates will work fine, but I haven't tested this. More range could probably be had by dumping a charged capacitor into the transmitting LED. This appears to be how the TFDU4101 works internally. As for better reception range, I assume a faster optodevice would help greatly. The response time of the PT204-6B phototransistor is so slow that the entire pulse is over before it's had time to respond.
As for actually using the device, there are a few steps required. The makers of IrDroid have made a number of useful guides for different operating systems, and provided a driver package which works with any serial based device. I'm using this on Windows 11, so this was the process I followed: Irdroid USB irDA Transceiver Driver Install for Windows 10
Disclaimer: I do not take responsibility for any injury, death, hurt ego, or other forms of personal damage which may result from recreating these experiments. Projects are merely presented as a source of inspiration, and should only be conducted by responsible individuals, or under the supervision of responsible individuals. It is your own life, so proceed at your own risk! All projects are for noncommercial use only.
This work is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.