PiJuice wakeup not working when only battery power available

Hi there,

I’ve built a Raspberry Pi system to read from a weather station via RS485.

Here are the details:

  • Raspberry Pi 4 Model B 2GB
  • PiJuice with Core Electronics 20,000mAh battery
  • WaveShare 2-CH RS485 HAT (2-CH RS485 HAT - Waveshare Wiki)
  • Huawei external USB 4GX modem

Power is supplied from a solar panel into a regulator, with a 9Ah 12V SLA battery. The regulator’s load output has a 12V-USB adaptor, which is connected into the Raspberry Pi USB-C input, OR/AND the PiJuice Micro-USB input (I’ve tried all combinations and it makes no difference).

Everything works fine when the large external battery has enough charge to power the main Raspberry Pi board via USB-C; the unit boots up every 30mins, takes a reading from the weather station via the RS485 HAT, uploads it to my cloud app, re-sets its wakeup schedule, then shuts down. It does this happily throughout daylight hours, whilst also charging up the PiJuice’s battery, and it continues into late evening. Obviously, once sunlight has ended, the large external battery starts discharging.

Once the external battery has dropped below about 11.5V, everything stops, until the following day, after there’s been enough sunlight to charge the external battery enough that it can switch on the Raspberry Pi. Then, the ordinary wakeup/shutdown cycle continues until the external battery is discharged again.

Today I did a test by powering it up on from the Raspberry Pi USB-C input, then removing the USB-C power to let it run only on the PiJuice’s battery.

It reported the following:

GetIoCurrent() - 1.989A
GetBatteryCurrent() - 6.425A
GetBatteryVoltage() - 3.798V

When I re-set the wakeup timer after that test, it didn’t wake up again when it was scheduled to.

Previously, with Raspberry Pi’s USB-C power present, the values were:

GetIoCurrent(): 0.004A
GetBatteryCurrent(): 0.0A
GetBatteryVoltage(): 4.137V

The shut down/wakeup cycle continued successfully.

My script to configure the PiJuice before shutting down has the following:

pj.rtcAlarm.SetWakeupEnabled(True)

wakeup_interval_mins = 30

battery_profile = {'chemistry': 'LIPO', 'capacity': 20000, 'chargeCurrent': 2500, 'terminationCurrent': 50, 'regulationVoltage': 4180, 'cutoffVoltage': 3000, 'tempCold': 0, 'tempCool': 2, 'tempWarm': 49, 'tempHot': 65, 'ntcB': 3380, 'ntcResistance': 10000 }
pj.config.SetBatteryProfile('CUSTOM')
pj.config.SetCustomBatteryProfile(battery_profile)
pj.config.SetChargingConfig({'charging_enabled': True}, True)

# Make sure wakeup_enabled and wakeup_on_charge have the correct values
logging.info('Will wake up every: %s minutes.' %(wakeup_interval_mins))
pj.rtcAlarm.SetWakeupEnabled(True)
pj.rtcAlarm.SetAlarm({'hour': 'EVERY_HOUR', 'day': 'EVERY_DAY', 'minute_period': wakeup_interval_mins})
pj.power.SetWakeUpOnCharge('DISABLED')

pj.power.SetSystemPowerSwitch(0)
pj.power.SetPowerOff(30)

Any suggestions as to what I’m doing wrong?

Many thanks,
Tom