It depends on the range of currents involved. The ACS712 is a hall-effect sensor which is not particular accurate at low current, whereas shunt-resistor current-sensing can be very accurate, but severely limits the maximum current.Are you thinking of deliberately discharging a battery to test its capacity, or do you want to monitor some circuit to predict when the battery is nearly empty? What battery chemistry?With any current sensor you can measure total charge by integrating over time, but issues of accuracy and dynamic range are important as is the power consumption of the measurement circuit.
As I understand what you are asking is how to make a battery "fuel" gauge. It is possible. You could take most of the ideas from the video but realize you need to know the current capacity of the battery to determine how much energy is left. The capacity will change over time and is also temperature and load dependent. Since you are burning energy why not just add a low value resistor in the low side and measure the voltage drop, that would be more accurate then the hall sensor. Depending on what resistance you use you may have to add an amplifier circuit using an op-amp or other convenient method to get the voltage to something the Arduino can read. This has been tried many times and there is no perfect solution that I know about. You will have to determine the tolerance you can live with. This response is to help you get started in solving your problem, not solve it for you.Good Luck & Have Fun!Gil
An INA216 breakout board could be a better solution for your (unspecified) project.Voltage, current, power, all in one.Leo..
well the big question here is how to let my current sensor read the value of the battery in whatever state it is ?
Short answer: it can't.Voltage/current sensors just measure voltage/current.You have to figure out a way to make sense of that.The video constantly discharges a battery until the voltage drops below a certain point.Easy way to measure battery capacity at that specific current.Much harder if you want to keep track of remaining charge with varying loads.Googling "Arduino coulomb counter" might give you some hints.Leo..
Real life batteries have lower capacity at higher currents, so you might have to correct for that, and capacityfalls with time (self-discharge) and depends on temperature too.You'll probably want to use the battery voltage as well, to reliably detect the onset of full discharge as the coulomb-counting isn't highly accurate.
You got me curious so I did a bit of research and it is not that hard to make a battery fuel with an Arduino. You need at least 22 bits of analog conversion, This is from Analog Devices web page: "Coulomb Counter (Battery Fuel Gauge)Analog Devices' battery management gas gauges and coulomb counters accurately measure and report battery capacity in single cell or multicell handheld applications. Charge accuracy is uncompromised thanks to a variety of unique sensing techniques that appear seamless to the user. High-side current sensing allows downstream failure detection and avoids ground disturbance. Analog integrators digitize charge directly, resulting in cancelled amplifier offsets, minimal gain error, and better overall charge accuracy. Some models also provide battery voltage and temperature, while others integrate a sense resistor to minimize component count and increase accuracy even further. All devices have small footprints and provide simple digital interfacing with a host processor." You can get them assembled from Banggood, RobotShop and others for a few bucks. This response is to help you get started in solving your problem, not solve it for you.Good Luck & Have Fun!Gil
You got me curious so I did a bit of research and it is not that hard to make a battery fuel with an Arduino. You need at least 22 bits of analog conversion, This is from Analog Devices web page: "Coulomb Counter (Battery Fuel Gauge)Analog Devices'