Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

power calculation from solar panel using PIC

Status
Not open for further replies.

hridz

Junior Member level 3
Joined
Oct 11, 2011
Messages
27
Helped
0
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Tezpur, India
Activity points
1,485
hello guys i have display the power as wel as voltage in LCD of a solar panel using PIC16f877a. I have connected a resistance of 1k as load, but my problem is that power displayed in LCD and calculated power is different. So plz guys help me out from this problem.

with regards
hridz
 

How large is the difference? How are you sensing current? Via a shunt? Did you ensure that the value of the shunt resistance is accurate.
 

How you measure calculated power and calculate power in PIC?
 

well i have written the code.. i m giving you the caiculation part of the code.. below

void volt_read()
{
text1 = "voltage:";
Lcd_Out(1,1,text1); // Write result in the second line
data_1 = ADC_Read(1); // A/D conversion. Pin RA1 is an input.
text2 = "power:" ;
Lcd_Out(2,1,text2);
data_2 = (data_1* data_1)/R ;
}
void display()
{
temp = (long)data_1 *(5000/1023);
ch = temp / 1000;
Lcd_Chr(1,9,48+ch);
Lcd_Chr_CP('.');
ch = (temp / 100) % 10;
Lcd_Chr_CP(48+ch);
ch = (temp / 10) % 10;
Lcd_Chr_CP(48+ch);
ch = temp % 10;
Lcd_Chr_CP(48+ch);
Lcd_Chr_CP('V');
}
void display_pow()
{
temp = (long)data_2 *(5000/1023);
ch = temp / 1000;
Lcd_Chr(2,9,48+ch);
Lcd_Chr_CP('.');
ch = (temp / 100) % 10;
Lcd_Chr_CP(48+ch);
ch = (temp / 10) % 10;
Lcd_Chr_CP(48+ch);
ch = temp % 10;
Lcd_Chr_CP(48+ch);
Lcd_Chr_CP('W');
}
 

Code:
void volt_read()
{
text1 = "voltage:";
Lcd_Out(1,1,text1); // Write result in the second line
data_1 = ADC_Read(1); // A/D conversion. Pin RA1 is an input.
text2 = "power:" ;
Lcd_Out(2,1,text2);
data_2 = (data_1* data_1)/R ;
}
I sure, ADC_Read(1) is value 0-1023.
Then data_1 value must in Volt. Convert to max 5000 mV by multiply with 4.888.
data_1 = (int)(4.888*ADC_Read(1));

After that, calculate data_2, but must remember data_1 is in mV (power calculated in V)
data_2=(long)(data_1* data_1)/(1000000*R)
 

thanks i will check this one and will inform you..

regards
hridz

---------- Post added at 16:58 ---------- Previous post was at 15:19 ----------

i have tried that but my power is showing zero now..
 

i have tried that but my power is showing zero now..
The multiplication maybe overflow, then try to reduce the multiplication result.

ex:
data_2=(long)(0.1*data_1*data_1)/(100000*R)
data_2=(long)(0.01*data_1*data_1)/(10000*R)
data_2=(long)(0.001*data_1*data_1)/(1000*R)
 

tried all above but still showing zero..not getting what is going wrong actually....
 

Do You insist on PIC16F877A or can be other uC ?


Do You need to see W,A,KW/h of solar panel or You need to measure solar insolation like pyranometer to see how much solar energy You get on m2 ?
 

I insist on PIC16F877.. i need to measure V,I,W OF SOLAR PANEL........

---------- Post added at 16:40 ---------- Previous post was at 15:46 ----------

can anybody provide me some working code for it.. i will be thankful..

regards
hridz
 

are u sure u re sending ur result to the lcd for display. cos from ur code it doesnt seems u re writing d value of data1 and data2 to the lcd
 

sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;


unsigned char ch;
unsigned int data_1;
char *text1;
long temp;
void volt_read();
void display();
void lcd_start();
void port_confg();

void main()
{
port_confg();
Lcd_Init();
lcd_start();
Delay_ms(2000);

while (1)
{
volt_read();
display();
}


}
void port_confg()
{
ADCON0=0b11001001;
ADCON1=0b10000000;
TRISA = 0xff;
}

void lcd_start()
{
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Cmd(_LCD_CLEAR);
}
void volt_read()
{
text1 = "voltage:";
Lcd_Out(1,1,text1);
data_1 = ADC_Read(1);
}
void display()
{
temp = (long)data_1 *(5000/1023);
ch = temp / 1000;
Lcd_Chr(1,9,48+ch);
Lcd_Chr_CP('.');
ch = (temp / 100) % 10;
Lcd_Chr_CP(48+ch);
ch = (temp / 10) % 10;
Lcd_Chr_CP(48+ch);
ch = temp % 10;
Lcd_Chr_CP(48+ch);
Lcd_Chr_CP('V');

}

---------- Post added at 16:31 ---------- Previous post was at 16:27 ----------

Above shown code is for voltage display on LCD using PIC, now i need to find the power of the panel from [V(square)/ R ] formulae. using a 1K ohm resistance. please do help me

regards
hridz
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top