Comments (5)
I added a standalone sketch called Debug to the examples folder. It will display the device register values as well as the calculated values. This may help debug your issue.
Output from SparkFun fuel gauge:
Serial port initialized.
ADDRESS...........: 0x36 (54)
VCELL HIGH BYTE...: 0xC3 (195)
VCELL LOW BYTE....: 0x40 (64)
SOC HIGH BYTE.....: 0x40 (64)
SOC LOW BYTE......: 0xB3 (179)
MODE LOW BYTE.....: 0x00 (0)
MODE LOW BYTE.....: 0x00 (0)
VERSION LOW BYTE..: 0x00 (0)
VERSION LOW BYTE..: 0x03 (3)
CONFIG LOW BYTE...: 0x97 (151)
CONFIG LOW BYTE...: 0x1C (28)
PERCENT...........: 64.70%
ADC...............: 3124
VOLTAGE...........: 3905.00 mV
Output from clone device (this device does not work):
Serial port initialized.
ADDRESS...........: 0x32 (50)
VCELL HIGH BYTE...: 0xFA (250)
VCELL LOW BYTE....: 0xC0 (192)
SOC HIGH BYTE.....: 0xCC (204)
SOC LOW BYTE......: 0xEC (236)
MODE LOW BYTE.....: 0x00 (0)
MODE LOW BYTE.....: 0x00 (0)
VERSION LOW BYTE..: 0x00 (0)
VERSION LOW BYTE..: 0x03 (3)
CONFIG LOW BYTE...: 0x97 (151)
CONFIG LOW BYTE...: 0x1C (28)
PERCENT...........: 204.92%
ADC...............: 4012
VOLTAGE...........: 5015.00 mV
from max1704x.
Alright, so from what I am seeing in the Serial monitor is that I am not receiving SOC HIGH and LOW, as well as VCELL LOW BYTE.
Serial port initialized.
ADDRESS...........: 0x36 (54)
VCELL HIGH BYTE...: 0x86 (134)
VCELL LOW BYTE....: 0x00 (0)
SOC HIGH BYTE.....: 0x00 (0)
SOC LOW BYTE......: 0x00 (0)
MODE LOW BYTE.....: 0x00 (0)
MODE LOW BYTE.....: 0x00 (0)
VERSION LOW BYTE..: 0x00 (0)
VERSION LOW BYTE..: 0x03 (3)
CONFIG LOW BYTE...: 0x97 (151)
CONFIG LOW BYTE...: 0x7C (124)
PERCENT...........: 0.00%
ADC...............: 2144
VOLTAGE...........: 2680.00 mV
from max1704x.
If the voltage is correct, the battery is low and 0% makes sense. The voltage should be above 3.7v to operate effectively. At 100% it is usually at 4.2v or more. It is odd, however, that the VCELL LOW byte is 0.
from max1704x.
Here I am again, as of right now I got it 'working'. What issue seems to be occurring now is the follwing, I have a battery holder which can hold 2 batteries and it showcases a total of 5.12V (They have a max of 7.4V and they aren't fully charged. They have around 6V of power.) This isn't changing at all. I've implemented the adc and it's the same also, it remains at 4095. Nothing higher, nothing lower. What does change is the percentage, it's continuously rising and not stopping at 100%. However this is in my part of the code, when I am using your debugging code. It shows something completely different.
`Serial port initialized.
ADDRESS...........: 0x36 (54)
VCELL HIGH BYTE...: 0x2C (44)
VCELL LOW BYTE....: 0x40 (64)
SOC HIGH BYTE.....: 0x00 (0)
SOC LOW BYTE......: 0x00 (0)
MODE LOW BYTE.....: 0x00 (0)
MODE LOW BYTE.....: 0x00 (0)
VERSION LOW BYTE..: 0x00 (0)
VERSION LOW BYTE..: 0x03 (3)
CONFIG LOW BYTE...: 0x97 (151)
CONFIG LOW BYTE...: 0x1C (28)
PERCENT...........: 0.00%
ADC...............: 708
VOLTAGE...........: 885.00 mV
`
In your debug, the problem reoccurs where the percentage isn't showing, but we know what that reason is. But the one thing that confuses me a lot is where it shows different adc's.
I'm mainly using this code:
`
#include <MAX17043.h>
#include <Wire.h>
#include <LiquidCrystal.h>
#include <Arduino.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup(){
Serial.begin(115200);
Wire.begin();
FuelGauge.begin();
lcd.begin(16, 2);
lcd.clear();
void loop(){
float capaciteit = FuelGauge.percent();
float voltage = FuelGauge.voltage() / 1000;
Serial.print("Battery Percentage: ");
Serial.println(capaciteit);
Serial.print("Battery Voltage: ");
Serial.println(voltage);
delay(2000);
lcd.setCursor(0,0);
lcd.print("U: ");
lcd.setCursor(3, 0);
lcd.print(voltage);
lcd.setCursor(7,0);
lcd.print("V");
lcd.setCursor(0, 1);
lcd.print("Q: ");
lcd.setCursor(3, 1);
lcd.print(capaciteit);
lcd.setCursor(7,1);
lcd.print("%");
lcd.setCursor(10, 0);
lcd.print("T: ");
}
`
I'm currently working on a project for school and I hope this'll be resolved.
from max1704x.
The MAX17043 can only read a voltage of a single cell up to approximately 4.7V. Using two batteries in parallel would not be supported either.
Try issuing a reset() and then a quickstart() during initialization. See this example for more details: https://porrey.github.io/max1704x/examples/basic.
from max1704x.
Related Issues (15)
- Question about power consumption HOT 5
- Clone max1743 address 0x76 wrong readings HOT 7
- Aliexpress 0x32 Clone Support HOT 16
- Use Wire1 HOT 1
- Stopping charge HOT 8
- Fuel Gauge at 0x32 HOT 1
- Battery never shows more than 90% charge HOT 7
- ESP32 WEMOS LOLIN32 lite HOT 5
- Esp8266 Compilation Error HOT 1
- Why read sensor error,What do I do HOT 2
- Library should not initialize I2C subsystem itself HOT 2
- Inconsistent values HOT 6
- Add ESP32 support HOT 1
- Question. Is ok with max17040 or 17041? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from max1704x.