Boron Solar Charging with 1.5.0 PMIC issue

@OziGreybeard, 1.5.0 allows you to completely disable the new DeviceOS System Power features.

Something similar to this might get you started:

SYSTEM_THREAD(ENABLED);

PMIC pmic;
SystemPowerConfiguration conf;

STARTUP( turnOffPowerFeature() );   
// see https://community.particle.io/t/boron-solar-charging-with-1-5-0-rc1/54680/10?u=rftop

void turnOffPowerFeature()  {
    conf.feature(SystemPowerFeature::DISABLE);
    System.setPowerConfiguration(conf);
    pmic.begin();
  // all of the PMIC calls that you want go here
    pmic.disableCharging();
}

void setup()  {
}

void loop()   {
}


1 Like

Thanks @Rftop. That did the trick nicely.

@Rftop Sadly I spoke too soon - it improved but is still faulty.

The system had been running with power from the computer and continued to start up repeatedly without hanging. Hence my message.

However, when I left it off for a period it refused to start without a reset. It’s almost as if there is some storage effect that allows the processor to restart when it has been on but fails if it has been off for a while.

Hence it is better than it was but is still inadequate. Given the intended use this would mean that the patient would need to switch the unit on and off twice to get going.

@no1089 Can you offer any insight into this behaviour?

@OziGreybeard I’m under lockdown for the moment and won’t be able to properly test anything until the first week of May.

What I do see in @Rftop’s code is that the PMIC pmic; is being called right up top, it should be part of the function and not called globally.

Try this:

void turnOffPowerFeature()  {
    conf.feature(SystemPowerFeature::DISABLE);
    System.setPowerConfiguration(conf);
    PMIC pmic(true);
    pmic.begin();
  // all of the PMIC calls that you want go here
    pmic.disableCharging();
}

Could you provide clear and comprehensive code snippets for turnOnCharging() and turnOffCharging() that is expected to work in the new 1.5.0 which we can use to enable/disable VUSB solar charging based on temperature? I’ve been patiently waiting for Particle to fix these issues and was very happy when 1.5.0 came out thinking that they may now be fixed, but there is an indication above in this thread that that might not be the case. I repeat the sentiment above that this is all useless if we can’t dynamically enable/disable charging. Once we can do that, the Boron becomes VERY useful to me.

If you gave me clear turnOnCharging() and turnOffCharging() functions, I would happily test them and use cloud functions to go 2-days on 2-days off, etc. and make sure the results are consistent and stable. The last part is key because I was having Borons crash simply from valid PMIC calls in the old versions.

3 Likes

Thanks @no1089

I modified the code as per your listing but regrettably that does not resolve the issue.

If the unit has been powered down for more than a few seconds it hangs with the yellow led flickering when power is applied. It can be made to run by either hitting reset or by powering off then powering on again. If power is switched off then on again with a short delay it operates ok.

I would appreciate it if you could look at this when you manage to return to the office. In the interim I will develop a short test code and will try it on another Boron as well as an Argon.

The test code will also look at a failure in the mirrorTo function which appears to have been introduced in 1.5.0. It mirrors when in Safe Mode and DFU mode but is otherwise inoperable.

Thanks
Bruce

2 Likes

@Paul_M @OziGreybeard
It’s been a hectic few days, I’ll endeavour to get you something next week.

1 Like

I’m back in the office with my tools. Working to get more info on here tomorrow. :slight_smile:

@no1089 Chris, any updates?

1 Like

Yes, I’m receiving measuring equipment hopefully by the end of the week that will help me quantify the issues and provide proper guidance.

I’ll update next week.

UPDATE:
I’m still waiting on equipment stuck in customs :frowning:

@no1089, any updates here? and is there a change regarding PMIC in OS 2.0?

Hi @superseb, I’m not sure which of the above issues you were tracking, but for me the 2.0 release resolved https://github.com/particle-iot/device-os/pull/2147 , which means I don’t have to call the PMIC class (to enableBuck) any more.

Now I only use the System.setPowerConfiguration features. This has resolved the issue with the device refusing to charge on solar after waking via EN pin.

I also saw benefit from https://github.com/particle-iot/device-os/pull/2116 where the battery level was stuck reporting as 312%, which then rendered any logic using battery levels useless.

Thx Sam

2 Likes

There were two small PMIC changes in 2.0.

My tests have indicated charging works reliably. How is your device failing? Have you reset the power configurator to defaults?

1 Like

I was not using version 2.0 yet. I will give it a try. Today using PMIC required us to spend 4s in the setup which was very inefficient power wise as we needed big delays when interacting with PMIC.
FYI another useful feature would be to enable charging the battery at lower voltage. For long term use a voltage around 3.9V allows the battery to sustain a lot more charge cycles.

Please try it, among other things connectivity is also greatly improved.

I’ve never tried charging that low, the PMIC can go down to 3.504V – Confirmed, the power configurator will allow you to set the charge voltage this low.

@no1089
So can you recap for me what commands I am supposed to use in version 2, and what i can get rid of? Currently I do something similar to the last post in this thread:

Like most users all I really care about is those 3 lines:
pmic.setInputVoltageLimit(5080); // for efficient solar panel
pmic.setInputCurrentLimit(900) ; // dont care cause I use a small panel
pmic.setChargeVoltage(3950); //to be nice to the battery
pmic.setChargeCurrent(0, 0, 1, 0, 0, 0); //1024mA

You need to tell the PMIC what voltage to expect, and the current the panel can provide.
5080mV is rather high, and if shade hits the panel and could drop below this limit, which will shut off power.
900mA is also very high, what spec is your panel? At 5.080V and 900mA that’s a 4.5W panel?

You can use the following, but at such a low termination voltage, you lose a lot of charge:

void setup(){

  conf.powerSourceMaxCurrent(900)
      .powerSourceMinVoltage(5080)
      .batteryChargeCurrent(1024)
      .batteryChargeVoltage(3950);
  System.setPowerConfiguration(conf); // retains these settings
}

Ok so this code would have to be run at every power cycle/RST of the boron in the setup? I wasn’t familiar with conf. and only used PMIC., any recommendation between both?

Exactly it’s a 5W panel, oversized for installations in forests. I looked at the MPPT point for the panel and it’s optimal around 5.5V, but you’re right it’s wiser to optimize it for shady conditions som aybe around 4.8V.
Why is sourcemax current ever needed? the boron PMIC shouldnt need this parameter and just draw current to match batterychargecurrent, and if the source can’t handle it it should just try the max it out.

Just as a point of reference, using 5.080V will still provide more charging with a 6V Solar Panel in Cloudy Conditions. See the general graph in this post

I agree, it's my opinion that SourceMaxCurrent isn't near as useful at SourceMinVoltage for most circumstances involving Solar Panels. Solar Panels are 'Current Producing" sources, but we cant do much with current if the Voltage isn't higher (+ a minimum Overhead) than the battery that we are trying to recharge. That's where the PMIC's DPM (Dynamic Power Management) shines on two fronts.
By using powerSourceMinVoltage(5080), the PMIC will operate the 6V Solar Panel at the max effeciency that it's able to, no matter the light intensity.

Here's a clip from the datasheet:
8.3.2.2 Dynamic Power Management
To meet maximum current limit in USB spec and avoid over loading the adapter, the bq24195L, bq24195 features Dynamic Power Management (DPM), which continuously monitors the input current and input voltage. When input source is over-loaded, either the current exceeds the input current limit or the voltage falls below the input voltage limit. The device then reduces the charge current until the input current falls below the input current limit and the input voltage rises above the input voltage limit.

Regarding the Li-Po termination voltage, it's just personal preference based on each project's goals.
If your Li-Po can meet your Design Power Budget with it's remaining capacity at 3.9V, then there's no harm there.
I feel like the default of 4.1V is a great "all around" number.
I've even started switching to 4.2V during the Winter Months for most Li-Po Solar Projects, as it helps tremendously during a cloudy week or two.

If space isn't an issue, then a 12V Panel and 12V SLA make life easy, as Power & Sleeping are no longer main aspects for the Project.