This project implements a Light-Dependent Resistor (LDR)-based binary decoder using the LiFi Concept, designed to interpret variations in light intensity and convert them into a binary sequence. The binary data is then decoded into ASCII characters, making it useful for optical communication applications.
- ๐ฅ๏ธ Microcontroller (Arduino or compatible board)
- ๐ LDR (Light Dependent Resistor)
- ๐ Resistor (appropriate value to form a voltage divider with the LDR)
- ๐ก Light Source (LED or another light-emitting device)
- ๐ Jumper Wires
- ๐ก Light Intensity Measurement: The LDR, connected to analog pin A0, continuously reads light intensity levels.
- ๐ Binary Conversion: If the intensity surpasses a defined threshold (70), it is recorded as '1'; otherwise, as '0'.
- ๐ฆ Data Storage: The system records an 8-bit sequence, which represents a character in binary format.
- ๐ Decoding: The collected binary sequence is converted into an ASCII character.
- ๐ค Output Display: The decoded character is printed on the Serial Monitor.
- ๐ข Variables:
ldrPin = A0โ Defines the analog pin for the LDR.threshold = 70โ Sets the sensitivity level for detecting light changes.size = 8โ Number of bits captured per cycle.ledDelay = 22โ Delay (ms) between consecutive bit readings.
- ๐ Continuous Monitoring:
- The LDR value is continuously recorded in an 8-bit array.
- If a predefined binary pattern (e.g.,
1011100) is detected, it is ignored. - Otherwise, the binary sequence is converted to ASCII and displayed.
helloWorld
- Upload the code to your Arduino board.
- Open the Serial Monitor (baud rate: 9600).
- Use a light source to create intensity variations.
- Observe the decoded characters appearing on the Serial Monitor.
- โ Implement error detection to improve accuracy.
- ๐ Support for continuous multi-character sequences.
- โณ Optimize timing mechanisms for better precision.
This project is open-source and can be modified or improved freely. Feel free to contribute! ๐ค
