Introduction: Wire Less Serial Communication

This project is for a communication protocols. ITCJ.

Step 1: Description

This project contains information about how to perform a serial communication between two micro controllers using an infrared sensor, wireless communication.

Step 2: Serial Communication.

Serial communication is the process of sending data one bit at a time, sequentially, over a communication channel or computer bus.

Serial communication is used for all long-haul communication and most computer networks, where the cost of cable andsynchronization difficulties make parallel communication impractical. Serial computer buses are becoming more common even at shorter distances, as improved signal integrity and transmission speeds in newer serial technologies have begun to outweigh the parallel bus's advantage of simplicity

Step 3: Serial Communication Operation.

In the serial communication protocol, we use signals (pulses), this signal is sent trough a port of our micro controller.

To begin the communication send a pulse from the master device, this pulse indicate the begin of the sting , in this string we save the series of pulse, and made a combination of values to form a binary number, after sent the string we need send three extra pulses, one for a parity bit to compare if the value is pair or not and the last pulses indicate that communication was finished.

To begin the communication again we need send a pulse (1) to initialize a next communication.

we have a ascii to binary table to convert the value saved in the string in a word.

All pulses was sent using a infra red sensor (Wire less communication).

Step 4: Infrared Sensor.

IR Sensors work by using a specific light sensor to detect a select light wavelength in the Infra-Red (IR) spectrum. By using an LED which produces light at the same wavelength as what the sensor is looking for, you can look at the intensity of the received light. When an object is close to the sensor, the light from the LED bounces off the object and into the light sensor. This results in a large jump in the intensity, which we already know can be detected using a threshold.

http://education.rec.ri.cmu.edu/content/electronics/boe/ir_sensor/1.html

Step 5: Circuit Components.

To do this practice needs.

-Two Arduino's.

-Photo-transistor.

-Infrared sensor.

-Connection wires.

-Proto-board

-Some passive components (Resistance,etc).

In one of the arduinos we need connect the emisor of the infrared sensor in another the receiver, in the next step show a diagram about how connect this part.

Step 6: Arduino Connection/Programing.

The program is attached.

//declarando variables
int emisor=12;

int receptor=A0;

char in; int valor;

int modulo;

int bytes[8]={0,0,0,0,0,0,0,0};

int i=0; int T=20; int t=10;

int dato; int EH=0; int ED=1;

int SYN=0;

int valoresbase[8]={1,2,4,8,16,32,64,128};

char mensaje[100]; int j=0;

//valor=in-48; //Conversion de Caracter a Decimal

//in=valor+0x30; //Convierte decimal a caracter

void setup ()

{ pinMode(emisor,OUTPUT);

digitalWrite(emisor,HIGH);

Serial.begin(9600);

while(SYN==0){ Serial.println("Sincronizando...");

while(EH==0){ dato=digitalRead(receptor);

if(dato==HIGH){ Serial.println("Recibiendo senal...");

EH=1; ED=0; } }

// arreglo para almacenamiento de datos

Serial.println("Presione 1 para iniciar comunicacion");

while(ED==0){ if(Serial.available()>0){ in=Serial.read();

if(in=='1'){ ED=1; SYN=1; } } dato=digitalRead(receptor);

if(dato==LOW){ Serial.println("Se perdio la senal..."); EH=0; ED=1; SYN=0;

} } }

Serial.println("Inicia comunicacion"); Serial.println(); }

void loop ()

{ if(Serial.available()>0)

{ //Transmite dato in=Serial.read();

Serial.print("Enviar: ");

Serial.println(in);

valor=in;

//Conversion de Caracter a Decimal Serial.print("Valor Decimal: ");

Serial.println(valor);

Serial.print("Valor Binario: ");

//Inicia conversion de Decimal a Binario

while(valor>1)

{ modulo=valor%2; bytes[i]=modulo; i++;

valor=valor/2; } if(valor==1)

{ modulo=valor%2; bytes[i]=modulo; }

if(valor==0){ bytes[i]=0; } for(i=7;i>-1;i--)

{ Serial.print(bytes[i]);

//Imprime numero binario

}

Serial.println();

//Inicia Transmision de dato

Serial.print("Transmitiendo: ")

; digitalWrite(emisor,LOW);

delay(t); for(i=0;i<8;i++)

{ Serial.print(bytes[i]);

if(bytes[i]==0)

{ digitalWrite(emisor,LOW);

} if(bytes[i]==1)

{ digitalWrite(emisor,HIGH);

} delay(T);

}

//Reset Variables

digitalWrite(emisor,HIGH);

for(i=0;i<8;i++){ bytes[i]=0;

} i=0; Serial.println();

Serial.println();

delay(100); }

dato=digitalRead(receptor);

if(dato==LOW)

{ //Recibe dato Serial.print("Recibiendo: ");

delay(T);

//Inicia Recepcion de dato

for(i=0;i<8;i++)

{ dato=digitalRead(receptor);

if(dato==HIGH)

{ bytes[i]=1; Serial.print('1');

}

if(dato==LOW){ bytes[i]=0;

Serial.print('0');

}

delay(T);

}

while(EH==0)

{

//Termina Recepcion de dato

dato=digitalRead(receptor);

if(dato==HIGH){ EH=1; } }

Serial.println();

Serial.print("Valor Binario: ");

for(i=7;i>-1;i--

{ Serial.print(bytes[i]); }

Serial.println();

//Conversion de Binario a Decimal

valor=0; for(i=0;i<8;i++)

{ if(bytes[i]==1)

{ valor=valor+valoresbase[i]; } }

Serial.print("Valor Decimal: ");

Serial.println(valor);

in=valor+0x30;

//Convierte decimal a caracter

Serial.print("Se envio: ");

Serial.println(in);

if(in=='@'){ for(j=0;j<100;j++)

{ mensaje[j]=' '; } j=0; }

else{ mensaje[j]=in; j++; Serial.println();

Serial.println("Mensaje:"); for(i=0;i

Step 7: Conclusions

It was possible to write and read a string of characters full and also as an extra send a specific code to jump line and to imitate a small scale communicator texts. In addition, successfully it realized the use and operation of the infrared sensor. This system is the beginning of the logic of communication and determines a watershed for the understanding of matter and the thousands of ways of interaction between digital components.

This project is evidence of Communication protocols.

Students.

Pablo Mendoza.

Luis Quinones.

Ruben Loya.