Skip to content

Prototype for Light based communication between devices

Notifications You must be signed in to change notification settings

PrajwalUlli/LiFi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

15 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒŸ LDR-Based Binary Decoder: LiFi

๐Ÿ“Œ Overview

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.

๐Ÿ”ง Components Used

  • ๐Ÿ–ฅ๏ธ 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

Receiver Schematic

๐Ÿ› ๏ธ How It Works

  1. ๐Ÿ“ก Light Intensity Measurement: The LDR, connected to analog pin A0, continuously reads light intensity levels.
  2. ๐Ÿ“ Binary Conversion: If the intensity surpasses a defined threshold (70), it is recorded as '1'; otherwise, as '0'.
  3. ๐Ÿ“ฆ Data Storage: The system records an 8-bit sequence, which represents a character in binary format.
  4. ๐Ÿ” Decoding: The collected binary sequence is converted into an ASCII character.
  5. ๐Ÿ“ค Output Display: The decoded character is printed on the Serial Monitor.

๐Ÿ–ฅ๏ธ Code Explanation

  • ๐Ÿ”ข 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.

๐Ÿ“Š Example Serial Output

helloWorld

๐Ÿš€ How to Use

  1. Upload the code to your Arduino board.
  2. Open the Serial Monitor (baud rate: 9600).
  3. Use a light source to create intensity variations.
  4. Observe the decoded characters appearing on the Serial Monitor.

๐Ÿ”ฎ Future Enhancements

  • โœ… Implement error detection to improve accuracy.
  • ๐Ÿ”„ Support for continuous multi-character sequences.
  • โณ Optimize timing mechanisms for better precision.

๐Ÿ“œ License

This project is open-source and can be modified or improved freely. Feel free to contribute! ๐Ÿค

About

Prototype for Light based communication between devices

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages