![]()
Li-Fi, or Light Fidelity, is a wireless communication technology that transfers data by rapidly varying the intensity of light rather than using conventional radio-frequency signals. A photodetector at the receiving end detects these changes and converts them back into electrical data. Li-Fi is part of the broader optical wireless communication family and can use LEDs, laser diodes or other solid-state optical sources.
A simple Li-Fi link can transmit data in one direction. A bi-directional Li-Fi system, however, places both a transmitter and receiver at each endpoint, allowing data to travel in both directions.
This project presents a practical, low-cost implementation using a laser diode, BPW34 photodiode, LM393 comparator, BC547 transistor and CH9102 USB-to-UART converter. The design uses on-off keying (OOK) to represent digital data as optical pulses and a packet-based protocol to improve communication reliability. The reference implementation demonstrated a stable operating point of approximately 520kbps over a short free-space optical link.
How Bi-Directional Li-Fi Works
The basic principle is straightforward. At one end, digital data from a computer is converted into UART data. A transistor switches a laser diode according to this data, producing rapidly changing light pulses. At the other end, a photodiode detects the light and produces an electrical signal. A comparator converts this analogue signal into a digital waveform that is sent back to the computer.
For two-way communication, both ends contain the same circuitry.
BI-DIRECTIONAL Li-Fi LINK
TRANSCEIVER A TRANSCEIVER B
Computer Computer
│ │
▼ ▼
CH9102 CH9102
│ │
BC547 BC547
│ │
Laser Diode Laser Diode
│ │
└──────►► Optical ◄◄────────────┘
Channel
┌──────◄◄ ►►────────────┐
│ │
BPW34 BPW34
│ │
LM393 LM393
│ │
CH9102 CH9102
│ │
▼ ▼
Computer Computer
Thus, while Unit A is transmitting to Unit B, Unit B can subsequently transmit information back to Unit A.
Components Required
Two identical transceiver units are required for the complete bi-directional system. The following describes the principal components used in one transceiver.
| Component | Specification | Quantity | Function |
|---|---|---|---|
| CH9102 USB-to-TTL Converter | USB/UART | 1 | Provides the computer-to-circuit serial interface |
| BC547 transistor | NPN | 1 | Switches the laser diode |
| Laser diode | Approximately 650nm | 1 | Optical transmitter |
| BPW34 photodiode | PIN photodiode | 1 | Optical receiver |
| LM393 | Comparator IC | 1 | Converts received analogue signal to digital data |
| R1 | 2kΩ | 1 | Photodiode bias/current path |
| R2 | 1kΩ | 1 | Comparator output pull-up |
| VR1 | 2kΩ potentiometer | 1 | Receiver threshold adjustment |
| C1 | 0.1µF ceramic | 1 | Supply decoupling |
| Breadboard/PCB | — | 1 | Circuit assembly |
| Jumper wires | — | As required | Electrical connections |
| USB cable | — | 1 | Computer connection |
| Suitable power source | As required | 1 | Circuit power |
CH9102 USB-to-UART Converter
The CH9102 is the interface between the computer and the Li-Fi electronics. A computer sends data through USB, while the optical circuit works with serial TX and RX signals. The CH9102 performs this conversion, allowing the computer to communicate with the transmitter and receiver without requiring a separate microcontroller.
BC547 NPN Transistor
The BC547 is used as an electronic switching device. Its base is driven by the UART transmit signal, while its collector-emitter path controls the laser diode. When the digital signal changes state, the transistor switches the laser accordingly.
Laser Diode
The laser diode is the optical transmitter. Instead of sending a continuous, unmodulated beam, its optical output is rapidly switched according to the digital data. Its narrow beam makes it suitable for a point-to-point experimental link, but appropriate laser-safety precautions are essential.
BPW34 Photodiode
The BPW34 is a PIN photodiode used to detect the incoming optical signal. When light falls on its semiconductor junction, it generates photocurrent. Changes in received optical intensity therefore become changes in electrical signal.
LM393 Comparator
The photodiode does not directly produce a clean digital UART waveform. The LM393 compares the received signal with an adjustable reference voltage and converts it into a digital output suitable for the CH9102 receiver.
R1 – 2kΩ Resistor
R1 is used in the photodiode receiver circuit to establish the required bias/current path and develop a voltage associated with the photodiode’s received optical signal.
R2 – 1kΩ Resistor
The LM393 uses an open-collector output. R2 provides the required pull-up path so that the comparator output can produce the appropriate logic-level signal.
VR1 – 2kΩ Potentiometer
VR1 generates an adjustable reference voltage for the comparator. This allows the receiver threshold to be tuned according to optical alignment, distance and ambient-light conditions.
C1 – 0.1µF Capacitor
C1 provides local supply decoupling. Fast switching of the laser and digital electronics can introduce noise into the supply, and the capacitor helps suppress high-frequency disturbances.
Transmitter Circuit
The transmitter section is deliberately simple.
+V
│
Laser Diode
│
C
UART TX ─────────────B
BC547
E
│
GND
The CH9102 produces the UART TX signal. This signal drives the base of the BC547. The transistor consequently switches the laser on and off.
The system uses On-Off Keying (OOK):
Digital data: 1 0 1 1 0 0 1
Laser: ON OFF ON ON OFF OFF ON
A logic state is therefore represented by the presence or absence of optical energy. OOK is particularly attractive for a basic Li-Fi prototype because the modulation and demodulation hardware can remain relatively simple. Optical wireless communication systems commonly use intensity modulation and direct detection, with the light source carrying the information in its intensity variation.
Receiver Circuit
At the receiving end, the BPW34 detects the laser beam.
+V
│
R1
2kΩ
│
├────────► LM393 (+)
│
BPW34
│
GND
+V
│
VR1
2kΩ
│
└────────► LM393 (−)
LM393
┌─────────┐
Photodiode ────────►│ + OUT├────► RXD
Reference ────────►│ − │
└─────────┘
│
R2
1kΩ
│
+V
When the laser beam reaches the BPW34, the photodiode generates a current proportional to the received optical energy. This produces an electrical signal at the comparator input.
VR1 establishes the reference level. The LM393 compares the photodiode signal against this reference and changes its output state when the received signal crosses the threshold.
The resulting digital waveform is then fed into the CH9102 RX input.
Complete Signal Path
The entire process can be represented as:
Computer
│
▼
USB
│
▼
CH9102
│
▼
UART TX
│
▼
BC547 Driver
│
▼
Laser Diode
│
▼
Modulated Light
│
▼
Free-Space Optical Channel
│
▼
BPW34 Photodiode
│
▼
LM393 Comparator
│
▼
UART RX
│
▼
CH9102
│
▼
Computer
Data Packet Structure
The hardware establishes the physical link, but software is required to transfer files reliably.
Instead of transmitting a complete file as one continuous stream, the data is divided into smaller packets. A typical packet structure used in this type of implementation is:
┌────────┬────────┬──────────┬────────┬──────────────┬──────────┐
│ Header │ Header │ Packet # │ Length │ Data Payload │ Checksum │
│ 0xAA │ 0x55 │ │ │ │ │
└────────┴────────┴──────────┴────────┴──────────────┴──────────┘
The header helps the receiver identify the beginning of a packet. The packet number maintains sequence, while the length field identifies the amount of valid payload data.
A checksum provides a basic method for detecting corrupted packets.
The reference project uses packetised file transfer and checksum-based validation rather than simply streaming raw bytes.
Communication Sequence
Before transferring a file, the two systems establish communication using a handshake.
TRANSMITTER RECEIVER
│ │
│──── Handshake / START ──────────►│
│ │
│◄──────────── ACK ────────────────│
│ │
│────── Packet 1 ─────────────────►│
│ │
│◄──────────── ACK ────────────────│
│ │
│────── Packet 2 ─────────────────►│
│ │
│◄──────────── ACK ────────────────│
After a packet arrives, the receiver checks its structure and checksum.
Packet Received
│
▼
Checksum Test
│
┌──────┴──────┐
│ │
PASS FAIL
│ │
▼ ▼
ACK NACK
│ │
▼ ▼
Next Packet Retransmit
This approach makes the system more tolerant of occasional optical errors.
Optical Alignment
Because the prototype uses a narrow laser beam, alignment is critical.
Correct Alignment
Laser ───────────────────────► BPW34
Poor Alignment
Laser ───────────────────►
BPW34
X
The receiver must remain within the optical beam. A small change in position can significantly reduce the received optical power.
Ambient light can also affect the receiver. Sunlight, lamps and reflections may change the photodiode output and make threshold selection more difficult. The adjustable VR1 threshold provides a simple way of tuning the receiver.
Why the Prototype Does Not Use a TIA
A more sophisticated optical receiver would normally place a transimpedance amplifier (TIA) between the photodiode and comparator.
BPW34
│
▼
TIA
│
▼
Filter
│
▼
Comparator
│
▼
Digital Data
A TIA converts the photodiode’s small current into a voltage and can provide greater sensitivity and bandwidth.
The simplified prototype can avoid this additional stage because the concentrated laser beam provides sufficient received optical signal for the comparator-based receiver. This keeps the circuit inexpensive and relatively easy to construct. However, a TIA-based front end would be a logical improvement for longer-distance or higher-speed designs.
Construction and Testing
Two identical circuits are assembled and connected to computers through USB. The laser of each unit is aligned with the BPW34 on the opposite unit.
The recommended testing procedure is:
- Assemble the transmitter and receiver circuits.
- Connect the CH9102 to the computer.
- Power the circuit.
- Align the laser with the opposite BPW34.
- Adjust VR1 until the receiver reliably detects the optical signal.
- Establish the software handshake.
- Send a small test file.
- Check the received file for errors.
- Increase the data rate and distance while monitoring packet failures.
The referenced implementation identified approximately 520kbps as a dependable operating point, while higher rates could be achieved under more favourable conditions.
Improving the Design
The circuit is best regarded as a practical proof-of-concept. A commercial Li-Fi transceiver would require a significantly more sophisticated analogue and digital architecture.
Possible improvements include:
- High-speed transimpedance amplifier
- Optical band-pass filtering
- Ambient-light rejection
- Automatic gain control
- High-speed comparator
- Better laser-current driver
- More advanced modulation
- Forward-error correction
- Dedicated optical PHY
- Automatic optical alignment
An advanced receiver could therefore look like:
Optical Signal
│
▼
Photodiode
│
▼
Transimpedance Amplifier
│
▼
Filter / Equaliser
│
▼
High-Speed Comparator
│
▼
Digital PHY
│
▼
MAC / Network Interface
The technology is already moving well beyond simple laboratory prototypes. IEEE 802.11bb-2023 defines light-communication PHY and MAC operation using the 800–1000nm optical band, with specified bidirectional operation ranging from 10Mb/s to 9.6Gb/s at the MAC service access point.
Applications
A low-cost system such as this can be useful for electronics education and optical-communication experimentation. It demonstrates transistor switching, semiconductor photodetection, analogue signal conditioning, digital communication and error detection in one project.
More advanced Li-Fi technology can complement RF networks in environments where optical communication offers advantages. Potential areas include indoor networking, industrial communication, secure point-to-point links, RF-constrained environments and high-density wireless connectivity.
Li-Fi is generally considered complementary to Wi-Fi rather than a universal replacement. Its optical nature can provide directional communication and additional spatial reuse, but obstacles and optical alignment can limit coverage.
Conclusion
The bi-directional Li-Fi system demonstrates how a relatively small number of electronic components can create a complete free-space optical data link. The CH9102 connects the computer to the circuit, the BC547 switches the laser, the laser diode converts electrical data into optical pulses, the BPW34 detects those pulses and the LM393 converts the received analogue signal back into digital information.
The addition of packetisation, checksums, acknowledgements and retransmission makes the design more than a simple light-based signalling experiment. It becomes a basic two-way communication system capable of transferring digital files.
For electronics engineers and students, the project provides a useful platform for understanding the interaction between semiconductor devices, analogue circuits, digital interfaces and communication protocols. The same architecture can subsequently be developed with a transimpedance amplifier, high-speed optical front end, improved modulation and dedicated PHY technology to achieve substantially higher performance.
The most important lesson is that Li-Fi is not simply about switching a light source rapidly. A practical optical communication system requires coordinated transmitter design, optical propagation, photodetection, analogue signal conditioning, digital recovery and error management. That combination makes Li-Fi an especially interesting area for semiconductor and electronics-system development.