Last update: May 5 2017
A custom circuit with an Arduino microcontroller operates the existing fuel gauge. This device is powered when the car is turned on as well as during charging.
The microcontroller circuit monitors battery discharging and charging via a LEM HTFS 800-P current sensor. This sensor shows an offset error of about 2A with no current flowing. The error varies over time with observed values as low as 0.9A and as high as 2.7A. Most observations are 1.9A-2.1A. The microcontroller program applies a correction bias of 2.0A to compensate for the offset error. To make the sensor agree with the JLD404 power meter, a scaling factor of 0.998 is applied to slightly reduce the current reading.
During charging, the microcontroller program detects when the current level is near the level 1 or level 2 charger output. In this case, the charge calculation ignores the actual current sensor reading and instead uses a fixed current rate selected so that the fuel gauge shows exactly full at the end of charging. This compensates for sensor drift as well as the batteries taking in more charge than they put out.
The circuit uses a 13-bit analog to digital converter to read the current sensor, the Microchip Technology MCP-3301-C. The resulting measurement precision is 0.4A. With the Arduino built-in 10-bit ADC, the precision would be 3.1A. The car draws about 1.2A when idle.
A wire wound ten turn potentiometer stands in for the fuel level sensor. The microcontroller turns the potentiometer by a stepper motor coupled to it. The position of the potentiometer is how the microcontroller remembers the fuel level when the car is turned off. Upon startup, a relay temporarily switches the potentiometer out of the car circuit and over to the microcontroller so that the position can be read. This technique avoids the complexity involved in working around the Arduino EEPROM's limited write cycle life.
The gauge does not respond linearly to the sensor resistance. As fuel is depleted, the needle moves slowly from full to 3/4, then quickly to 1/4, then slowly to empty. The microcontroller program applies a correction to make the needle position linear and proportional, which is helpful for predicting range. Unfortunately, the 3/4 and 1/4 tick marks are not spaced evenly. The low fuel warning light is specified to turn on at 15% remaining gasoline. However, the warning light turns on at the last 5% of the angle between the maximum and minimum positions, just below the bottom tick mark.
Circuit diagram below. The circuit includes some capability that was only used during early prototyping. Specifically, the circuit is connected to the vehicle speed sensor and also can detect whether the car is plugged into an EVSE. Source code is here.
The motive battery pack state of charge is displayed on a JLD404AH Digital Amp Hour Meter mounted under the radio. This device is powered when the car is turned on as well as during charging.
The JDL404 is connected to both the high voltage system as well as the 12V system. To prevent a connection between the two systems, the 12V supply to the JLD404 passes through a small isolated DC-DC converter, the DEXU RF1212CS-2W. In this configuration, the JLD404 draws 73mA from the 12V system.
The radio rack is a double DIN size. The radio occupies one space. The other space contains a plastic pocket (Subaru part 66128AE000) with the JLD404 mounted in it, leaving just enough storage space for sunglasses.
The JLD404 is connected to a 75mV 1000A shunt, which is mounted on the right side of the firewall.
The wires from the shunt to the JLD404 are twisted to reduce EMI.