wireless energy meter using RF communication | wireless energy meter| Embedded systems
Transmitter Circuit:
Receiver Circuit:
schematic diagram with description
The above circuit diagram
shows the various connections used in this project, now let us see a brief
working of this circuit,
The microcontroller used here is PIC16F72
which operates at 16MHz speed generated by the crystal oscillator, the ADC has
an 8-bit resolution, the function of the controller here is to digitalize the analog signal, to refresh the LCD, where the results are shown.
The current sensors are used in our
project, to monitor the power consumed by the circuit at a particular time
and it is connected to the ADC channel of the microcontroller. All the
parameter values are described here are monitored in LCD Display.
The LCD is connected to the
port D of the microcontroller, a 4bit data type connection is used here, 2
controls lines of the LCD is also interfaced to this port. The display used
here is 16x2 one. This can display 32 characters at a time.
The RMS sensor is connected to the
ADC channel of the microcontroller. This sensor calculates the energy meter reading.
The RF Transmitter transmits the amount of power consumed. In the receiving
section, the RF receiver receives the value and it is displayed in the LCD.
The relay is an electromechanical
device. It operated on +12V DC supply When a current flows through the coil,
the resulting magnetic field attracts an armature that is mechanically linked
to a moving contact. This condition performed by normal BC 547 transistors.
When the transistor is ON the relay will be ON otherwise it will be always
OFF.
MICROCONTROLLER PROGRAM
#include<16f72..h>
#use
delay(clock=16000000)
#fuses
put,hs,nowdt,nobrownout
#define reset PIN_b0
#define read_write PIN_b1
#define enable PIN_b2
#define relay PIN_c0
#define key1 PIN_c2
#include<lcd.h>
void get_data();
void conversion(int
dat,int add);
void control();
int ldr1=0;
void main()
{
port_b_pullups(TRUE);
output_low(relay);
lcd_init();
lcd_com(0x0e);
lcd_com(0x01);
lcd_com(0x80);
lcd_puts(" WIRELESS ");
lcd_com(0xc0);
lcd_puts(" ENERGY
");
delay_ms(2000);
lcd_com(0x80);
lcd_puts(" METER ");
lcd_com(0xc0);
lcd_puts("READING ");
delay_ms(1000);
setup_adc_ports( ALL_ANALOG );
setup_adc(ADC_CLOCK_INTERNAL );
set_adc_channel( 0 );
while(true)
{
get_data();
control(); }
}
void get_data()
{
set_adc_channel( 0 );
delay_ms(50);
ldr1=read_adc()*2;
conversion(ldr1,0xc6);
} void conversion(int dat,int add)
{ int i,j,k;
i=dat/100;
j=dat%100;
k=j%10;
j=j/10;
i=i|0x30;
j=j|0x30;
k=k|0x30;
lcd_com(add);
lcd_data(i);
lcd_data(j);
lcd_data(k);}
void control()
{ if(ldr1<20)
{
output_high(relay);
lcd_com(0x80);
lcd_puts(" METER ");
lcd_com(0xc0);
lcd_puts(" "); }
else
{
output_low(relay);
lcd_com(0x80);
lcd_puts("ON ");
lcd_com(0xc0);
lcd_puts(" OFF ");
}
if(!input(key1))
{
delay_ms(50);
lcd_com(0x80);
lcd_puts("light ");
lcd_com(0xc0);
lcd_puts(" ");
output_low(relay); }}
//lcd
#include<string.h>
void lcd_init();
void lcd_com(unsigned
char a1);
void lcd_data(unsigned
char a2);
void lcd_puts(unsigned
char st);
void lcd_com(unsigned
char a1)
{unsigned char temp;
temp=a1;
temp=temp&0xf0;
output_b(temp);
output_low(reset);
output_low(read_write);
delay_ms(1);
output_high(enable);
delay_ms(1);
output_low(enable);
temp=a1<<4;
temp=temp&0xf0;
output_b(temp);
output_low(reset);
output_low(read_write);
delay_ms(1);
output_high(enable);
delay_ms(1);
output_low(enable);
delay_ms(1);}
void lcd_data(unsigned
char a2)
{unsigned char temp1;
temp1=a2;
temp1=temp1&0xf0;
output_b(temp1);
output_high(reset);
output_low(read_write);
delay_ms(1);
output_high(enable);
delay_ms(1);
output_low(enable);
temp1=a2<<4;
temp1=temp1&0xf0;
output_b(temp1);
output_high(reset);
output_low(read_write);
delay_ms(1);
output_high(enable);
delay_ms(1);
output_low(enable);}
void lcd_init()
{ lcd_com(0x30);
delay_ms(20);
lcd_com(0x30);
delay_ms(20);
lcd_com(0x30);
delay_ms(10);
lcd_com(2);
delay_us(10);
lcd_com(0x28);
delay_us(10);
lcd_com(0x0c);
delay_us(10);
lcd_com(0x04);
delay_us(10);
lcd_com(0x06);
delay_us(10);;
lcd_com(0x01);
delay_us(10);}
void lcd_puts(unsigned
char st)
{
if(st!='\0')
lcd_data(st);
}
}
0 comments: