The Godfather talking
This is god damn my place! Capisci?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 25, 2024, 09:46:20 09:46


Login with username, password and session length


Pages: [1]
Print
Author Topic: [HELP] EFY - Solar-Powered Home Lighting System  (Read 4886 times)
0 Members and 1 Guest are viewing this topic.
hodahel
Active Member
***
Offline Offline

Posts: 103

Thank You
-Given: 189
-Receive: 6

Catch me...


« on: December 13, 2015, 09:09:59 09:09 »

Hi,

Can somebody help me with this DIY project from EFY. Solar-Powered Home Lighting System.

http://electronicsforu.com/electronicsforu/circuitarchives/view_article.asp?sno=2044&id=13426&article_type=5&b_type=new



Schematic:




Successfully assembled the project but it's not working as describe.

The project will go on infinite loop of "CHARGING" to "BATTERY FULL"

I thinks there is a problem with the codes here..

Code:
#include <pic.h>
#include <math.h>
#include "lcd.h"
#define charge_Batt_1_Solar 0x15
#define charge_Batt_2_Solar 0x0E
#define Batt_Low_Solar 0x07
#define charge_over 0x08
#define charge_Batt_1_AC 0x11
#define charge_Batt_2_AC 0x0A
#define Batt_Low_AC 0x03

void delay(unsigned int time) // Delay
{
unsigned int i, j;
for(i=0;i<time;i++)
   for(j=0;j<time;j++);
}
void ADC_Init() // Intialise ADC
{
  ADCON0 = 0x01;
  ADCON1 = 0xC4; //Right justified,AN0,AN1,AN3 are analog input.
  ADRESH = 0;
  ADRESL = 0;
}
unsigned int ADC_Read(unsigned char channel)
{
  ADCON0 &= 0xC7; //Clearing the Channel Selection Bits
  ADCON0 |= channel<<3; //Setting the required Bits
  delay(10);     //Acquisition time to charge hold capacitor
  ADGO = 1; //Initializes A/D Conversion
  while(ADGO == 1); //Wait for A/D Conversion to complete
  return (256 * ADRESH + ADRESL); //Returns Result
}
void main(void)
{ unsigned int Solar,Batt_1,Batt_2,temp,unit,a,b,c,d,x,y,z;
TRISA = 0x0F; //
TRISB = 0x00; // port B as output
TRISC = 0x00; // port C as output
TRISD = 0x00; // port D as output
    lcdint(); // intialised LCD
cmm(0x01); // clear display
cmm(0x80); // 1'st line of LCD
    data_str("SOLAR CHARGER");
delay(100);
ADC_Init(); // Initialise ADC
while(1)
{
  Solar = ADC_Read(0);
  unit = Solar; // Temperature is conveted to ASCII
if(unit > 900)
{ Batt_1 = ADC_Read(1);
Batt_2 = ADC_Read(3);

if((Batt_1 < 650)&&(Batt_2 > 850))
{
cmm(0x80); // 2nd line of LCD
data_str("BATT-1  CHARGING");
cmm(0xC0); // 2nd line of LCD
data_str("BATT-2 FULL SOL.");
PORTC = charge_Batt_1_Solar;
delay(100);
}
        if((Batt_2 < 650)&&(Batt_1 > 850))
{
cmm(0x80); // 2nd line of LCD
data_str("BATT-2  CHARGING");
cmm(0xC0); // 2nd line of LCD
data_str("BATT-1 FULL SOL.");
PORTC = charge_Batt_2_Solar;
delay(100);
}


if((Batt_1 > 850)&&(Batt_2 > 850))
{
cmm(0x80); // 2nd line of LCD
data_str("BATT-2      FULL");
cmm(0xC0); // 2nd line of LCD
data_str("BATT-1      FULL");
PORTC = charge_over;
delay(100);
}
if((Batt_1 < 650)&&(Batt_2 < 650))
{
cmm(0x80); // 1st line of LCD
data_str("BATT-1    BATT-2");
cmm(0xC0); // 2nd line of LCD
data_str("CHARGING    SOL.");
PORTC = Batt_Low_Solar;
delay(100);
}

}
else
{ Batt_1 = ADC_Read(1);
Batt_2 = ADC_Read(3);

if((Batt_1 < 650)&&(Batt_2 > 850))
{
cmm(0x80); // 2nd line of LCD
data_str("BATT-1  CHARGING");
cmm(0xC0); // 2nd line of LCD
data_str("BATT-2 FULL   AC");
PORTC = charge_Batt_1_AC;
delay(100);
}
        if((Batt_2 < 650)&&(Batt_1 > 850))
{
cmm(0x80); // 2nd line of LCD
data_str("BATT-2  CHARGING");
cmm(0xC0); // 2nd line of LCD
data_str("BATT-1 FULL   AC");
PORTC = charge_Batt_2_AC;
delay(100);
}


if((Batt_1 > 650)&&(Batt_2 > 850))
{
cmm(0x80); // 2nd line of LCD
data_str("BATT-2      FULL");
cmm(0xC0); // 2nd line of LCD
data_str("BATT-1      FULL");
PORTC = charge_over;
delay(100);
}
if((Batt_1 < 650)&&(Batt_2 < 650))
{
cmm(0x80); // 1st line of LCD
data_str("BATT-1    BATT-2");
cmm(0xC0); // 2nd line of LCD
data_str("CHARGING      AC");
PORTC = Batt_Low_AC;
delay(100);
}
}
}
}









TIA
Logged
Wilksey
Cracking Team
Senior Member
****
Offline Offline

Posts: 413

Thank You
-Given: 161
-Receive: 2549


« Reply #1 on: December 16, 2015, 03:29:12 15:29 »

Is this a direct copy of the code from the site?
The ADC values determine what state of charge the battery is at.

Did you set the correct programming fuses as advised in the article?
Logged
witsanukai
Junior Member
**
Offline Offline

Posts: 38

Thank You
-Given: 13
-Receive: 9


« Reply #2 on: January 06, 2016, 01:28:47 01:28 »

Did you connect battery to CON4 and CON5 before start?
I though you may need to connect battery then try to phush reset button, seem battery floating then ADC always read and indicted to battery full.
Logged
hodahel
Active Member
***
Offline Offline

Posts: 103

Thank You
-Given: 189
-Receive: 6

Catch me...


« Reply #3 on: February 27, 2016, 12:56:35 12:56 »

Is this a direct copy of the code from the site?
The ADC values determine what state of charge the battery is at.

Did you set the correct programming fuses as advised in the article?


Yes sir it is..all the FUSES are set correctly based on article..

Another design flaw I noted is the lack of limiting resistor on trimmer, so by accidentally setting it to minimum will short the ADC pins and burn the trimmer.



Did you connect battery to CON4 and CON5 before start?
I though you may need to connect battery then try to phush reset button, seem battery floating then ADC always read and indicted to battery full.

Yes I did..I used 2 batteries...problem is when the battery is connected to charger, and the ADC will sample it will be detected as FLOAT since the charger is connected..

I think a much better approach is to disconnect the charger before sampling the battery voltage..


Regards.
Logged
solutions
Hero Member
*****
Offline Offline

Posts: 1826

Thank You
-Given: 656
-Receive: 905



« Reply #4 on: March 06, 2016, 03:59:19 03:59 »


Another design flaw I noted is the lack of limiting resistor on trimmer, so by accidentally setting it to minimum will short the ADC pins and burn the trimmer.

The only flaw is in your knowledge of how an ADC works or is used.

Go look up how an ADC works, how much current is going into (or out of with your assumption) the ADC pin and then come up with the solution for your trimmer going up in flames because someone with minimal knowledge accidentally turned it to zero.

Hint: none needed

Posted on: March 06, 2016, 04:42:54 04:42 - Automerged

I used 2 batteries...problem is when the battery is connected to charger, and the ADC will sample it will be detected as FLOAT since the charger is connected..

I think a much better approach is to disconnect the charger before sampling the battery voltage..


Regards.

The relays do that for you if you wrote the code correctly.

Sounds to me like you swapped the N/C and N/O on RL3. Next likely is RL3 is not being energized.
Logged
hodahel
Active Member
***
Offline Offline

Posts: 103

Thank You
-Given: 189
-Receive: 6

Catch me...


« Reply #5 on: April 29, 2016, 05:15:29 17:15 »

Crap...we don't understand each other..

That whole project is NOT mine..just followed what is posted on that site and that is the problem I encountered with that project..

I wondered how I could possibly swap the NC to NO when I used the PCB layout given by the author.
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC