Monday, 6 February 2017

Arduino simple visible light communication-The first week


Li-fi (Arduino simple visible light project) targets to transmit data through light. It is a method of wireless information communication within limited area. In this project, arduino and circuits built on arduino are required to achieve this. The system is seperated into two sides, the emitter side and the receiver side. The emitter side, obviously, has the function to convert the input words (all words should be within the range of ASCII code) into binary type. And this binary data can be represented by the on/off  of the small LED. The receiver side receives data illustrated by LED and converts into ASCII according to ASCII code. In this way, visible light is used as the medium to transmit data.


As it is the first week to conduct experiment, we first determined the material required to conduct the experiment. And then, we tried to program the code of the emitter side and set up the simple circuit of the emitter side. The program succeed to split input string into separated characters and illustrated by LED which is part of the work that the emitter should do.


Components
Arduino Uno*2
LED(several)
Photo diode (several)

Two arduino Uno are required as the emitter and receiver part respectively. Arduino IDE 1.8.1 are used as the algorithm to program. LED with various colors are studied because they have various wavelength. Resistors with various resistance are necessary to control current to prevent the broke-down of LED.

Code and experiment photo



String incoming;   // for incoming serial data

void send_one_char(char single){
  
}

void setup() {
    Serial.begin(9600);  // opens serial port, sets data rate to 9600 bps
    pinMode(2,OUTPUT);
}

void loop() {

    // send data only when you receive data:
    if (Serial.available() > 0) {
            // read the incoming byte:
            char incoming = Serial.read();
            // say what you got:
            int i;
            for (i = 0; i < 8; i ++){
              if(incoming & 0x80){
                Serial.print(1);
                digitalWrite(2,HIGH);
              }else{
                Serial.print(0);
                digitalWrite(2,LOW);
              }
              incoming = incoming << 1;
              delay(500);
            }
            Serial.println(".");      

    }
}

No comments:

Post a Comment