Minimal free-space optical (FSO) digital link for 5 m indoor LOS demo using ESP32 + IR transmitter/receiver.
This implementation is intentionally scoped for a one-day prototype:
- PHY: OOK + Manchester with 38 kHz carrier bursts at default 2 kbps (VS1838B-compatible).
- Framing: preamble + sync + length + payload + CRC16.
- Robustness: adaptive thresholding on RX (EWMA baseline + hysteresis), CRC integrity checks, optional Hamming(7,4) module.
- Host tools: Python GUI for real-time RSSI proxy, BER trend, eye-like overlay, and CSV logging.
Why this design fits your goal:
- Low-cost and off-the-shelf (ESP32 + IR parts).
- Jam-resistant medium (optical LOS, narrow beam).
- Compatible with VS1838B digital IR receiver module using the same host protocol/GUI.
flowchart LR
A[Host GUI Python] <--USB Serial--> B[ESP32 TX]
A <--USB Serial--> C[ESP32 RX]
B -->|Manchester OOK IR pulses| D[IR LED + Driver]
D -->|Free-space optical channel| E[Receiver Front-end]
E -->|digital/adc sample| C
C --> F[Sync + Decode + CRC/FEC]
F --> A
firmware/common/shared protocol + optional FEC C helpersfirmware/arduino/Arduino IDE TX/RX sketches for ESP32-WROOM dev boardsfirmware/tx/ESP-IDF TX appfirmware/rx/ESP-IDF RX apphost/Python GUI + serial protocol + loggingdocs/wiring + test procedure
Detailed documentation:
docs/code_structure.mdcode architecture and data flowdocs/run_guide.mdfull setup/flash/run instructionsdocs/hardware.mdwiring and hardware sizing notesdocs/test_plan.mdvalidation and BER/range checklist
- Open
firmware/arduino/tx/tx.ino, selectESP32 Dev Module, upload to TX board. - Open
firmware/arduino/rx/rx.ino, selectESP32 Dev Module, upload to RX board. - Use
115200serial monitor baud for both.
Build TX:
cd firmware/tx
idf.py set-target esp32
idf.py build
idf.py -p COMx flash monitorBuild RX:
cd firmware/rx
idf.py set-target esp32
idf.py build
idf.py -p COMy flash monitorpip install -r requirements.txt
python host/gui_app.py- TX:
- ESP32 GPIO18 -> gate/base of LED driver transistor (through resistor)
- IR LED in series with current limit + transistor switch (driven as 38 kHz burst carrier)
- Shared GND
- RX (VS1838B):
- VS1838B VCC -> 3V3
- VS1838B GND -> GND
- VS1838B OUT -> ESP32 GPIO14 (active-low)
Follow docs/test_plan.md for:
- bench bring-up
- 1 m to 5 m BER sweep
- ambient light stress
- alignment and fallback checks
For complete operator steps from zero to demo, use docs/run_guide.md.
- Never exceed IR LED pulse current/thermal limits.
- Avoid eye exposure to high-power IR beams.
- Use current-limiting and duty-cycle guardrails in firmware.