solar power system for home appliances | solar power system project 2020
CIRCUIT
DIAGRAM 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 PIC16F7877A
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.
Here in this, the project we develop a low-cost solar panel is used to store the solar energy by
using microcontroller. The solar panel absorbs the solar energy and stored in
the battery.
The Solar panel is connected to the
ADC channel of the microcontroller. The microcontroller calculates the panel voltage and displayed in the LCD Display. At the same time, the battery gets
charged from the solar panel. In that battery, we can connect the load and it is
used for specific purposes.
solar power system for home appliances Coding
MICROCONTROLLER PROGRAM
#include<16ff877a.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(" Embedded based ");
lcd_com(0xc0);
lcd_puts(" power
");
delay_ms(2000);
lcd_com(0x80);
lcd_puts(" based
");
lcd_com(0xc0);
lcd_puts("electrical ");
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(" Light ON ");
lcd_com(0xc0);
lcd_puts(" "); }
else
{
output_low(relay);
lcd_com(0x80);
lcd_puts("home ");
lcd_com(0xc0);
lcd_puts(" "); }
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: