Back to projects

Jan. 2026 – Apr. 2026

Laser-Based Optical Transceiver

Overview

The laser-based optical transceiver is an embedded system project that creates a full-duplex lcommunication system using two ESP32 microcontrollers, C++ and other peripheral electrical components. The transceiver has 2 modes, respectively the Morse Code Mode and Serial Terminal Mode. During the morse code mode, user input is converted into timed laser pulses representing the dots and dashes of Morse code. The receiving unit detects these optical pulses and decodes them back into the corresponding characters. During the serial terminal mode, texts entered through a serial terminal are transmitted through the laser amd decoded by the receiver before being displayed on the remote terminal.

Fig. 1. laser-based optical transceiver prototype

Design

The push button serves as the mode selection when the transceiver is initially powered on. Releasing the button immediately chooses the Morse Code Mode while holding the button for over 2 seconds chooses the Serial Terminal Mode. In Morse Code Mode, the same button is used to transmit the input message. The NPN transistor acts as a switch to decide whether laser diode is activated. When the phototransistor detects an increase in light intensity caused by the laser from the other transceiver, the transceiver starts decoding the input signals into corresponding texts.

Fig. 2. laser-based optical transceiver schematic

Quick Demo

Morse Code Mode

Video 1. transceiver sends "SOH", "HTTT" and "EEEMTTTS" in order through morse code

Fig. 3. message received by the receiving transceiver

Serial Terminal Mode

Video 2. transceiver 1 sends text "hello", "how are you doing" and "testing twice" in order to transceiver 2

Video 3. transceiver 2 sends text "im good, how r u" from the serial terminal to transceiver 1

Challenges & Solutions

Receiver Response Speed

The initial R2 has a resistance of 100-kΩ, which provides high optical sensitivity at the cost of slow voltage transitions and unreliable signal detection. The resistance was reduced to 10-kΩ to improve the receiver response time and signal stability, resulting in more reliable decoding of the transmitted data.

Ambient Light Interference

Output results are inconsistent in evironments with different ambient light intensity. A black tape is wrapped around the phototransistor to reduce the impact of the ambient light. Furthermore, an automatic threshold calibration function was implemented to measure the phototransistor output under ambient light and laser illumination, then set the detection threshold to be the average of the two measured levels.

Laser Diode and Phototransistor Alignment Inconsistency

Since both laser diode and phototransistor are very small objects, they must be precisely aligned. When the two transceivers are far apart, the receiving end often fails to acquire the normal reading even when the initial alignment is done properly. A 3D-printed case made in Fusion 360 is introduced to resolve this inconsistency as shown in Figure 4. The laser diode and phototransistor are fixed by tapes from inside on the two holes reserved on the side of the case. Moreover, the case covers the messy wiring for a better overall look of the transceiver!

Fig. 4. 3D-printed enclosure in Fusion 360

Final Outcome

The final transceiver has reliable communication up to 10m range and 30% relative humidity, achiving less than 10% error rate. The transceiver's behaviour under different temperatures remains unknown as relevant tests were not conducted.

Technologies & Tools: Embedded System · ESP32 · C++ · Firmware · KiCad · Fusion 360 · Phototransistor · Transistor · Laser Diode

Expanded project image