Issue with using Core in a new Sparkfun Battery Shield

Interesting trend I observed in more recent data logging:

In a test sketch, I have a Photon that is never going to sleep (because there’s a bug with it connecting to wifi after, grr) and every 5 minutes (millis + 300000) it publishes an event that IFTTT dumps into a google spreadsheet.

Going by the spreadsheet, the battery reported the 255.9960375 soc until it flatlined and died. I plugged it into a power source, and the first couple readings were actually different, believable figures, as it began charging! And with each reading the voltage rose, until it hit the 5.1187, at which point the SOC went haywire again. So, if the voltage is ramping up, it is fine, but at typical it borks it?

More as more data arrives…

1 Like

@peekay123 Any revelations in your testing?

I ran it for several days and found that if I unplug the battery for about 30 seconds, and plug it back in, the very first read is accurate, and then it immediately pegs back to the 256 value. Resetting the core via System.reset() doesn’t suffice, I have to actually yank the battery.

I also tried using the sleep and wake methods for the MAX17043 IC, seemed to have no impact.

Kind of at a loss here - I can figure out my drain baseline through exhaustive testing, but it will take drastically longer if I can’t use the fuel gauge, and it will also prevent me from using the alert functionality.


I have used the MAX17043 quite successfully with other systems. Sparkfun has a “fuel gauge” based on it. I think the problem you are having are caused by issues with the Photon’s I2C firmware, and according to other posts, a fix for which is currently being tested.

One thing I don’t like about this Battery Shield is it is delivering battery voltage to the VIN pin on the photon when not connected to USB or optional power jack. Ideally it should also have a boost power section to deliver 5V to VIN instead, with a LDO set around 3.2V or so to shutdown before damaging the battery or causing brownout of the Photon.

Folks, the Particle team is testing an I2C fix which should address this issue once and for all.

@peekay123 Is there a particular thread I can bookmark or monitor to get an update as to when that fix is live?

@patrickcentral, there is another thread pertaining to I2C. The issues has not been entirely resolved yet.

Could someone look into this again? I’m using the sparkfun battery shield with the updated firmware (0.4.4 updated automatically through flashing on particle build) and I’m still seeing the same number here for SOC - 255.99609375.

Is the fix live, should this be working?


@gelicia I have found marginal improvement with 0.4.4 in that if I remove the battery from the connector, and plug it back in, it will read correctly until I connect it to USB again. Obviously this is not a long term solution as I need this to work through charges in a sealed container, but it’s getting…better? Ish?

I only ever get the 255 number, even after getting that variable right after plugging in the battery. Could someone who was working on the I2C stuff look into this? @peekay123 ?

are you guys still observing this issue? I’m currently unable to reproduce it. @gelicia @patrickcentral

I am still having the issue, is there a way to tell from what version of the firmware a photon is running if you don’t trust ? Since I had no change after updating, I’m wondering if maybe my firmware wasn’t updated.

I also have two of these boards now and they both do the same thing.

For what it’s worth I am occasionally seeing this issue with 0.4.5 although it works much of the time. When it happens, hitting the reset button does not fix it, and after the photon has rebooted the other I2C devices are not able to communicate properly. Only after disconnecting power from the entire system for a while (~30 sec) and powering up again does I2C start working normally again. It almost seems as if the MAX17043 is locking up the lines for some reason (though I have not measured) and the power off is needed since the chip has an RC filter on its power input.

When I followed the instructions, I got that I was running system firmware version: 0.4.4

When I uploaded this last time, instead of selecting Latest (0.4.5) I selected 0.4.5. That seems to have done the trick. It flashed magenta for a while, but when it came back up I was getting legit values for SOC.

I’ll be seeing if my reliability has problems like others are reporting, but I am set for now! Thank you!

I have been out of town, but when I got back and did a web IDE reflash, it’s been giving me correct info, even as I plug and unplug it from USB. I would like to get more than a few hours of data to say conclusively that it’s stable, but it definitely seems to be more stable.

The reflash seems to have broken my IFTTT recipe that wrote this monitor info to a Google Spreadsheet, though…

IFTTT seemed to have lost its authentication to Particle randomly (all recipes failed,) so that was an easy fix. Curious as to what triggers that, but I bet it is on their end.

Thus far, battery reading seems solid with current firmware. I have another issue I’ll start a separate topic for.

@gelicia Any further issues from you? If not I think we can close this.

Yep, I’m good now. Thank you to everyone who helped me out :slight_smile:

I’m not having the same problem exactly, but I am getting weird values for my SOC. I am just publishing the value to a Google spreadsheet but the raw values currently are 1,079,406,592.00. It goes up while charging and down when unplugged so I believe it is working, but just not sure why the large number. I am using a photon with the newest firmware. Anyone have a thought?

I am having this problem now, and I am using firmware version 0.6.0…
Does anyone have any suggestions? I’m thinking of flashing using version 0.4.5 but I don’t think that will be a long term solution, assuming it even works.

Thanks in advance.


I’m a new Photon and Shield user. I have done some testing
with good result and now i run into the exact same problem.

My firmware is the last 0.6.1.

Does anybody have a solution to this problem ?