fbpx

Interface Zigbee With 8051

The Zigbee is the name of a wireless protocol maintained by the IEEE 802.15 standard.

  • This is a protocol specified for wireless Personal Area Network (PAN) using low powered wireless transreceivers.
  • They have an approximate range of 10 to 100 meters and are used in industries.
  • They can communicate with other devices using simplest serial communication protocol.
  • Zigbee uses only two zigbee modules in which one of them transmit the data and another one receives data.
  • The Zigbee module made communication using serial communication protocol with the interfacing devices they can be connected to a microcontroller using a minimum of four pins.
  • They are
    1.Power supply.
    2. Ground.
    3. UART Data Out.
    4. UART Data.
  • Zigbee devices can transmit data over long distances by passing data through a mesh network of intermediate devices to reach more distant ones.
  • Zigbee is typically used in low data rate applications that require long battery life and secure networking.
  • Zigbee networks are secured by 128 bit symmetric encryption keys.

Application

  • Wireless light switch,
  • Electrical meter,
  • Traffic management system,
  • And other consumer and industrial equipment.

Hardware Required

  • Zigbee Module,
  • 8051 MicroController.

Zigbee Pinout

  • Vin= +5V,
  • Dout= Rx of Microcontroller,
  • Din= Tx of Microcontroller,
  • Gnd= Ground.

Circuit

Transmitter

Receiver

Virtual Circuit

Code

Transmitter

 #include <REGX51.H>
 unsigned int i,j;
 unsigned int l=0;
 void delay()
 {
 int i,j;
 for(i=0;i<1000;i++)
 {
 for(j=0;j<1000;j++);
 }
 }
 void transmit(unsigned char *a)
 {
 int k=0;
 while(a[k]!='\0')
 {
 SBUF=a[k];
 while(TI==0);
 TI=0;
 k++;
 }
 }
 void main ( void )
 {
 TMOD=0x20;   // set timer1 mode 2
 TH1=0xFD;   // baud rate 9600
 IE=0x90;   //enable serial interrupt
 SCON=0x50;   // config scon to send & recive with mode1
 TR1=1;   // start timer
 while(1)
 {
 transmit("Hello World");
 delay();
 }
 } 

Receiver

 #include <REGX51.H>
 unsigned int i,j;
 unsigned int l=0;
 unsigned char input[];
 void delay()
 {
 int i,j;
 for(i=0;i<1000;i++)
 {
 for(j=0;j<1000;j++);
 }
 }
 void transmit(unsigned char *a)
 {
 int k=0;
 while(a[k]!='\0')
 {
 SBUF=a[k];
 while(TI==0);
 TI=0;
 k++;
 }
 }
 void serial0() interrupt 4 // serial receiver interrupt
 {
 if(RI==1)
 {
 input[l++]=SBUF;
 RI=0;//CLEAR INTRPT
 }
 }
 void main ( void )
 {
 TMOD=0x20;   // set timer1 mode 2
 TH1=0xFD;   // baud rate 9600
 IE=0x90;   //enable serial interrupt
 SCON=0x50;   // config scon to send & recive with mode1
 TR1=1;   // start timer
 while(1)
 {
 transmit(input);
 delay();
 }
 } 

Leave a Reply

Your email address will not be published. Required fields are marked *