Cubecell in lowpower

i used a battery of 3,7 with my cubecell but in lowpower the curent give me 4mA
is that right?

show how you have it connected? and which cubecell you are talking about?

i have the cubecell HTCC AB01

it might be a short in your connection or your code is leaving pin floating…
mine is connected to a lithium battery that is charged to 4.1v and it draws about 35ua …

btw show your code… it might be your code as well…

#include “Arduino.h”
#include “LoRaWan_APP.h”
#include “Arduino.h”

/*

  • set LoraWan_RGB to 1,the RGB active in loraWan
  • RGB red means sending;
  • RGB green means received done;
    */
    #ifndef LoraWan_RGB
    #define LoraWan_RGB 0
    #endif

#define RF_FREQUENCY 915000000 // Hz

#define TX_OUTPUT_POWER 14 // dBm

#define LORA_BANDWIDTH 0 // [0: 125 kHz,
// 1: 250 kHz,
// 2: 500 kHz,
// 3: Reserved]
#define LORA_SPREADING_FACTOR 7 // [SF7…SF12]
#define LORA_CODINGRATE 1 // [1: 4/5,
// 2: 4/6,
// 3: 4/7,
// 4: 4/8]
#define LORA_PREAMBLE_LENGTH 8 // Same for Tx and Rx
#define LORA_SYMBOL_TIMEOUT 0 // Symbols
#define LORA_FIX_LENGTH_PAYLOAD_ON false
#define LORA_IQ_INVERSION_ON false

#define RX_TIMEOUT_VALUE 1000
#define BUFFER_SIZE 30 // Define the payload size here

char txpacket[BUFFER_SIZE];
char rxpacket[BUFFER_SIZE];

static RadioEvents_t RadioEvents;

double txNumber;

int16_t rssi,rxSize;
void DoubleToString( char *str, double double_num,unsigned int len);

#define timetillsleep 1000
#define timetillwakeup 9000
static TimerEvent_t sleep;
static TimerEvent_t wakeUp;
uint8_t lowpower=1;

void onSleep()
{
Serial.printf(“Going into lowpower mode, %d ms later wake up.\r\n”,timetillwakeup);
lowpower=1;
//timetillwakeup ms later wake up;
TimerSetValue( &wakeUp, timetillwakeup );
TimerStart( &wakeUp );
}
void onWakeUp()
{
Serial.printf(“Woke up, %d ms later into lowpower mode.\r\n”,timetillsleep);
lowpower=0;
//timetillsleep ms later into lowpower mode;
TimerSetValue( &sleep, timetillsleep );
TimerStart( &sleep );
}

void setup() {
// put your setup code here, to run once:
Serial.begin(115200);

txNumber=0;
rssi=0;
pinMode(GPIO6 , OUTPUT); 
Radio.Init( &RadioEvents );
Radio.SetChannel( RF_FREQUENCY );
Radio.SetTxConfig( MODEM_LORA, TX_OUTPUT_POWER, 0, LORA_BANDWIDTH,
                               LORA_SPREADING_FACTOR, LORA_CODINGRATE,
                               LORA_PREAMBLE_LENGTH, LORA_FIX_LENGTH_PAYLOAD_ON,
                               true, 0, 0, LORA_IQ_INVERSION_ON, 3000 ); 

Serial.begin(115200);
Radio.Sleep( );
TimerInit( &sleep, onSleep );
TimerInit( &wakeUp, onWakeUp );
onSleep();
}

void loop() {
if(lowpower){
lowPowerHandler();
}

delay(1000);
txNumber += 0.01;
sprintf(txpacket,"%s",“Hello world number”); //start a package
// sprintf(txpacket+strlen(txpacket),"%d",txNumber); //add to the end of package

DoubleToString(txpacket,txNumber,3); //add to the end of package

turnOnRGB(COLOR_SEND,0); //change rgb color

Serial.printf("\r\nsending packet “%s” , length %d\r\n",txpacket, strlen(txpacket));

Radio.Send( (uint8_t *)txpacket, strlen(txpacket) ); //send the package out
}

/**

  • @brief Double To String
  • @param str: Array or pointer for storing strings
  • @param double_num: Number to be converted
  • @param len: Fractional length to keep
  • @retval None
    */
    void DoubleToString( char *str, double double_num,unsigned int len) {
    double fractpart, intpart;
    fractpart = modf(double_num, &intpart);
    fractpart = fractpart * (pow(10,len));
    sprintf(str + strlen(str),"%d", (int)(intpart)); //Integer part
    sprintf(str + strlen(str), “.%d”, (int)(fractpart)); //Decimal part
    // put your main code here, to run repeatedly:
    }

Avoid serial communication.

looks like your code sleeps only for few seconds at best… i would recommend reworking your code…

you can also try the lowpower mode by itself and set it to a long period and test.

use a PPKII or a multimeter to measure current while a sleep…
you can also (For testing purposes) use a print statement in the loop to check if the MCU sleeps at all…
Serial.print(".");
it should not print when the lowpower mode is invoked. if it prints then your lowpower mode isn’t working…

Jay.

I have tried print statements to test for sleep.But doing a print while doing lowpower mode , will cause lowpower mode not to complete. I would be interested in knowing how you code this, as I don’t have a meter to test current. And i don’t seem to get more than a few hours battery life when I am awake for 1 minute. transmit twice * 18bytes and sleep for 20 minutes, on a Heltec Solar cubcell .

I use this method to test lowpower has happend. This only works if you are not using the WDT while sleeping : As the watch dog timer will wake every 2 seconds. Loop and increment the TestCounter

       case LOWPOWER:

      //innerWdtEnable(true);
      TestCounter++;
      if (TestCounter>5){
      turnOnRGB(0x000050,0);// blue flash
      delay(250);
      turnOnRGB(0,0);
      }
      
      lowPowerHandler();
        break;