As an Amazon Associate we earn from qualifying purchases.
LiFi (Light Fidelity) sends information by switching a light source on and off faster than the eye can see. A receiver picks up those changes and turns them back into data. This project is a small, hands-on version of the idea: a laser beam carries data and commands, and a light dependent resistor (LDR) receives them and switches a device on or off. The video above shows the project in action.
This guide explains how the link works, what you need, how to build it and where the limits are, so you can decide whether it suits your own experiment.
What LiFi is, and how this project relates to it
Commercial LiFi systems use LED lighting and fast light sensors to move data through visible light. The principle is simple: light is either bright or dim, and that pattern represents ones and zeros.
The laser and LDR version uses the same principle on a much smaller scale. It is a learning project, not a replacement for WiFi. The data rate is low, but it shows clearly how light can carry a message from one point to another without a cable or a radio signal.
How the laser and LDR link works
The system has two sides, a transmitter and a receiver.
Transmitter
- A microcontroller (an Arduino-style board works well) holds the message or command.
- It turns a laser diode module on and off in a fixed pattern. Light on usually means 1, and light off means 0.
- Each character is sent as a short series of bits, often with a start bit so the receiver knows when a character begins.
Receiver
- An LDR is placed in a voltage divider with a fixed resistor. When the laser hits it, its resistance drops and the voltage at the middle point changes.
- A microcontroller reads that voltage on an analog pin, or a comparator turns it into a clean high or low signal.
- The program compares each reading with a threshold, rebuilds the bits into characters and acts on them.
For device switching, each command is a character. For example, one character can switch a relay on and another can switch it off. The relay then controls the lamp, fan or other load.
Parts you will typically need
- Two microcontroller boards, or one board for each side of the link
- A laser diode module (the low-power red type sold for hobby use)
- An LDR and a fixed resistor for the voltage divider
- A relay module, if you want to switch a device
- A transistor or suitable driver if your laser module draws more current than a pin can supply
- Jumper wires, a breadboard and a power supply
Step-by-step overview
- Build the transmitter. Connect the laser module to an output pin, through a driver if needed, and check that your program can switch it on and off.
- Build the receiver. Wire the LDR and resistor as a divider and connect the middle point to an analog input.
- Measure the levels. Print the analog readings with the laser on and off. Pick a threshold between the two values.
- Choose a bit time. Both sides must use the same bit duration. Start slow, then shorten it until errors appear.
- Send a test character. Transmit one letter and print what the receiver decodes. Fix timing or alignment problems before going further.
- Add the relay. Make specific characters switch the relay on or off.
Tips for a reliable link
- Aim carefully. The laser spot is small, so the LDR needs to sit exactly in the beam. A short tube or shield around the LDR helps.
- Block ambient light. Room light and sunlight change the LDR reading. Shading the sensor makes the threshold more stable.
- Use a start bit and repeat commands. This helps the receiver stay in sync and ignore random flicker.
- Calibrate the threshold. Check it again whenever lighting or distance changes.
- Keep the bit rate slow. An LDR reacts slowly, so the bit time must be longer than its response time.
Limits of using an LDR
An LDR is cheap and easy to use, but it is slow to react to changes in light. That keeps the data rate low, so this setup suits short commands rather than files or video. Real LiFi hardware uses fast photodiodes instead.
If you want a faster link, replace the LDR with a photodiode or phototransistor and keep the rest of the design the same. Other limits are worth knowing:
- The link needs a clear line of sight. Anything that blocks the beam breaks the connection.
- Light does not pass through walls, which is good for privacy but limits range inside a building.
- Bright ambient light can swamp the signal.
Safety notes
- Never point a laser at anyone’s eyes, including your own, and never at vehicles or windows. Use only low-power modules intended for hobby use.
- If the relay switches mains-powered equipment, take care with the wiring. Use an insulated enclosure, or test with a low-voltage load first, unless you are qualified to work with mains electricity.
Where to go next
Once the basic link works, you can extend it. Try sending a short text message, adding an error check, or switching several devices with different command characters. If you want to compare light with radio, see our notes on Arduino wireless data transmission.
To see another way of switching loads, look at an IR remote and relay project, which also uses light (infrared) to send commands. You can also learn how to control devices with a TV remote, or build a WiFi controlled fan and light for network-based control. If you want to log or test the messages on a computer, this guide shows how to send serial data in Python.
Frequently asked questions
Is a laser and LDR link real LiFi?
It uses the same idea, sending data by changing light, but it is a simple demonstration. Real LiFi uses LED lighting and fast sensors to reach much higher speeds.
Why use an LDR instead of a photodiode?
An LDR is cheap, simple to wire and works with an ordinary analog input. The trade-off is slow response, which limits the speed. A photodiode is the better choice if you need more speed.
How far can the data travel?
It depends on the laser, the alignment and the surrounding light. A laser beam stays narrow, so short indoor distances are the easiest place to start. Test at a short range first and increase it step by step.
Can I use an ordinary LED instead of a laser?
Yes, for short distances. An LED beam spreads out more, so you may need a lens or tube to focus it, but it is a safer light source to experiment with.