Metro Mini - Issues Displaying Battery Parameters

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
tylerdileo
 
Posts: 13
Joined: Tue Oct 18, 2022 7:14 am

Metro Mini - Issues Displaying Battery Parameters

Post by tylerdileo »

Hello

I've got a Metro Mini 328. The USB pin on the Metro Mini is wired to a Micro Lipo Charger (1904), then the output from the charger is split to a MiniBoost (4654) and a fuel gauge (4712). The output from the miniboost is then sent to the Vin on the Metro Mini. The fuel gauge is wired to the I2C pins on the Metro Mini. This is all topped off with a Serial backpack/16x2 LCD (782). This setup affords me the ability to both charge the battery and communicate through the USB on the Metro Mini. I used the sample code for the fuel gauge to print the battery parameters to the serial monitor, and everything worked fine. My trouble comes when I try to send information from the fuel gauge to the LCD. I've found the following line will cause everything to hang up:

lc.setPackSize(LC709203F_APA_500MAH);

If I comment that line out, I can get the program to run, but anything reported by the LC709203F library displays as 0 on the LCD.

Here is the code, minus the LCD setup lines:

#include <SoftwareSerial.h>
#include "Adafruit_LC709203F.h"

Adafruit_LC709203F lc;
SoftwareSerial lcd = SoftwareSerial(0,3);

void setup() {
lc.setPackSize(LC709203F_APA_500MAH);
lcd.begin(9600);
}

void loop() {
lcd.println(lc.cellPercent(),1);
}


The example for the battery gauge sets a rate of 115200 baud to the serial monitor. I noticed that the LCD literature states 9600 baud. I don't know how to change the rate for the LCD over serial, because if I change the lcd.begin() to anything but 9600, I get scrambled output on the LCD. The documentation for the LCD screen says you can change this rate, but doesn't go in to any details. To me, none of that explains the lc.setPackSize issue. Any guidance would be greatly appreciated! Thank you.

User avatar
dastels
 
Posts: 15659
Joined: Tue Oct 20, 2015 3:22 pm

Re: Metro Mini - Issues Displaying Battery Parameters

Post by dastels »

Where is the battery connected in this?

I ask because the fuel gauge has to be connected between the battery and what the battery connects to. See https://learn.adafruit.com/adafruit-lc7 ... ry-monitor.

Dave

User avatar
tylerdileo
 
Posts: 13
Joined: Tue Oct 18, 2022 7:14 am

Re: Metro Mini - Issues Displaying Battery Parameters

Post by tylerdileo »

I have the battery connected directly to the fuel gauge via the provided JST connector. The fuel gauge was powered by 5 vdc from the metro mini. The output of the fuel gauge goes directly to the metro mini via the I2C pins. In the future I will have the battery connected to both the charger and fuel gauge in parallel. I can see how what I posted made it sound like I had a wiring issue. My apologies.

I do get valid results when using the serial monitor (i.e. voltage, percent capacity, etc.).

User avatar
dastels
 
Posts: 15659
Joined: Tue Oct 20, 2015 3:22 pm

Re: Metro Mini - Issues Displaying Battery Parameters

Post by dastels »

Don't connect them in parallel. Connect the battery to the fuel gauge, then the fuel gauge to the charger. Basically battery+gauge should be used exactly as you would use the battery by itself. The two JST (battery) connectors on the gauge board are the same electrically.

Dave

User avatar
tylerdileo
 
Posts: 13
Joined: Tue Oct 18, 2022 7:14 am

Re: Metro Mini - Issues Displaying Battery Parameters

Post by tylerdileo »

Thank you for the replies, Dave. My test set up excludes the use of the charger, but I will be incorporating it in to my final design. I still have the software hurdle to get over: battery parameters work on the serial monitor, not on the LCD. Any thoughts on that?

User avatar
tylerdileo
 
Posts: 13
Joined: Tue Oct 18, 2022 7:14 am

Re: Metro Mini - Issues Displaying Battery Parameters

Post by tylerdileo »

See attached schematic.
circuit.png
circuit.png (32.2 KiB) Viewed 129 times

User avatar
dastels
 
Posts: 15659
Joined: Tue Oct 20, 2015 3:22 pm

Re: Metro Mini - Issues Displaying Battery Parameters

Post by dastels »

That looks reasonable.

Dave

User avatar
tylerdileo
 
Posts: 13
Joined: Tue Oct 18, 2022 7:14 am

Re: Metro Mini - Issues Displaying Battery Parameters

Post by tylerdileo »

Thanks for your patience. I figured it out. I failed to call begin.lc, so it’s no wonder the lc functions were sending zero.

Locked
Please be positive and constructive with your questions and comments.

Return to “Metro, Metro Express, and Grand Central Boards”