Giter Site home page Giter Site logo

Comments (5)

porrey avatar porrey commented on July 16, 2024

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.

Cicrumstonce avatar Cicrumstonce commented on July 16, 2024

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.

porrey avatar porrey commented on July 16, 2024

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.

Cicrumstonce avatar Cicrumstonce commented on July 16, 2024

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.

porrey avatar porrey commented on July 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.