Hi everyone,
I have a problem with the solar charger: I need not more than ~4V on the output for the FONA 808, and that's ok because I have a lipo battery (3.7V) connected to the lipo charger and the FONA runs as it should.
The problem is real when the solar panel is in the direct sun light, and the USB / DC / Solar Lithium Ion/Polymer charger output is higher than 4V, maybe 5V if the sun light is very strong. The voltage on the battery is always 3.7 V, so I think that if there's too much voltage for the battery the charger puts it directly on the output, causing the FONA shutdown, and that's the problem: the FONA is overload and it shuts down, so my project is perfect until there's not the direct sun light.
How can I limit the output voltage? In every condition, I need at least 3.5V and not more than 4V. Solutions? Thank guys, you will save my final exams
Solar Panel / Solar Lipoly charger - too much voltage
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- riccar12
- Posts: 1
- Joined: Tue Feb 23, 2016 4:14 pm
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Solar Panel / Solar Lipoly charger - too much voltage
The simple solution is to wire the FONA in parallel to the battery. This ignores the load-sharing capability of the charger. The good news is that your FONA will never see more than the battery voltage (4.2v when completely charged). The downside is that your battery will charge slower because some of the charge current will be shared with the FONA.
A more complex solution would be to add a voltage regulator to the Load output of the charger to keep it at or below 4v.
A more complex solution would be to add a voltage regulator to the Load output of the charger to keep it at or below 4v.
- O2
- Posts: 33
- Joined: Sat Aug 30, 2014 11:20 am
Re: Solar Panel / Solar Lipoly charger - too much voltage
I have a similar problem. My load is connected to b+ of the charger. I use A2 pin to monitor b+ voltage every 10 minutes. During cloudy days, b+ voltage max out at 4.2v. However, in sunny days, b+ shoots up to 5.2v around high noon for a couple samples then drops down to about 4.2v for the rest of the day even though the sun is just as bright. Spike in voltage causes bad readings from one of my sensors.
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Solar Panel / Solar Lipoly charger - too much voltage
@O2 - Please post a photo showing how you have everything wired.
- O2
- Posts: 33
- Joined: Sat Aug 30, 2014 11:20 am
Re: Solar Panel / Solar Lipoly charger - too much voltage
Here is the wiring diagram with omission of some grounds, resistors, caps, etc. As you can see the two power sources are consisted of parts from adafruit. The second pic shows the two voltage spikes around noon of yesterday and today. I'm also puzzled by the matching voltage spikes form 3AAs which is not connected to the solar charger. The spike causes bad readings the CO2 sensor.
- Attachments
-
- voltage spikes-1.png (161.73 KiB) Viewed 722 times
- Franklin97355
- Posts: 23912
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Solar Panel / Solar Lipoly charger - too much voltage
As far as I know eneloops are NiMH and not LiPo. You should not be connecting them to the LiPo charger.
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Solar Panel / Solar Lipoly charger - too much voltage
How are you measuring the eneloop voltage?
It looks like the CO2 sensor is being powered by the eneloops, not the solar charger. I don't see how the solar output could be disrupting your sensor readings.
It looks like the CO2 sensor is being powered by the eneloops, not the solar charger. I don't see how the solar output could be disrupting your sensor readings.
- O2
- Posts: 33
- Joined: Sat Aug 30, 2014 11:20 am
Re: Solar Panel / Solar Lipoly charger - too much voltage
The eneloops are not connected to the charger. A 1200mA lipo is charged by the charger as shown in my diagram. The nano and sensors are powered by eneloops via pb500 and the SIM800i and a vacuum pump are powered by the lipo. The eneloop voltage is taken from the BAT pin on pb500.
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Solar Panel / Solar Lipoly charger - too much voltage
If both eneloop and lipo voltages show apparent spikes at the same time, the cause must be something they have in common. The only thing I can see that they have in common is that the Nano that is measuring these spikes is powered by the eneloops. A more plausible theory is that there is a momentary dip in the supply voltage - which is also the analog reference.
- O2
- Posts: 33
- Joined: Sat Aug 30, 2014 11:20 am
Re: Solar Panel / Solar Lipoly charger - too much voltage
yes, a dip in ref could cause the spike but what's cause of the dip? That could explain why I haven't fried my sim800i and the bad readings from CO2 sensor. However, the drop occurrs only on sunny days and at high noon? The anomaly doesn't have any correlation with temperature rise. Any suggestions on how to solve the problem?
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Solar Panel / Solar Lipoly charger - too much voltage
From the diagrams posted, I don't see any way that solar input would influence the output of the eneloops or the powerboost. Does anything else happen at noon on a sunny day?
- O2
- Posts: 33
- Joined: Sat Aug 30, 2014 11:20 am
Re: Solar Panel / Solar Lipoly charger - too much voltage
The solar panel is the only part that is exposed to the elements. Everything else is contained in a dark box not affected by light changes. In my previous setup, eneloop and pb500 is the sole power supply for the entire system. There were no bad readings from the CO2 sensor at any time of the day.
- Franklin97355
- Posts: 23912
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Solar Panel / Solar Lipoly charger - too much voltage
Could you post your code so we can take a look?
- O2
- Posts: 33
- Joined: Sat Aug 30, 2014 11:20 am
Re: Solar Panel / Solar Lipoly charger - too much voltage
Code: Select all
#include <SoftwareSerial.h>
SoftwareSerial sim800(2, 3); // RX, TX
SoftwareSerial O2Serial(4,5); //4 to O2TX, 10 to O2RX;
SoftwareSerial K_30_Serial(8,9); //Initialize a kSeries Sensor with pin 4 as Rx and 5 as Tx
byte readCO2[] = {0xFE, 0X44, 0X00, 0X08, 0X02, 0X9F, 0X25}; //Command packet to read Co2 (see app note)
byte response[] = {0,0,0,0,0,0,0}; //create an array to store the response
//multiplier for value. default is 1. set to 3 for K-30 3% and 10 for K-33 ICB
int valMultiplier = 10;
#define CO2Power 6 //D6
#define killPower 7 //D7
#define PumpPower 11 //D11
//battery voltage
const int analogInPin=A0; const int LipoPin=A2;
float Vin; float batV; float lipoV;
unsigned long myChannelNumber = 79774;
String APIKey = "HCFY3VUNSB3Q79ZP"; //write to thingspeak data store
int O2val=21;
void setup()
{
sim800.begin(9600);
Serial.begin(9600);
O2Serial.begin(9600);
K_30_Serial.begin(9600);
delay(20);
sim800.println("AT+SAPBR=3,1,\"APN\",\"epc.tmobile.com\"");
delay(100);
sim800.println("AT+SAPBR=1,1");
delay(500);
Serial.print("ready...");
pinMode(CO2Power, OUTPUT);
pinMode(PumpPower, OUTPUT);
pinMode(killPower, OUTPUT);
}
void loop()
{
digitalWrite(PumpPower, HIGH);
delay(2000); //; lg pump 3+4.5 ; small pump from CO2.com 5+4.5=9.5 seconds = 5 - 8 ml/s
digitalWrite(CO2Power, HIGH); //need 4 secons to warmup
delay(5000);//CO2 needs >4000 for reliable reading
digitalWrite(PumpPower, LOW); //pump power off
//CO2
delay(500);
sendRequest(readCO2);
unsigned long valCO2=0;
valCO2= getValue(response);
digitalWrite(CO2Power, LOW); //
//O2
delay(10);
int on=getResp("M 1", &O2Serial);
delay(10);
O2val=getResp("%", &O2Serial); //O2 in %
int O2t=getResp("T", &O2Serial); //temp in C
int O2p=getResp("P", &O2Serial); //pressure in mBar
int off=getResp("M 2", &O2Serial);
delay(20);
//Vin=readVcc(); //read arduino reference voltage
float mV=analogRead(analogInPin);
//batV=mV*Vin/1023; //calibrateed analog voltage based on ref voltage
batV=mV*5.2/1023;
delay(20);
lipoV=analogRead(LipoPin)/1023.0*5.2;
delay(20);
String O2=String(float(O2val)/100);
String data="field1="+String(float(O2t)/10)+"&field2="+String(valCO2);
data+="&field3="+O2+"&field4="+String(O2p);
data+="&field5="+String(batV) +"&field6="+String(lipoV);
//data+="&latitude="+lat+"&longitude="+lon;
//Serial.println(data);
//sending data via cellur
//test site has poor 2G signal, repeated tries to increase success rate
sim800.println("AT+SAPBR=3,1,\"APN\",\"epc.tmobile.com\"");
delay(100);
sim800.println("AT+SAPBR=1,1");
delay(100);
for (int i=0; i < 3; i++)
{
sim800.println("AT+HTTPINIT");
delay(100);
sim800.println("AT+HTTPPARA=\"URL\",\"http://api.thingspeak.com/update?key=" +APIKey +"&"+data+ "\"");
delay(100);
sim800.println("AT+HTTPACTION=0");
delay(1000);
sim800.println("AT+HTTPTERM");
delay(2500);
}
digitalWrite(killPower, HIGH);//set Pb500 EN low to kill the system power
//PIC will wake up the system in set interval
}
void sendRequest(byte packet[])
{
int timeout=0; //set a timeoute counter
while(!K_30_Serial.available()) //keep sending request until we start to get a response
{
K_30_Serial.write(readCO2,7);
delay(20);
timeout++;
if(timeout>100)
break;
}
//Serial.println("2");
timeout=0;
while(K_30_Serial.available() < 7 ) //Wait to get a 7 byte response
{
timeout++;
if(timeout > 10) //if it takes to long there was probably an error
{
while(K_30_Serial.available()) //flush whatever we have
K_30_Serial.read();
break; //exit and try again
}
delay(50);
}
for (int i=0; i < 7; i++)
{
response[i] = K_30_Serial.read();
}
}
unsigned long getValue(byte packet[])
{
int high = packet[3]; //high byte for value is 4th byte in packet in the packet
int low = packet[4]; //low byte for value is 5th byte in the packet
unsigned long val = high*256 + low; //Combine high byte and low byte with this formula to get value
return val* valMultiplier;
}
int getResp(String req, SoftwareSerial* Port)
{
Port->listen();
delay(5);
int timeOut =0;
String resp ="";
bool retry = true;
int count =0;
while(retry)
{
Port->flush();
Port->println(req);
resp ="";
while(!Port->available())
{
timeOut++;
delay(10);
if(timeOut > 100)
{
resp = "000000";
return -255;
}
}
count = 0;
while(Port->available())
{
char c = Port->read();
resp+= c;
//Serial.print(c);
delay(2);
}
if(resp.length() >= 6)
{
resp.trim();
if(resp[0] == req[0] || resp[0] == 'S' )
retry = false;
}
count++;
}
resp.replace("+", "0");
resp.replace(".", "");
resp = resp.substring(2);
return resp.toInt();
}
float readVcc() {
long result;
// Read 1.1V reference against AVcc
ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
delay(2); // Wait for Vref to settle
ADCSRA |= _BV(ADSC); // Convert
while (bit_is_set(ADCSRA,ADSC));
result = ADCL;
result |= ADCH<<8;
result = 1126400L / result; // Back-calculate AVcc in mV
return (float) result;
}
String LipoValue()
{
String value = ""; unsigned int i = 0;
sim800.flush(); sim800.println("AT+CBC");
while(i++ <6000)
{
if(sim800.available())
{
char c = sim800.read();
value += c;
}
}
value=value.substring(value.indexOf("+CBC:")+1);
value=value.substring(value.indexOf(",")+1);
value=value.substring(value.indexOf(",")+1);
value.remove(value.indexOf("\r"));
if(value.length()>0) return value;
else return "0";
}
Last edited by Franklin97355 on Mon May 02, 2016 12:54 am, edited 1 time in total.
Reason: Added missing [code]...[/code] tags to format and confine the code.
Reason: Added missing [code]...[/code] tags to format and confine the code.
Please be positive and constructive with your questions and comments.