EGas Gauge for an EBike

by rgsparber in Circuits > Arduino

172 Views, 0 Favorites, 0 Comments

EGas Gauge for an EBike

IMG_3218.JPEG
IMG_3325.JPEG

My eGas Gauge is a "Coulomb Counter." It measures the current out of my eBike's battery once per second and subtracts it from the remaining ampere-hours. It then displays the result on the two LEDs. The number of flashes indicates which quarter we are in and which LEDs flash says where we are within the quarter.

Keeping track of ampere-hours is far more accurate than measuring the battery's voltage, especially as the load current fluctuates.

The user first fully charges up their battery and rides until they feel the battery is empty. Then they tell the system to Calibrate. Each time they charge the battery back to full, they tell the system to Initialize.

The system alerts the rider when the AA batteries need to be replaced. These batteries should last over 200 hours of riding. The rider is also alerted when the ATtiny85's EEPROM wears out although it should last at least 7 years.

The parts count is low: an ATtiny85, two LEDs, four resistors, two capacitors, a toggle switch, and a battery holder. The current shunt resistor is the existing wire that runs from the battery to the bike's Controller. The piezoelectric beeper shown in the picture is no longer used.

The program occupies half of the ATtiny85's program store.

Details are provided including a user's guide and theory.

Supplies

R1 3.9K, 0.1W, 10%

R2, R3 10K, 0.1W, 10%

R4 330, 0.1W, 10%*

LED 1 & 2 Red LEDs

C1 0.01uf

C2 2.2uf, 16V electrolytic

Center off DPDT toggle

J1 – J3 Keyed 3 pin connectors

3 AA Batteries

3 AA battery holder

ATtiny85

8 pin DIP socket

Schematic

See page 22 of my document for the schematic. Keep C1, C2, and R1 close to the ATtiny85. Details of how to wire J1 to the eBike are on page 25.

Load the Software

I use a USBtinyISP to program the ATtiny85. The latest version of the software is here.