When getting battery shield data my 5110 LCD led turns off

Hi all!

I am building a portable Temp/Humidity sensor with DHT22, a small Nokia5110 Lcd, a Spark Battery Shield and our beloved Photon.

For now it seems to work fine but since I added the battery detection function I saw a very strange behaviour: the LCD led turns almost immediately off.

I tried initializing the Shield in setup but the result is the same.

What am I doing wrong?

This is my current code:

if I uncomment getBatteryData() the led turns off just after photon boot.

Thanks for your kind help

“Spark Battery Shield” is a bit ambiguous.
Do you really mean the mustache shaped one, or is it the SparkFun Photon Battery Shield, or is it the Particle Power Shield?

We’d need to know. Maybe you’ve got a pin collision.

Hii @ScruffR and thanks for your help :slight_smile:

Silly me, I wrote Spark and I meant SparkFun!

This is my hardware:

I’m using that SparkFun battery shield with Photon with no issues getting updates on I2C.

You are right taking these calls out of getBatteryData() and put them into setup.

    // Set up the MAX17043 LiPo fuel gauge:
	lipo.begin(); // Initialize the MAX17043 LiPo fuel gauge
	// Quick start restarts the MAX17043 in hopes of getting a more accurate
	// guess for the SOC.

	// We can set an interrupt to alert when the battery SoC gets too low.
	// We can alert at anywhere between 1% - 32%:
	lipo.setThreshold(20); // Set alert threshold to 20%.

Have you tested that POST to be sure it isn’t locking things up? I’d try commenting out the POST in the function to rule out any issues there as well (print to serial instead?). That interrupt may need clearing so you may be making that POST on startup, even if your battery is charged above the interrupt threshold.

Anyways, more serial debug is always better to try to see where things have gone pear-shaped.

My main bugaboo with that battery charging breakout is that there is no way to tell if the circuit is charging (in software or hardware). They missed that…

Here are the schematics of the Battery Shield

Check that against your setup to see if you’ve got some pin conflicts (esp. D0, D1, D6)

Simply fantastic, thanks!

Clearly a colliding pin, I’ve Read The Fabulous Manual :smiley:

Thanks: lesson learned.

1 Like