Post Top Ad

Tuesday, June 11, 2024

Build a Wireless Communication System with This Simple Circuit


 Build a Wireless Communication System with This Simple Circuit

Li-Fi is an emerging wireless communication technology that uses visible light to transmit data.


In this instructable we make a simple Li-Fi system that can send messages from one laptop to another.


This can be used to secretly communicate with your friends in a wifi free environment.


The instructable is made for the Tu Delft course: TfCD assignment 2

2 laptops or PC's


circuit components:


2 Arduino unos


2 breadboards


1 LED


1 LDR


5 connection wires


1 10K ohm resistor


2 cable connections


optional 220-ohm resistor


Software:

Use the hardware components to build the two circuits.


Circuit one:


Circuit one is made to send data. 2 cables an Arduino, a breadboard and an LED is needed. The first picture illustrates the circuit with a resistor.


1. Connect a wire to digital port 10 and to the plus side of the LED (the longest wire is the plus side of the LED).


2. Use a wire to connect the minus side of the LED to the ground port on the Arduino.


Optional step: Add a 220 Ohm resistor to prevent the LED from overheating. Connect as illustrated in the picture.

Circuit two:


Circuit two is made to receive data. 3 cables, an LDR and a 10K ohm resistor are needed to make this circuit. The second picture illustrates the circuit.


1. Use a wire to connect the 5 volts to one side of the LDR.


2. Use a wire to connect the other side of the LDR to analog port A0.


3. Connect the 10k Ohm resistor to the side of the LDR that is connected to port A0, as illustrated in the picture.


4. Connect the other side of the 10k Ohm resistor to the breadboard.


5. Connect the non-connected side of the Ohm resistor to the ground on the Arduino.


Code one:


This code tells the Arduino to blink the led for a specific amount of time. With this code, it is possible to send two messages, because this is a simple setup you can only choose from a list of predetermined messages, but you could also make different durations correspond with the letters of the alphabet and send full messages that way, it would be wise to reduce the time to send a message in that case by editing the delay times. Since you might be in a situation with more or less light than us you might need to edit the threshold sensor value in the code. To determine what this value is, uncomment the print sensor value command and check the values ​​of the sensor when the led is on and off and take a value in between.


Copy the following code to Laptop 1.

// code for receiving using the LDR


unsigned long StartTime = millis();


unsigned long Value; unsigned long EndTime;


int Message;


boolean StartedCounting = false; //this is used to determine if the counting has started


void setup() { Serial.begin(9600); }


void loop() {


int sensorValue = analogRead(A0); //read the sensor value


delay(1); // to stabilize


// Serial.println(sensorValue); // this can be used to determine the threshold in your lighting conditions

if (StartedCounting==false && sensorValue>850){ //if the counting has not yet started and the light is on


StartTime = millis(); // This saves the current time in milli seconds


StartedCounting=true; }


if (StartedCounting== true && sensorValue<850){ // if the counting has started and the light is off


Value = millis() - StartTime; // subtract the starting time from the current time to get message time Message= Value/1000;


StartedCounting=false;


Serial.print("Message: ");


if (Message == 1){ // change these to your own messages. the sender should also have this list so they know what they send.

Code two:


This code tells the Arduino to count the number of seconds that the LDR is lit. It couples the number of seconds to a message and prints it in the serial monitor, so make sure it is open.


Copy the following code to Laptop 1.


// code for sending the message with the LED



int Message1 = 6; // set the number of the first message you want to convey


int Message2 = 2; // set the number of the second message you want to convey boolean Message1done = false; // this will be used to determine if the first message has been sent


 Build a Wireless Communication System with This Simple Circuit

Li-Fi is an emerging wireless communication technology that uses visible light to transmit data.


In this instructable we make a simple Li-Fi system that can send messages from one laptop to another.


This can be used to secretly communicate with your friends in a wifi free environment.


The instructable is made for the Tu Delft course: TfCD assignment 2

2 laptops or PC's


circuit components:


2 Arduino unos


2 breadboards


1 LED


1 LDR


5 connection wires


1 10K ohm resistor


2 cable connections


optional 220-ohm resistor


Software:

Use the hardware components to build the two circuits.


Circuit one:


Circuit one is made to send data. 2 cables an Arduino, a breadboard and an LED is needed. The first picture illustrates the circuit with a resistor.


1. Connect a wire to digital port 10 and to the plus side of the LED (the longest wire is the plus side of the LED).


2. Use a wire to connect the minus side of the LED to the ground port on the Arduino.


Optional step: Add a 220 Ohm resistor to prevent the LED from overheating. Connect as illustrated in the picture.

Circuit two:


Circuit two is made to receive data. 3 cables, an LDR and a 10K ohm resistor are needed to make this circuit. The second picture illustrates the circuit.


1. Use a wire to connect the 5 volts to one side of the LDR.


2. Use a wire to connect the other side of the LDR to analog port A0.


3. Connect the 10k Ohm resistor to the side of the LDR that is connected to port A0, as illustrated in the picture.


4. Connect the other side of the 10k Ohm resistor to the breadboard.


5. Connect the non-connected side of the Ohm resistor to the ground on the Arduino.


Code one:


This code tells the Arduino to blink the led for a specific amount of time. With this code, it is possible to send two messages, because this is a simple setup you can only choose from a list of predetermined messages, but you could also make different durations correspond with the letters of the alphabet and send full messages that way, it would be wise to reduce the time to send a message in that case by editing the delay times. Since you might be in a situation with more or less light than us you might need to edit the threshold sensor value in the code. To determine what this value is, uncomment the print sensor value command and check the values ​​of the sensor when the led is on and off and take a value in between.


Copy the following code to Laptop 1.

// code for receiving using the LDR


unsigned long StartTime = millis();


unsigned long Value; unsigned long EndTime;


int Message;


boolean StartedCounting = false; //this is used to determine if the counting has started


void setup() { Serial.begin(9600); }


void loop() {


int sensorValue = analogRead(A0); //read the sensor value


delay(1); // to stabilize


// Serial.println(sensorValue); // this can be used to determine the threshold in your lighting conditions

if (StartedCounting==false && sensorValue>850){ //if the counting has not yet started and the light is on


StartTime = millis(); // This saves the current time in milli seconds


StartedCounting=true; }


if (StartedCounting== true && sensorValue<850){ // if the counting has started and the light is off


Value = millis() - StartTime; // subtract the starting time from the current time to get message time Message= Value/1000;


StartedCounting=false;


Serial.print("Message: ");


if (Message == 1){ // change these to your own messages. the sender should also have this list so they know what they send.

Code two:


This code tells the Arduino to count the number of seconds that the LDR is lit. It couples the number of seconds to a message and prints it in the serial monitor, so make sure it is open.


Copy the following code to Laptop 1.


// code for sending the message with the LED



int Message1 = 6; // set the number of the first message you want to convey


int Message2 = 2; // set the number of the second message you want to convey boolean Message1done = false; // this will be used to determine if the first message has been sent

No comments:

Post a Comment

Post Top Ad

Pages