digitaldanny / AudioEffectsGlove

A hand tracking glove that controls parameters of various audio effects.
1 stars 0 forks source link

Battery State of Charge - Prototype #42

Closed digitaldanny closed 3 years ago

digitaldanny commented 3 years ago

Describe the solution you'd like

Additional context Research for this issue was completed in #26.

digitaldanny commented 3 years ago

I will estimate the battery’s remaining charge or “State of Charge (SOC)” using a method called “Coulomb Counting.” This method involves estimating the state of charge by subtracting the current consumption from the initial capacity. The battery percentage can be estimated with the following formula:

(Q_previous - i_current deltaTime) / Q_total 100%

However, the error in this estimation will increase each time the battery is recharged. My goal is just to provide a rough estimation so the user knows to plug it in when it’s in the 10-25% range, so this will work well for my application.

An alternative that I considered is Open Circuit Voltage (OCV) estimation. With this approach, the battery charge can be estimated by comparing the battery’s open circuit voltage to the linear portion of the battery’s discharge curve. This would be simpler and more accurate; however, the battery would have to be an open circuit for each measurement. This would power off the microcontroller, disabling the necessary ADC pin along with the rest of the glove’s functionality.

digitaldanny commented 3 years ago

I switched to using the AD8226 instrumental amplifier instead of the INA114AP because it is a single supply rail-to-rail amp that can operate at 3.3V, which will work for my glove's 3.3V power source. I have the new in-amp hooked up on a breadboard to make sure it will sense voltage drops across the shunt resistor. My test is described below.

Powered with 5V (Working correctly) Diff Amp w 5V Power

Powered with 3.3V (Not functional) Diff Amp w 3 3V Power

Results:

digitaldanny commented 3 years ago

Current sensing circuit changed from original design with INA114AP in the first figure below to the following design with the AD8226ARZ. Adding some voltage dividers to halve the voltage before going into the in-amp fixed the problem I was seeing in the previous comment.

Original (INA114AP) INA114AP

New (AD8226ARZ) image

digitaldanny commented 3 years ago

Current circuits being used for Coulomb Counting included below.

image image