I’d like to make a device with solar panel and lipo. I also would like to make the program adapt to the charging and battery level, this so that if the battery is full the device is more frequently reporting what I like and when everything is draining (no or almost none solar / battery power the device will sleep longer).
Is there a way to read the solar power and the battery level on this device (SARA R4)?
It depends on the battery type, the enviroment temperature, discharge current, if the patern is more or less liniar.
Most lipo batteries, those we sell in the webshop, have a discharge like:
On the SODAQ Sara we don’t have anything that can tell you about the solar power.
You can take multiple battery voltage readings to calculate what the power has been over time.
I am interested in checking the battery also. But I can not see any code in the provided link.
Can you please provide an example for reading the battery voltage again, thanks.
Hi! I would like to check battery status on sodaq sara AFF (r410m) and SFF. The link that you provided makes me confused since the link both consists of “sodaq-one” AND “sodaq-sara” is it the same example for both? ps. the link does not take me to the right place.
#define ADC_AREF 3.3f
// #define BATVOLT_R1 2.0f // One v1
// #define BATVOLT_R2 2.0f // One v1
#define BATVOLT_R1 4.7f // SFF, AFF, One v2 and v3
#define BATVOLT_R2 10.0f // SFF, AFF, One v2 and v3
#define BATVOLT_PIN BAT_VOLT
void setup() {
// put your setup code here, to run once:
SerialUSB.begin(57600);
while(!SerialUSB){
//wait for Serial Monitor to be opened
}
}
void loop() {
// put your main code here, to run repeatedly:
SerialUSB.println(getBatteryVoltage());
delay(1000);
}
uint16_t getBatteryVoltage()
{
uint16_t voltage = (uint16_t)((ADC_AREF / 1.023) * (BATVOLT_R1 + BATVOLT_R2) / BATVOLT_R2 * (float)analogRead(BATVOLT_PIN));
return voltage;
}
I agree that it’s a bit confusing, all support pages have the /sodaq-one/ as pre-fix in the url at the moment, this will change soon.
Yeah, that took me a few minutes to understand that there is something wrong.
But thanks for the further reply. I’m going to do the same with my solar battery.