Вы находитесь на странице: 1из 24

Remote Control Notice Board Display System using ZigBee

protocol 8051
Remote Control Notice Board Display
System
IEEE 802.15.4/ZigBee Protocol
AbstractThis Paper proposed a portable wireless data acquisition system for
temperature in real time process dynamics. Process variables (like temperature,
RTC) vary with time in certain applications and this variation should be recorded
so that a control action can take place at a defined set point This paper proposes an
8 bit embedded platform for a sensor having a network interface using the
802.15.4, ZigBee protocol, that is specially designed for the sensors network. The
ZigBee protocol is a wireless technology developed as an open global standard to
address the unique needs of low-cost, low power; wireless sensors network .This
wireless data logger senses and monitors the variations in the local temperature
thereby transmits the data within the range to an assigned embedded processor
based server. Received temperature is displayed on a local liquid crystal display
(LCD) on assigned server and simultaneously on a computer.

I. INTRODUCTION
The smart logger is the convergence of the sensing features of a
sensor with the intelligence and decision making abilities of a micro system. They
have been successfully deployed in with the intelligence and decision making
abilities of a micro system. They have been successfully deployed in many
industrial applications such as maintenance, monitoring, control, security, etc. It
has its advantages in terms of portability, reliability, flexibility and robustness.
Temperature is recorded using a temperature tag at user defined time Intervals. The
temperature tag can be programmed so that when the memory is full it either stops
further recording or continues recording by overwriting the earliest of the
previously recorded data. Before we should start this we should get familiarity

Page 1
Remote Control Notice Board Display System using ZigBee
protocol 8051
about ICLM35 Temperature sensor, ZigBee module, RS232, Interfacing of 8051
microcontroller to ADC0808. Lets discuss about them.
Block diagram for Transmitting end:

Server station ZigBee Module

Block diagram for Receiving end:

ZigBee
Sens ADC Microcontr LCD Max ZigBee
modul
or oller
e 232 module

LM35 Temperature sensor:

A sensor is a device that measures a physical quantity and converts one form of
signal into another form of signal which can be read by an observer or by an
instrument. For Example A thermocouple converts temperature to an output
voltage which can be read by a voltmeter. In my project I am using LM35
Temperature sensor which converts Temperature values into corresponding voltage
values. The LM35 IC is as shown below.

The LM35 series are precision integrated-circuit temperature sensors, whose


output voltage is linearly proportional to the Celsius (Centigrade) temperature. The
LM35 thus has an advantage over linear temperature sensors calibrated in Kelvin,
as the user is not required to subtract a large constant voltage from its output to
obtain convenient Centigrade scaling .
It can be used with single power supplies, or with plus and minus supplies. As it
draws only 60 A from its supply, it has very low self-heating, less than 0.1C in
still air. The LM35 is rated to operate over a 0 to +100C temperature range.

Page 2
Remote Control Notice Board Display System using ZigBee
protocol 8051

Figure1: LM 35-
DZ

Temperature sensor

A micro-
controller can be compared to a small stand alone computer; it is a very powerful
device, which is capable of executing a series of pre-programmed tasks and
interacting with other hardware devices. Being packed in a tiny integrated circuit
(IC) whose size and weight is usually negligible, it is becoming the perfect
controller for robots or any machines requiring some kind of intelligent
automation. A single microcontroller can be sufficient to control a small mobile
robot, an automatic washer machine or a security system. Any microcontroller
contains a memory to store the program to be executed, and a number of
input/output lines that can be used to interact with other devices, like reading the
state of a sensor or controlling a motor.

Nowadays, microcontrollers are so cheap and easily available that it is common


to use them instead of simple logic circuits like counters for the sole purpose of
gaining some design flexibility and saving some space. Some machines and robots
will even rely on a multitude of microcontrollers, each one dedicated to a certain
task. Most recent microcontrollers are 'In System Programmable', meaning that you
can modify the program being executed, without removing the microcontroller
from its place.

Interfacing of 0808 with microcontroller:

Page 3
Remote Control Notice Board Display System using ZigBee
protocol 8051
Normally analogue-to-digital converter (ADC) needs interfacing through a
microcontroller to convert analogue data into digital format. This requires
hardware and necessary software, resulting in increased complexity and hence the
total cost.
The circuit of A-to-D converter shown here is configured around ADC 0808,
avoiding the use of a microcontroller. The ADC 0808 is an 8-bit A-to-D converter,
having data lines D0-D7. It works on the principle of successive approximation. It
has a total of eight analogue input channels, out of which I can be selected two
channels using address lines A, B and C. Here, in this case, input channel IN0
IN1is selected by using A, B and C address lines.
Usually the control signals EOC (end of conversion), SC (start conversion), ALE
(address latch enable) and OE (output enable) are interfaced by means of a
microcontroller. However, the circuit shown here is built to operate in its
continuous mode without using any microcontroller. Therefore the input control
signals ALE and OE, being active-high, are tied to Vcc (+5 volts). The input
control signal SC, being active-low, initiates start of conversion at falling edge of
the pulse, whereas the output signal EOC becomes high after completion of
digitisation. This EOC output is coupled to SC input, where falling edge of EOC
output acts as SC input to direct the ADC to start the conversion. As the conversion
starts, EOC signal goes high. At next clock pulse EOC output again goes low, and
hence SC is enabled to start the next conversion. Thus, it provides continuous 8-bit
digital output corresponding to instantaneous value of analogue input. The
maximum level of analogue input voltage should be appropriately scaled down
below positive reference (+5V) level. In order to visualise the digital output, the
row of eight LEDs (LED1 through LED8) have been used, wherein each LED is
connected to respective data lines D0 through D7. Since ADC works in the
continuous mode, it displays digital output as soon as analogue input is applied.
The decimal equivalent digital output value D for a given analogue input voltage
Vin can be calculated from the relationship

INTERFACING ADC808 TO 8051


ADC808/809 Chip with 8 analog channels. This means this kind of chip allows to
monitor 8 different transducers.
ALE: Latch in the address
Start : Start of conversion OE: output enable (same as RD in 804)

Page 4
Remote Control Notice Board Display System using ZigBee
protocol 8051
EOC: End of Conversion (same as INTR in
804)
Channel CBA

IN0 000

IN1 001

IN2 010

IN3 011

IN4 100
LCD
(liquid crystal display)
IN5 101
In this project we using 16x2 line lcd
which is provide a relatively simple
IN6 110
interface between a processor and lcd. This
interface is a parallel port, allowing simple
IN7 111 and fast reading/writing of data to and
from the LCD.

Block diagram:

Page 5
Remote Control Notice Board Display System using ZigBee
protocol 8051

3.3.4.1 Features:

5 x 8 dots with cursor

Built-in controller (ks 0066 or equivalent)

+ 5v power supply (also available for + 3v)

1/16 duty cycle

B/l to be driven by pin 1, pin 2 or pin 15, pin 16 or a.k (led)

N.v. Optional for + 3v power supply

r/s-instruction/register select

w/r-write/read the lcd register

Page 6
Remote Control Notice Board Display System using ZigBee
protocol 8051

Figure 19: LCD interfacing with micro controller.

3.3.4.2 Circuit description:

Above is the quite simple schematic. The lcd panel's enable and register select
is connected to the control port. The control port is an open collector / open drain
output. While most parallel ports have internal pull-up resistors, there are a few
which don't. Therefore by incorporating the two 10k external pull up resistors, the
circuit is more portable for a wider range of computers, some of which may have
no internal pull up resistors.

We make no effort to place the data bus into reverse direction. Therefore we
hard wire the r/w line of the lcd panel, into write mode. This will cause no bus
conflicts on the data lines. As a result we cannot read back the lcd's internal busy
flag which tells us if the lcd has accepted and finished processing the last
instruction. This problem is overcome by inserting known delays into our program.

The 10k potentiometer controls the contrast of the lcd panel. Nothing fancy
here. As with all the examples, i've left the power supply out. You can use a bench

Page 7
Remote Control Notice Board Display System using ZigBee
protocol 8051
power supply set to 5v or use a onboard +5 regulator. Remember a few de-coupling
capacitors, especially if you have trouble with the circuit working proper The r/s
bit is used to select which data or instruction is being transferred between micro-
controller and lcd. If the bit is set, then the byte at the current lcd cursor position
can be read/write. If the bit is reset either instruction is being sent to the lcd or the
execution status of the last instruction is read back

Figure20 : 2*16 character display system

Page 8
Remote Control Notice Board Display System using ZigBee
protocol 8051
3.3.4.3 LCD interfacing pin functionality:

Table 3: pin description of lm016l

In programming we want to display a character in LCD. First we pass some


commands to the LCD thro the port pin of microcontroller to initiate the LCD. For
initialization of LCD we pass the following commands

Page 9
Remote Control Notice Board Display System using ZigBee
protocol 8051

LCD commands initialization:

Page 10
Remote Control Notice Board Display System using ZigBee
protocol 8051
Table 4: lcd commands

MAX 232 (Communication Interface)


RS-232 (Fig. 6.) was created for one purpose, to interface between Data Terminal
Equipment (DTE) and Data Communications Equipment (DCE) employing serial
binary data interchange. So as stated the DTE is the terminal or computer and the
DCE is the modem or other communications device. RS 232 is the most widely
used serial I/O interfacing standard. In RS 232, a 1 is represented by -3 to -25 v.
while a 0 bit is +3 to + 25 v, making -3 to +3 undefined. For this reason, to connect
any RS 232 to a microcontroller system we must use voltage converters such as
MAX 232 to convert the TTL logic levels to the RS 232 voltage level, and vice
versa. This chip is used when interfacing micro controller with PC to check the
Baud rate and changes the voltage level because micro controller is TTL
compatible whereas PC is CMOS compatible.

1. Brief Introduction to ZigBee Technology


ZigBee is a new technology now being deployed for wireless sensor networks. A
sensor network is an infrastructure comprised of sensing, computing and
communications elements that allows the administrator to instrument, observe and
react to events and phenomena in a specified environment. Typical applications
include, but are not limited to, data collection, monitoring, surveillance and
Medical telemetry. The administrator typically is a civil, government, commercial
or industrial entity.
The mainly advantages of ZigBee technology lies in the following aspects: (a)
Reliable and self configuration. (b)Supports large number of nodes. (c)Easy to
deploy. (d)Very long battery life. (e)Secure. (f)Low cost. (g)Can be used globally.

Page 11
Remote Control Notice Board Display System using ZigBee
protocol 8051

Fig: ZigBee Module

Features
1) High Performance, Low Cost:
XBeeIndoor/Urban: up to 100 (30 m)
Outdoor line-of-sight: up to 300 (100 m)
Transmit Power: 1 mW (0 dBm)
Receiver Sensitivity: -92 dBm
2) Low Power Module:
XBeeTX Current: 45 mA (@3.3 V)
RX Current: 50 mA (@3.3 V)
ower-down Current: < 10 A

Advantages
1) Low duty cycle - Provides long battery life
2) Low latency
3) Support for multiple network topologies: Static, dynamic, star and mesh
4) Direct Sequence Spread Spectrum (DSSS)
5) Up to 65,000 nodes on a network
6) 128-bit AES encryption Provides secure connections between devices
7) Collision avoidance
8) Link quality indication
9) Clear channel assessment
10) Retries and acknowledgements
11) Support for guaranteed time slots and packet freshness.

Here I am dividing this project into two different sections:


1. Hardware
2. Software
Again further H/W can be split into two modules.
1. Transmitting mode
2. Receiving mode

Transmitting mode:

Page 12
Remote Control Notice Board Display System using ZigBee
protocol 8051
In transmitting mode ZigBee module is connected to the main server station
through RS-232 cable. Through hyper terminal we can send any message from the
service station the receiver end receives and displays in the LCD which is in
remote area to the transmitting end. The data what you are sending is moved to
ZigBee for the transmission, which is connected via its pin3 to the P3.1 (TxD) of
controller. ZigBee is powered through an external voltage source of 3V (in this
case, a battery) which is connected to its 1st pin. Data is transmitted wirelessly
through the antenna at its 2nd pin which denotes TxD. The transmitting end is as
shown in Fig 6 This is the main function of transmitting mode.

Receiving mode:
Again receiving mode is divided into four modules

1. LM35 Temperature sensor. ICLM35 is as shown in Fig1


2. ADC0808 interfaced with the programmable embedded controller AT89C51 as
shown in Fig. 2.
3. The ZigBee trans receiver present at both the transmitting and receiving end,
providing the wireless interface to the controllers as shown in Fig. (2-3).
4. The final module is another microcontroller at the receiving end interfaced with
a MAX 232, an LCD and a DB9 connector as shown in Fig.3.

Figure2: Transmitting End block diagram

Page 13
Remote Control Notice Board Display System using ZigBee
protocol 8051

Figure3: Receiving End block diagram

Hardware and Software implementation:

Receiving mode:

First the Receiver mode consists of sensing the data, its conversion to digital form,
process on the data in microcontroller and the room temperature is continuously
displayed on LCD. In addition to this it is having ZigBee module to receive the
data that is sent by the transmitting end through hyper terminal by using receiver
Interrupt software code. ZigBee Module receives the data at its pin 3 (RxD) and
transmits it via pin 2 (TxD) to the receiver of microcontroller at pin P3.2.The data
is sensed through the sensor LM35-DZ and passed on to the analog to digital
converter ADC0808LCN through pin 6 of A/D. This data thus, is transmitted to the
port2 of the microcontroller through its data pins. Controller owes its power to the
voltage regulator with a voltage of 5V. In sending the data to controller, after
processing the data it is moved and displayed in LCD module Data that comes
from the transmitter gets displayed on the LCD.

Page 14
Remote Control Notice Board Display System using ZigBee
protocol 8051

Fig.6. Receiving End


Software Implementation:

Page 15
Remote Control Notice Board Display System using ZigBee
protocol 8051
In this work the temperature is sensed by the LM35 is converted into 8 bit data
using A/D converter connected to the input port P3 of TxD of embedded processor.
The program processor senses the present room temperature and continuously
displays in LCD whenever we want to send any important message we can send
through hyper terminal it will displays in the LCD after that it again started to
display the room temperature continuously. We are placing four more controllers
having the same software code is placed in different four locations. Whatever we
are sending information from server station it will display in all the four locations
with wireless technology. The processor is programmed through Keil compiler.

Algorithm for ADC


Select an analog channel by provide bits to A, B, C.
Enable clock
Activate ALE with a low-to-high pulse.
Activate SC with a high-to-low pulse (start conversion) The conversion is begun
on the falling edge of the start conversion pulse.
Monitor EOC Pin .After conversion this pin goes high.
Activate OE with a high-to-low pulse to read data out of the ADC chip.

Programing code:

//-----------------------------------------------------------------------------------------
// ALL HEADER FILES INCLUDED HERE
//----------------------------------------------------------------------------------------------
#include<reg51.h>
#define adc_data P2 //ADC data port
#define lcd_data P1 //LCD data port

//-----------------------------------------------------------------------------------------
// ADC and LCD port defination here
//----------------------------------------------------------------------------------------------

sbit rs=P3^5; //rs for lcd


sbit en=P3^4; //en for lcd

Page 16
Remote Control Notice Board Display System using ZigBee
protocol 8051
sbit ADDR_2=P0^0; // CHANNEL SELECTION PORT
sbit ADDR_1=P0^1;
sbit ADDR_0=P0^2;

sbit ALE=P0^4; //ADDRES LATCH ENABLE


sbit CLOCK=P0^7; //CLOCK GENERATED FOT THE ADC0808 AT
THIS PIN

sbit SOC = P0^3; //START OF CONVERSION


sbit EOC = P0^5; //END OF CONVERSION
sbit Read= P0^6; //READ ENABLE

sbit led=P3^2;

sbit led2=P3^3;
//-----------------------------------------------------------------------------------------
// ALL FUNCTION PROTOTYPES HERE
//----------------------------------------------------------------------------------------------

void init_serial();
void send(unsigned char);
void ser_string(unsigned char*);
unsigned char rec();

void lcd_init();
void lcdcmd(unsigned char);
void lcddata(unsigned char);
void lcd_string(unsigned char*);
void LCD_DELAY(int);
void MSDELAY(unsigned int time);

void convertion(unsigned char);


unsigned char adc_read(void );

unsigned char sen_red,temp_val;


unsigned int m,f=0,n;
unsigned char b[16],c[16];
//-------------------------------------------------------------------------------------------------

Page 17
Remote Control Notice Board Display System using ZigBee
protocol 8051
// Serial Receiver Interrupt
//-------------------------------------------------------------------------------------------------

void serial0(void) interrupt 4


{
if(RI==1)
{
f=1;
lcdcmd(0x01);
for(m=0;m<16;m++)
{
b[m]=rec();
lcddata(b[m]);
LCD_DELAY(5);
}

lcdcmd(0xC0);

for(n=0;n<16;n++)
{
c[n]=rec();
lcddata(c[n]);
}
RI=0;
lcdcmd(0x01);
}
}

//-------------------------------------------------------------------------------------------------
// Serial communication function
//-------------------------------------------------------------------------------------------------

void init_serial()
{
SCON=0x50; // serial control register
TMOD=0x20; //timer initialisation(timer1-mode1)
TH1=0xFD; //set baud rate of 9600
IE=0x90;
TR1=1; //run timer 1 for serial comunication

Page 18
Remote Control Notice Board Display System using ZigBee
protocol 8051
}
void send(unsigned char t)
{
SBUF=t;
while(TI==0);
TI=0;
}

void ser_string(unsigned char *p)


{
while(*p!='\0')
{
send(*p++);
}
}

unsigned char rec()


{
unsigned char t;
while(RI==0);
t=SBUF;
RI=0;
return t;
}

//------------------------------------------------------------------------------------------
//LCD program function
//------------------------------------------------------------------------------------------
void lcd_init()
{
//4-bit interface
lcdcmd(0X38);
LCD_DELAY(500);
lcdcmd(0X0E); //Dispaly on cursor blinking
LCD_DELAY(500);
lcdcmd(0X01); // clear lcd
LCD_DELAY(500);
lcdcmd(0X06); // increment cursor
LCD_DELAY(500);
lcdcmd(0X80); // go to first line
Page 19
Remote Control Notice Board Display System using ZigBee
protocol 8051
LCD_DELAY(500);

}
void lcdcmd(unsigned char a)
{
lcd_data=a;
rs=0;
en=1;
LCD_DELAY(5);
en=0;
}

void lcddata(unsigned char a)


{
lcd_data=a;
rs=1;
en=1;
LCD_DELAY(5);
en=0;
LCD_DELAY(5);
}

void LCD_DELAY(unsigned int i)


{
unsigned int j,k;
for(k=0;k<=100;k++)
for(j=0;j<i;j++);
}

void lcd_string(unsigned char *ptr)


{
while(*ptr)
{
lcddata(*ptr);
ptr++;
}
}
//---------------------------------------------------------------------------------------------
// ADC convertion function

Page 20
Remote Control Notice Board Display System using ZigBee
protocol 8051
//---------------------------------------------------------------------------------------------
void convertion(unsigned char ans)
{
unsigned char i,x,k,l,j,a[3];
i=ans;
x=i/0X0A;
j=(i%0X0A);
k=(x%0X0A);
l=(x/0x0A);
a[0]=(l | 0x30);
LCD_DELAY(500);
a[1]=(k | 0x30);
LCD_DELAY(500);
a[2]=(j | 0x30);

lcdcmd(0xC0);
LCD_DELAY(500);
lcddata(a[0]);LCD_DELAY(500);
lcddata(a[1]);LCD_DELAY(500); // send to lcd
lcddata(a[2]); LCD_DELAY(500);

send('A');LCD_DELAY(500);
send('D');LCD_DELAY(500);
send('C'); LCD_DELAY(500); // send serially
send(':');LCD_DELAY(500);
send(a[0]);LCD_DELAY(500);
send(a[1]);LCD_DELAY(500);
send(a[2]);LCD_DELAY(500);LCD_DELAY(500);

sen_red = a[2]*100 + a[1]*10 + a[0]*1;

}
//--------------------------------------------------------------------------------------------------
---------------
//main function starts here
//--------------------------------------------------------------------------------------------------
---------------
void main()
{
unsigned char adc_val;

Page 21
Remote Control Notice Board Display System using ZigBee
protocol 8051

led=0; // 0 means temp val<90;1 means temp val > 90


led2=0; // 0 mens no sensing 1 sensor connected
adc_data=0xFF; // MAKE ADC PORT INPUT PORT

ADDR_2 =0;
ADDR_1 =0; // BY DEFAULT SELECT CHANNEL 1
ADDR_0 =0;

EOC=1; // MAKE EOC PIN INPUT PIN

ALE=0;
Read=0;
SOC=0;

init_serial(); // serial intialisation


ser_string("welcome");

lcd_init(); // lcd initialisation


lcdcmd(0x80); // lcd clear
lcd_string("welcome");
LCD_DELAY(1000);

while(1)
{
lcdcmd(0x01);
lcdcmd(0x80);
lcd_string("ADC CONVN VALU:");
adc_val=adc_read();
convertion(adc_val);

LCD_DELAY(1000);

}
//-------------------------------------------------------------------------------------------------
// ADC read function
//-------------------------------------------------------------------------------------------------
Page 22
Remote Control Notice Board Display System using ZigBee
protocol 8051
unsigned char adc_read(void)
{
unsigned char value;
MSDELAY(1);
ALE=1; // sending high to low pulse
MSDELAY(1);
SOC=1; // SOC starts
MSDELAY(1);
ALE=0;
SOC=0;
while(EOC==0); // wait until conversion ends
//while(EOC==1);
Read=1;
LCD_DELAY(500);
value=adc_data;
value=value-100;
value=value/10;
Read=0;
return (value);
}

//-------------------------------------------------------------------------------------------------
// DELAY function
//-------------------------------------------------------------------------------------------------
void MSDELAY(unsigned int time)
{
unsigned int i,j;
for(i=0;i<time;i++)
for(j=0;j<1275;j++);
}

Applications:

The proposed temperature logger can be used in the following applications:


1) The remote areas where battery power consumption is major issue.
2) The process industries where the physical channel between sensor and display
unit is not possible.

Page 23
Remote Control Notice Board Display System using ZigBee
protocol 8051
3) Long range error free wireless transmission in sensor networks
4) Mining, Agriculture, Defense and biomedical applications

The purpose of this project is to remote monitoring and control of the Domestic Energy meter.
This system enables the Electricity Department to read the meter readings regularly without the
person visiting each house. This can be achieved by the use of microcontroller unit that
continuously monitors and records the Energy Meter readings in its permanent (non-volatile)
memory location. This system also makes use of a GSM modem for remote monitoring and
control of Energy Meter.

The Microcontroller based system continuously records the readings and the live meter
reading can be sent to the Electricity department on request. This system also can be used to
disconnect the power supply to the house in case of non-payment of electricity bills. A dedicated
GSM modem with SIM card is required for each energy meter.

The major building blocks of this project are:

Microcontroller based control system with regulated power supply.

GSM Modem for remote communication

Electromagnetic Relay and Relay Driver for Power Supply Control.

Digital Energy Meter.

LCD Display to display the meter readings.

Page 24

Вам также может понравиться