All work

In-house R&D

Sending data through light.

A low-cost, bidirectional fibre-optic link that carries digital data, and digital audio, between two ESP32 nodes over 1 m of TOSLINK plastic optical fibre: a 650 nm KY-008 laser into a BPW34 photodiode, recovered through a discrete analogue front end and the ESP32’s hardware pulse counter.

The transceiverTwo ESP32 nodes, a KY-008 laser transmitter and BPW34 receiver, an OPA356 TIA with a TLV3501 comparator, and 1 m of TOSLINK fibre.
650nm
KY-008 laser diode transmitter
BPW34
Vishay PIN photodiode receiver
OPA356
200 MHz TIA, Rf 22 kΩ
TLV3501
4.5 ns rail-to-rail comparator
128kbps
Sustained, 640 kbps peak
1m
TOSLINK plastic optical fibre

How it works

Each byte is framed (a 0x7E start byte, length, payload and XOR checksum) and sent as on-off keying: the ESP32 switches a 650 nm KY-008 laser through a 2N2222A driver, coupled into 1 m of TOSLINK fibre. At the far end a reverse-biased BPW34 photodiode feeds an OPA356 transimpedance amplifier (Rf 22 kΩ, Cf 2.2 pF) and a TLV3501 comparator with 100 kΩ Schmitt-trigger hysteresis. The recovered edges are counted by the ESP32’s PCNT hardware pulse counter over 100 ms windows (1 µs glitch filter) on GPIO34. A separate Bluetooth A2DP path streams audio through a MAX98357A I²S amplifier.

What we built

  • A custom two-layer PCB carrying both transceiver nodes, designed in EasyEDA and fabricated by JLCPCB
  • Transmitter and receiver firmware in C++ (Arduino, ESP32) with a framed, XOR-checked protocol
  • CAD-modelled, 3D-printed PLA optics for the laser, BPW34 photodiode and TOSLINK ferrule (roughly six iterations)
  • A 2.8″ ILI9341 touchscreen UI (XPT2046 touch) showing live telemetry and recovered text
  • End-to-end characterisation: DC levels, comparator swing and a PCNT data-rate sweep (8 to 640 kbps)

The initial transceiver circuit.

Before any boards were fabricated, the whole optical link began on breadboards: an ESP32 driving the 650 nm laser on one side, and a BPW34 photodiode feeding the OPA356 transimpedance amplifier and TLV3501 comparator on the other, with live telemetry and Bluetooth pairing on an ILI9341 touchscreen. This is the prototype we characterised (DC levels, timing and the data-rate sweep) before committing the design to a fabricated PCB.

Adapters we designed & printed.

CAD-modelled and 3D-printed in PLA across roughly six iterations, coupling the KY-008 laser, BPW34 photodiode and TOSLINK ferrule and holding them in precise alignment. Mechanical alignment of this free-space coupling, plus shielding the photodiode from ambient light, proved to be the dominant factor in link stability.

Drag to rotate

The final 3D-printed optical adapter

What the link actually does.

Demonstrated

Bidirectional binary text was sent end to end across the 1 m TOSLINK link and shown live on the receiver’s touchscreen and the host serial monitor, with 1,000-packet integrity tests passing at 8, 64 and 128 kbps. The PCNT sweep held a stable 128 kbps under hand-held alignment and briefly peaked at 640 kbps in a dark room. On the populated PCB the comparator swung a clean 3.3 V to 0.05 V, fast enough to read with digitalRead().

Honest limits

Those rates reflect hand-held fibre alignment rather than the 7.2 MHz closed-loop bandwidth the front end can support. A Bluetooth A2DP path (MAX98357A I²S amp) reproduces tones and voice-band audio over the link; wide-band music stays partial, limited by the 8 kHz firmware sample rate. Residual comparator spikes traced to SOIC solder joints and ambient-light pickup at the BPW34 are the next revision’s targets.