While converting an older Volkswagen
to electric power, we wanted to display
the battery voltage on the existing fuel
gauge. The gauge used an electromechanical
regulator to resistively control the
heating of a bi-metallic thermal strip. The
regulator is periodically pulsed by the vehicle’s
12-V battery power. The conversion
application provides a proportional control
uniquely coded to synchronize and scale
into the vehicle regulator’s proportionalcontrolled
power output.
Although proportional control doesn’t
require a controller (“Driver Offers Proportional
Solenoid Control Without PLC, Microcontroller,”
Electronic Design, Aug. 14,
2008, p. 73), the circuit we used is a good
example of the added value provided by a
controller. It also served as a nice solution
to my relatively unique problem.
In our application, isolating and monitoring
the motor’s dc voltage and converting it
to a chassis-based voltage was part of the problem. We used an
opticoupler to provide the isolated interface for the battery-tochassis-
based 12-V system power (see the figure).
The controller, a Microchip 16F506, monitors this re-referenced
battery voltage at pin 11. It also manipulates the delivered
regulated power to the fuel indicator’s bi-metallic strip, at
pin 10, by synchronizing and width-modulating the regulator’s
pulse signal. The controller provides an empty warning and
battery cut-out status when the battery voltage drops to below
limits set by the user.
The 16F506, with its three 8-bit analog-to-digital converters
(ADCs), measures the user-settable empty warning and battery
fail limits on power-up. It then monitors the power pulse’s
width at pin 5.
Measurement of the power pulse-width input and pulsewidth-
modulation (PWM) output control uses equally
delayed, coded timing loops of about 1 ms. By repeating the
two measurements on each cycle, the application accommodates
variations in the 12-V battery voltage
reflected in the vehicle’s regulator power pulse’s width and period. The code for the application can be found here in pdf format or text format.
The Zener diode voltage is set at 56 V, about 3 V below the
desired “empty battery” voltage. The opticoupler was selected
for its small transfer gain and minimum variation over temperature.
Absolute linearity isn’t a requirement. The “Set full”
potentiometer allows adjustment to accommodate variations
in the opticoupler’s transfer characteristic. The other adjustments
shown in the schematic help increase flexibility during
development. One or both may be hard-coded into the controller
as constants.
The 1-ms timing loops are simple, 8-bit register-based, cascaded
counters. In this application, the regulator’s pulse period
isn’t measured. Instead, only the power pulse’s active time is
measured, during which power is available to the fuel gauge’s
thermal strip.
This circuit accommodates power PWM periods up to 255
ms, with a usable minimum of about 32 ms, or power pulse
periods of 2 to about 30 Hz. The base loop period can be
reduced by changing a single variable constant in the code to
accommodate higher active period measurements of the regulator’s
pulse power.
The battery warning and failure control status outputs will
likely require additional buffer drivers, depending on whether
they’re used to drive a warning light from pin 3 or a batterydisconnect
relay using pin 6.