Communiquer par la lumière

Envoyé par le 21 Juin 2016

Le Li-Fi est une technologie récente basée sur la lumière visible qui risque de connaître un véritable essor pendant les prochaines décennies. Notre projet a pour but de faire découvrir au grand public ce qu’est le Li-Fi.

Pour ce faire nous avons construit un prototype capable de transmettre de l’information grâce à la lumière. Ce système qui comprend un récepteur et un émetteur est capable de transmettre des messages textes.

L’émetteur est composé d’une LED alimentée par un ordinateur et reliée à une carte Arduino. L’utilisateur rentre une phrase qu’il veut transmettre sur l’ordinateur, le code implémenté sur la carte Arduino se charge de coder le message et de moduler l’amplitude du signal électrique reçu par la LED pour émettre ce code.

Le récepteur est composé de deux parties. Une partie composée d’une photorésistance, d’un résistor et d’un amplificateur est chargée de récupérer l’amplitude du signal lumineux ambiant. Ce système est relié à une carte Arduino qui peut extraire et traduire le message binaire contenu dans le signal lumineux.

La fréquence de fonctionnement de notre système est de deux Hertz. Ceci peut être vu comme un inconvénient du aux limitations introduites par la photorésistance. En réalité, il renforce l’aspect ludique de notre projet car l’utilisateur peut voir les alternances LED allumée/éteinte et comprend ainsi comment l’information est codée.20160607_231755Sans titrecode :

int led = 13;
int t=500;
char message[]= »SALUT COMMENT CA VA ?? »;

void setup() {
pinMode(led, OUTPUT);
}

void lireMessage(char lettre){
if(lettre==’A’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’B’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’C’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’D’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’E’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’F’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’G’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’H’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’I’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’J’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’K’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’L’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’M’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’N’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’O’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’P’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’Q’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’R’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’S’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’T’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’U’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’V’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’W’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’X’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’Y’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’Z’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’`’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’,’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’.’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’ ‘){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’?’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’!’){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’1′){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’2′){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’3′){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’4′){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’5′){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’6′){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’7′){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
}
if(lettre==’8′){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’9′){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
}
if(lettre==’0′){
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
digitalWrite(led, LOW);delay(t);
}

}

void loop() {
int i;
for(i=0 ; i< strlen(message); i++){
lireMessage(message[i]);
}
digitalWrite(led, LOW);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, HIGH);delay(t);
digitalWrite(led, LOW);delay(t);

//lireMessage(‘A’);

}

 

 

code récepteur :

 

Laisser une réponse

Votre adresse e-mail ne sera pas publiée.