Ready when you are.
A brand-new website, a network rebuild, a custom board or a tricky hardware fault, drop us a line and we'll respond within one working day. Quotes are free.
info@nyna.co.ukA 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. BEng Electronic Engineering, Royal Holloway, University of London. Supervisor: Dr Shyqyri Haxha.
Each byte is framed (0x7E start · length · payload · 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.
Before any boards were fabricated, the whole optical link began on breadboards, an ESP32 driving the 650 nm laser on one side; a BPW34 photodiode feeding the OPA356 transimpedance amplifier and TLV3501 comparator on the other, with live telemetry and Bluetooth pairing surfaced on an ILI9341 touchscreen. This is the prototype I characterised, DC levels, timing and the data-rate sweep, before committing the design to a fabricated PCB.
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.
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 / 0.05 V, fast enough to read with digitalRead().
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.
A brand-new website, a network rebuild, a custom board or a tricky hardware fault, drop us a line and we'll respond within one working day. Quotes are free.
info@nyna.co.uk