Introduction: DIY Li-Fi Using Arduino Uno

Very simple and useful project to understand the working of Li-Fi, you can also make your own Li-Fi device with a bit more modifications to the design and code provided. You actually need two arduino's, one to send and the other to receive to make it more fun.

Step 1: ​Getting Started

Components needed

100 ohm resistor,

1 K resistor,

LED,

LDR,

Arduino Uno

Step 2: Setting Up Connections

Connect one end of 100 ohm resistor to pin number 13 and the other end to the positive terminal of led, the other end of led goes to GND pin. Also connect the ldr as shown. You can also use male to female jumper wires directly for connecting the resistor and ldr.

Step 3: Setting Up Even Light

As the ldr values depend upon the surrounding light and also led cannot emit even light I have used a small paper pipe and placed the led through one end and ldr at the other end of it.

Now you are all set to start coding.

Step 4: Code

//copy this code and start modifying

int sensorPin = A0; // select the input pin for ldr

int sensorValue = 0; // variable to store the value coming from the sensor

int light=0;

int i=0;

int d[32];

int temp=1;

int k=0; int add=0;

int a=1001;//-------------- replace with any value of your choice

void setup()

{ pinMode(13, OUTPUT); //pin connected to the relay

Serial.begin(9600); //sets serial port for communication

Serial.println(sensorPin);

int b;

while(a!=0)

{

b=a%2; //converts binary to decimal

a=a/2;

if(b==1)

{

digitalWrite(13,HIGH);

delay(2);

sensorValue=analogRead(sensorPin);

d[i]=sensorValue; }

else

{

digitalWrite(13,LOW);

delay(2);

sensorValue=analogRead(sensorPin);

d[i]=sensorValue;

}

i++;

} i--;

// for converting binary to decimal

while(i>=0)

{

if(d[i]>=75&&d[i]<700)

{

k=i;

while(k!=0)

{

temp=temp*2;

k--;

}

add=add+temp;

temp=1;

}

i--;

}

Serial.println(add); // Final recieved value gets printed

digitalWrite(13,LOW); }

void loop()

{

}

Step 5: Further Applications

You can make few changes to the code and make it work for characters and also you can use a light bulb instead of led which can give more light evenly than the led which is the actual concept of Li-Fi.

Enjoy.

Comments

author
noahdekker made it!(author)2017-03-04

does it work the whole process

author
abdulhye made it!(author)2017-02-10

please sent me the project at

abdulhye2k12@gmail.com

author
abdulhye made it!(author)2017-02-10

how can it receive data???

author
MuhammadS446 made it!(author)2017-01-05

Buddy i am in serious need of this project , the link requires premium subscription which is not possible for as i don't have Credit Card facilities.
Its really urgent and i would be extremely thankful to you if you could mail me at
ksalmanshahid@gmail.com

Best Regards!

author
Tanmoy+UnbeatableC made it!(author)2017-01-04

does not work..

author
MaxV39 made it!(author)2016-11-21

how do I make it send different information? it just sends a 14 and a 0

author
Allana37 made it!(author)2016-09-23

oi

author
FelixK14 made it!(author)2016-08-29

there is something wrong in the script: if i unplug the ldr, the serial monitor still shows my value "a"

author
UjasP2 made it!(author)2016-05-23

What is the value of capacitor used ?

author
KiloVision made it!(author)2016-03-21

FYI, visible light is not 100x faster than radio waves. Both travel at the speed of light.

author
UdayN made it!(author)2016-03-21

Yeah, it's actually the spectrum of light which is 10,000 times larger than the radio waves we use for Wi-Fi, which makes Li-Fi 100 times faster

author
ThomasK19 made it!(author)2016-03-20

I know WiFi. But what is Li-Fi?

author
UdayN made it!(author)2016-03-20

Li-Fi uses visible light to transmit data at very high speed and is 100 times faster than Wi-Fi, which uses radio frequency.

author
ThomasK19 made it!(author)2016-03-21

Hehe. 9600 baud is definitely more than 100 times slower than WiFi xD

author
UdayN made it!(author)2016-03-21

This project is just to understand the concept of Li-Fi and send some data using light and not to compete with their baud rates. But in general Li-Fi is 100 times faster than Wi-Fi.

author
ThomasK19 made it!(author)2016-03-21

I was just kidding ;-) But really, this is a light morse, rather than Li-Fi for which you would need to implement something like 802.11.

author
ThomasK19 made it!(author)2016-03-21

Ah. What sometimes is used between buildings with a laser. You probably need some special transport protocol to eliminate blackouts cause by birds?

author
ThomasK19 made it!(author)2016-03-21

To answer my own question: https://en.wikipedia.org/wiki/Li-Fi

author
DIY+Hacks+and+How+Tos made it!(author)2016-03-19

Cool Li-Fi project.

About This Instructable

19,366views

35favorites

More by UdayN:DIY Li-Fi using Arduino Uno
Add instructable to: