GPRSbee minimum power needed and testing

So I have figured out that when the power from the battery drops below 3.9V and trying to send data by ftp, the mbili board it is connected to re-boots repeatedly…

Somewhere I seem to recall seeing some code or sketch that checked the battery voltage before switching on and/or checking connectivity… but I can’t track it down now…

Anyone know where it is ?

Thanks, Steve

Hi Steve,

We have some examples on github

Regards,
Jan

Hi Jan,
Thanks for the quick reply. In that sketch I can see the intial defines:
MIN_BATTERY_LEVEL1_GPRSBEE
MIN_BATTERY_LEVEL2_GPRSBEE

but I have searched the file and related files and as far as I can tell, nowhere is there any other reference to those two defines, please can you point me to where they are actually used.

Thanks, Steve

Hi Steve,

I made a note that both defines are not used in the code.

I attached code how you can read the battery voltage.
You can make something in your code that compares the battery voltage with the defines.

Regards,
Jan

/*

  • \brief Read the battery voltage and compute actual voltage in milliVolt
  • See getRealBatteryVoltage for more details
    */
    uint16_t getBatteryMilliVolt()
    {
    uint32_t batteryVoltage = analogRead(BATVOLTPIN);
    return batteryVoltage * (BATVOLT_R1 + BATVOLT_R2) * ADC_AREF_MV / 1023 / BATVOLT_R2;
    }

Thanks, but that is not what I was looking for, I know how to get the battery voltage, etc I also have a test if the battery if below a the min level to not even switch on the gprsbee and attempt transmission… but I recall in some code from sodaq something along the lines of:

  if ( getRealBatteryVoltage() <= MIN_BATTERY_LEVEL1_GPRSBEE ) {
    // abort power is too low
    writelog( "Abort FTP, Battery low: <" + String(MIN_BATTERY_LEVEL1_GPRSBEE) + "V" );
    Serial.println("Battery Low");
    return 0;
  } else if (getRealBatteryVoltage() <= MIN_BATTERY_LEVEL2_GPRSBEE ) {
      // Maybe ok, so test if the bee can connect before attempting to send....

  }

So what I am looking for is the second bit, the appropriate way to test the gprsbee… I am sure you published some code once, but it seems to have disappeared…

Thanks, Steve