Manufaturação industrial
Internet das coisas industrial | Materiais industriais | Manutenção e reparo de equipamentos | Programação industrial |
home  MfgRobots >> Manufaturação industrial >  >> Manufacturing Technology >> Processo de manufatura

Transmissão de Dados a Laser sem Fio (LiFi) – Visão Geral de Desempenho a 100 b/s

Componentes e Materiais

Arduino Nano R32
Protoboard Grande Sem Solda2
Display LCD Alfanumérico 16x22
Jumpers (Genéricos)30
Teclado Matricial 4x31
Bateria 9V (Genérica)2
Conector de Bateria 9V2
Diodo Laser, 2 Pinos1
Célula Solar (Kit de Desenvolvimento)1
Potenciômetro Rotativo (Genérico)2
Resistor 10k Ω3

Ferramentas e Máquinas Necessárias

Ferro de Solda (Genérico)
Fio de Solda, Livre de Chumbo

Aplicativos e Serviços Online

Arduino IDE

Sobre este Projeto

Transmissão de Dados a Laser sem Fio (LiFi) – Visão Geral de Desempenho a 100 b/s
Transmissão de Dados a Laser sem Fio (LiFi) – Visão Geral de Desempenho a 100 b/s

Este projeto consiste em duas partes: o emissor e o receptor. Permite enviar textos via laser usando um teclado matricial e um display LCD.

Código

Código do Transmissor LiFi V 2.0 (C/C++)

/*LI-FI Transmitter Code V 2.0 Written By HOUALEF AHMED RAMZI Started on 29-9-2020 Last Update on 14-10-2020 */
#define LaserPin 2
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 6, d5 = 5, d6 = 4, d7 = 3;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int incomingchar;
int KeyPad_R[] = {A2, A1, 9, 7}; // Linhas do Teclado
int KeyPad_C[] = {8, 10, A3}; // Colunas do Teclado
int KeyReturn = 0; // Saída da Função Teclado de 1-12
int ABC = 0; // Variável para codificar 3 caracteres usando um botão
int Row = 0; // Variável usada na função Teclado
int Column = 0; // Variável usada na função Teclado
int StCursor = 0; // Variável para controle do cursor
int NdCursor = 0; // Variável para controle do cursor
int outcomingmatrix[32][5]; // Buffer de DADOS
int m = 0; // Variável para saber o comprimento do outcomingmatrix e evitar enviar todo o buffer vazio de 32*5
// Base de dados para armazenar todos os caracteres codificados (5 bits cada)
int A[] = {1, 1, 1, 1, 0}, B[] = {0, 0, 0, 1, 0}, C[] = {0, 0, 0, 1, 1}, D[] = {0, 0, 1, 0, 0}, E[] = {0, 0, 1, 0, 1}, F[] = {0, 0, 1, 1, 0}, G[] = {0, 0, 1, 1, 1}, H[] = {0, 1, 0, 0, 0};
int I[] = {0, 1, 0, 0, 1}, J[] = {0, 1, 0, 1, 0}, K[] = {0, 1, 0, 1, 1}, L[] = {0, 1, 1, 0, 0}, M[] = {0, 1, 1, 0, 1}, N[] = {0, 1, 1, 1, 0}, O[] = {0, 1, 1, 1, 1}, P[] = {1, 0, 0, 0, 0};
int Q[] = {1, 0, 0, 0, 1}, R[] = {1, 0, 0, 1, 0}, S[] = {1, 0, 0, 1, 1}, T[] = {1, 0, 1, 0, 0}, U[] = {1, 0, 1, 0, 1}, V[] = {1, 0, 1, 1, 0}, W[] = {1, 0, 1, 1, 1}, X[] = {1, 1, 0, 0, 0};
int Y[] = {1, 1, 0, 0, 1}, Z[] = {1, 1, 0, 1, 0}, SPACE[] = {1, 1, 1, 1, 1};

void setup() {
  lcd.begin(16, 2);
  pinMode(LaserPin, OUTPUT);
  Serial.begin(9600);
  for (int i = 0; i < 4; i++) { pinMode(KeyPad_R[i], OUTPUT); }
  for (int j = 0; j < 3; j++) { pinMode(KeyPad_C[j], INPUT); }
  lcd.print("HOUALEF RAMZI");
  delay(5000);
  lcd.clear();
  lcd.setCursor(0,0);
}

void conv(int alpha[5], char Char) { // PREENCHE O BUFFER DE SAÍDA DA BASE DE DADOS
  for (int i = 0; i < 5; i++) { outcomingmatrix[m][i] = alpha[i]; }
  lcd.print(Char);
}

void start_bit() { // BIT DE INÍCIO
  digitalWrite(LaserPin, HIGH);
  delay(9);
  digitalWrite(LaserPin, LOW);
}

void KeyPad() { // RETORNA O NÚMERO DO BOTÃO PRESSIONADO DE 1 A 12
  for (int i = 0; i < 4; i++) {
    digitalWrite(KeyPad_R[i], HIGH);
    for (int j = 0; j < 3; j++) {
      if (digitalRead(KeyPad_C[j]) == 1) {
        Row = i; Column = j;
        digitalWrite(KeyPad_R[i], LOW);
        if (Row == 0) { switch (Column) { case 0: KeyReturn = 1; break; case 1: KeyReturn = 2; break; case 2: KeyReturn = 3; break; } }
        if (Row == 1) { switch (Column) { case 0: KeyReturn = 4; break; case 1: KeyReturn = 5; break; case 2: KeyReturn = 6; break; } }
        if (Row == 2) { switch (Column) { case 0: KeyReturn = 7; break; case 1: KeyReturn = 8; break; case 2: KeyReturn = 9; break; } }
        if (Row == 3) { switch (Column) { case 0: KeyReturn = 10; break; case 1: KeyReturn = 11; break; case 2: KeyReturn = 12; break; } }
      }
    }
  }
  Serial.println(KeyReturn);
}

void KeyToAscii(int KeyN, int FirtAsciiValue) { // CONVERTE DADOS DO TECLADO PARA VALOR ASCII
  if (KeyReturn == KeyN) {
    incomingchar = FirtAsciiValue + ABC;
    ABC++; if (ABC == 3) { ABC = 0; }
  }
}

void CursorControler() {
  lcd.setCursor(StCursor, NdCursor);
  if (KeyReturn == 10) { // BOTÃO CONFIRMAR (11 no teclado)
    delay(100); StCursor++; m++;
  }
  if (StCursor == 16) { // ESCREVE NA NOVA LINHA QUANDO A PRIMEIRA ESTÁ CHEIA
    StCursor = 0; NdCursor = 1;
  }
}

void loop() {
  KeyPad(); delay(150); CursorControler();
  KeyToAscii(1, 65); KeyToAscii(2, 68); KeyToAscii(3, 71); KeyToAscii(4, 74); KeyToAscii(5, 77);
  KeyToAscii(6, 80); KeyToAscii(7, 83); KeyToAscii(8, 86); KeyToAscii(9, 89); KeyToAscii(11, 32);
  switch (incomingchar) {
    case 65: conv(A, 'A'); break; case 66: conv(B, 'B'); break; case 67: conv(C, 'C'); break;
    case 68: conv(D, 'D'); break; case 69: conv(E, 'E'); break; case 70: conv(F, 'F'); break;
    case 71: conv(G, 'G'); break; case 72: conv(H, 'H'); break; case 73: conv(I, 'I'); break;
    case 74: conv(J, 'J'); break; case 75: conv(K, 'K'); break; case 76: conv(L, 'L'); break;
    case 77: conv(M, 'M'); break; case 78: conv(N, 'N'); break; case 79: conv(O, 'O'); break;
    case 80: conv(P, 'P'); break; case 81: conv(Q, 'Q'); break; case 82: conv(R, 'R'); break;
    case 83: conv(S, 'S'); break; case 84: conv(T, 'T'); break; case 85: conv(U, 'U'); break;
    case 86: conv(V, 'V'); break; case 87: conv(W, 'W'); break; case 88: conv(X, 'X'); break;
    case 89: conv(Y, 'Y'); break; case 90: conv(Z, 'Z'); break; case 32: conv(SPACE, ' '); break;
    case 33: conv(SPACE, ' '); break;
  }
  if (KeyReturn == 12) { // BOTÃO ENVIAR (12 no teclado)
    delay(100);
    for (int j = 0; j < m; j++) {
      start_bit();
      for (int i = 0; i < 5; i++) { digitalWrite(LaserPin, outcomingmatrix[j][i]); delay(10); }
      digitalWrite(LaserPin, LOW); delay(20);
    }
    for (int k = 0; k < 32; k++) { for (int l = 0; l < 5; l++) { outcomingmatrix[k][l] = 0; } }
  }
  incomingchar = 0; KeyReturn = 0;
}

Código do Receptor LiFi V 2.0 (C/C++)

/*LI-FI Receiver Code V 2.0 Written By HOUALEF AHMED RAMZI Started on 29-9-2020 Last Update on 14-10-2020 */
#include <LiquidCrystal.h>
#define SolarCell A0 // Pino de entrada da célula solar
int StCursor = 0; // Controle do cursor do LCD
// Base de dados dos caracteres (mesma do transmissor)
int A[] = {1, 1, 1, 1, 0}, B[] = {0, 0, 0, 1, 0}, C[] = {0, 0, 0, 1, 1}, D[] = {0, 0, 1, 0, 0}, E[] = {0, 0, 1, 0, 1}, F[] = {0, 0, 1, 1, 0}, G[] = {0, 0, 1, 1, 1}, H[] = {0, 1, 0, 0, 0};
int I[] = {0, 1, 0, 0, 1}, J[] = {0, 1, 0, 1, 0}, K[] = {0, 1, 0, 1, 1}, L[] = {0, 1, 1, 0, 0}, M[] = {0, 1, 1, 0, 1}, N[] = {0, 1, 1, 1, 0}, O[] = {0, 1, 1, 1, 1}, P[] = {1, 0, 0, 0, 0};
int Q[] = {1, 0, 0, 0, 1}, R[] = {1, 0, 0, 1, 0}, S[] = {1, 0, 0, 1, 1}, T[] = {1, 0, 1, 0, 0}, U[] = {1, 0, 1, 0, 1}, V[] = {1, 0, 1, 1, 0}, W[] = {1, 0, 1, 1, 1}, X[] = {1, 1, 0, 0, 0};
int Y[] = {1, 1, 0, 0, 1}, Z[] = {1, 1, 0, 1, 0}, SPACE[] = {1, 1, 1, 1, 1};
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
int Cell_Input; // Entrada da Célula Solar
int Threshold; int info[5]; // DADOS RECEBIDOS
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  pinMode(A0, INPUT); Serial.begin(9600);
  lcd.begin(16, 2); lcd.setCursor(0, 0);
  Threshold = analogRead(SolarCell) + 10;
  lcd.print("PRONTO PARA RECEBER"); delay(5000); lcd.clear();
}

void BufferClear() { for (int i = 0; i < 5; i++) { info[i] = 0; } }

void check_condition(int received_bits[5], int Binaryalpha[5], char Lcdalpha) {
  if (received_bits[0] == Binaryalpha[0] && received_bits[1] == Binaryalpha[1] && received_bits[2] == Binaryalpha[2] && received_bits[3] == Binaryalpha[3] && received_bits[4] == Binaryalpha[4]) {
    lcd.print(Lcdalpha); CursorControler();
  }
}

void CursorControler() { StCursor++; if (StCursor == 16) lcd.setCursor(0, 1); }

void loop() {
  Cell_Input = analogRead(SolarCell);
  if (Cell_Input > Threshold) { // Detecção do bit de início
    delay(10); // Temporização
    for (int i = 0; i < 5; i++) { // Salva dados
      if (analogRead(SolarCell) > Threshold) { info[i] = 1; } else { info[i] = 0; }
      delay(10);
    }
    check_condition(info, A, 'A'); check_condition(info, B, 'B'); check_condition(info, C, 'C');
    check_condition(info, D, 'D'); check_condition(info, E, 'E'); check_condition(info, F, 'F');
    check_condition(info, G, 'G'); check_condition(info, H, 'H'); check_condition(info, I, 'I');
    check_condition(info, J, 'J'); check_condition(info, K, 'K'); check_condition(info, L, 'L');
    check_condition(info, M, 'M'); check_condition(info, N, 'N'); check_condition(info, O, 'O');
    check_condition(info, P, 'P'); check_condition(info, Q, 'Q'); check_condition(info, R, 'R');
    check_condition(info, S, 'S'); check_condition(info, T, 'T'); check_condition(info, U, 'U');
    check_condition(info, V, 'V'); check_condition(info, W, 'W'); check_condition(info, X, 'X');
    check_condition(info, Y, 'Y'); check_condition(info, Z, 'Z'); check_condition(info, SPACE, ' ');
    BufferClear();
  }
}

Esquemáticos

Receptor (Célula Solar + LCD): A célula solar deve ficar frente a frente com o laser para receber dados.

Transmissão de Dados a Laser sem Fio (LiFi) – Visão Geral de Desempenho a 100 b/s

Transmissor (Teclado + LCD + Laser): O usuário escolhe o que enviar usando o teclado e o LCD; após digitar cada letra, pressiona o botão confirmar e, por fim, o botão enviar.

Transmissão de Dados a Laser sem Fio (LiFi) – Visão Geral de Desempenho a 100 b/s

Processo de manufatura

  1. Guia Especializado de Marcação a Laser em Alumínio: Precisão, Durabilidade e Aplicações Industriais
  2. Guia Completo de Marcação a Laser: Tipos, Benefícios e Aplicações
  3. Marcação a Laser por Fibra: Precisão, Velocidade e Versatilidade para Indústrias Modernas
  4. Ponteiro Laser: Design, Fabricação e Visão Geral de Segurança
  5. Lasers de Semicondutor: Geração de Luz de Precisão para Tecnologia Moderna
  6. Lasers de Estado Sólido: Tecnologia, Aplicações e Tendências Futuras
  7. Leitores de DVD: História, Tecnologia e Inovações Futuras
  8. Mísseis Guiados a Laser: Desenvolvimento, Fabricação e Impacto Estratégico
  9. Laser Eletro-Óptico Revolucionário Entrega Taxa de Pulso de 30 GHz para Imagem e Comunicações Ultra-Rápidas
  10. Fibra Óptica Revolucionária Alcança Velocidade de Transmissão de 1 Petabit por Segundo