The energy account · Part 2 of 2

The battery monitor

The biggest challenge in the whole energy system is not making power. It is knowing about it. To answer that, we must measure the voltage of each battery and every ampere that goes in or out. Most battery monitors measure the current with a shunt, a small resistor in the main battery cable. We do not allow a shunt in our battery system. This page explains why, and how we measure the current instead.

The camper battery current sensor: a blue LEM HASS 400-S current transducer on a black 3D-printed base, with a copper bar passing through its window, a small printed box with a round metal 4-pin connector, and four mounting holes.
The camper battery sensor. The copper bar carries the full battery current straight through the window of the blue current transducer. Nothing touches the bar electrically.
The questions

What we want to know

The balance

How much energy is stored?

Not a voltage, but an amount of energy that we can plan with.

The level

How full or empty are the batteries?

At any moment, at camp or on the road, from the truck or from the dashboard.

The health

How do the batteries perform under extreme use?

Very hard charging from the alternator and very hard discharging, for example when the battery systems are joined to start the engine.

The income

Where does the energy come from?

How much comes from burning diesel, how much from paid shore power, and how much free from the sun.

Like a bank account, the batteries have income, spending and a balance. The monitor is the bookkeeper. Without it, every one of these questions is answered by a guess.

Why no shunt

Measuring without touching the current

A shunt works by creating a small voltage drop in the battery cable, and measuring it. That voltage drop is the problem. It sits between the battery and everything else, so every other voltage measurement in the truck sees a slightly different battery. When you try to work out the energy in the battery, those small differences add up to wrong answers.

We use Hall-effect current transducers instead. The battery current flows through a copper bar that passes through the window of the transducer. The transducer measures the magnetic field around the bar and gives a voltage proportional to the current. There is no electrical contact with the bar and no voltage drop in the cable.

No resistor in the battery cable, so no false voltages anywhere else in the truck.

Two batteries, two problems

One sensor per battery

There is one monitor for the camper battery bank and one for the Iveco starting battery. They have very different jobs.

Camper bank

LEM HASS 400-S

Rated for 400 A. It measures everything that goes in from the alternator, the solar panels and shore power, and everything the camper uses.

Iveco starting battery

LEM HASS 600-S, planned

The difficult one. The starter motor draws 300 to 400 A on a normal start, and up to 600 A at most. The same sensor must still see the battery's standing current of about 3 A, and 25 to 30 A with the engine running.

Our target is a resolution of about 0.1 A around 20 A. That is enough to see the energy flow, without pretending to a precision that the rest of the system does not have.

The starting battery's voltage gets its own sense wire. The Iveco's engine computer reports a battery voltage, but it measures it inside the computer, at the end of the vehicle wiring. It is not accurate enough for counting energy.

The sensor

A copper bar on a printed bracket

The first idea was a sealed box at each battery, with the transducer, a copper bar and all the electronics inside, and a cable with power and data to the controller. Space at both batteries is tight, and that box kept growing.

The final design is simpler. A 3D-printed base holds the transducer and a short copper bar. The battery cables bolt to the ends of the bar. The transducer is robust, so it does not need a box around it. A small printed housing on the base carries the transducer's four wires (supply, 0 V, output and reference) to a round 4-pin metal connector. A cable runs from there to the electronics. Brass inserts in the plastic take the screws, so the bracket can be opened and closed as often as needed.

The sensor bracket taken apart: base with the transducer, the open connector housing with coloured wires, the lid with two screws, the cable plug and an Allen key.
Taken apart. Base, transducer, connector housing, lid and the cable plug.
Inside the connector housing: four coloured wires from the transducer's plug soldered to the back of the round 4-pin connector, with brass inserts in the corners.
Inside the housing. The transducer's plug, four wires and the back of the connector.
The assembled bracket seen from the connector side, with the 4-pin socket, a printed clamp strap held by two cap screws, and the blue transducer behind.
Assembled. The 4-pin socket and a clamp strap that holds the copper bar down.
Close-up of the cable plug screwed onto the bracket's socket, beside the clamp strap over the copper bar.
Plugged in. The screw-on plug cannot shake loose on a corrugated road.

TAP TO ENLARGE

The electronics

A 16-bit converter on a hand-built board

The transducer's output is an analogue voltage. The ESP32's own analogue inputs are not good enough to read it, so a separate 16-bit analogue-to-digital converter, an ADS1115, does the measuring. The ESP32 reads it over I²C, a short two-wire data connection.

The converter sits on a small hand-built stripboard with its own voltage regulators. Like every external device in the truck, it does not take its power from the ESP32 board. Only the data lines and 0 V connect to the ESP32.

For the camper battery, this board sits inside the starting battery charger box (Part 1), and the charger's ESP32 reads it. The values then go out on Modbus, like every other measurement in the truck, to the PLCs, the SCADA and the dashboard. Where the electronics for the Iveco battery will sit is not decided yet.

Stripboard with a blue ADS1115 16-bit ADC module, two voltage regulators, electrolytic capacitors, four precision resistors, jumpers and a 4-pin white connector.
The converter board. The ADS1115 module, the regulators and the input parts.
The converter board with the transducer cable plugged in (blue, green, red and black wires) and the supply wires connected.
Connected. The transducer cable and the supply wires in place.
The copper side of the stripboard, with tracks cut between the component rows.
Underneath. The copper strips are cut where each circuit must be separated.
The converter board held in a hand, showing how small it is.
Size. It fits in the palm of a hand.
Making it accurate

Calibration and temperature

A Hall-effect transducer is not perfectly straight from zero to full scale, and its output moves a little with temperature. The plan is to calibrate each transducer with a current injector across its whole range, and to correct for temperature in software. The truck already knows the engine bay and camper temperatures, so no extra sensors are needed for this.

What it taught us

Decisions on the way

Measure what you want to know

At first the monitor was designed around what the charger needed. That was the wrong question. The monitor exists to keep the energy account of both batteries, all the time, whether the charger is running or not.

Keep it off the vehicle's data bus

Battery sensors with a CAN bus output are available. We did not want anything of ours that could disturb the Iveco's own CAN bus (How the truck thinks, Part 4 explains why). The monitor has no CAN connection at all.

The simple bracket won

The sealed box with everything inside it looked tidy. A bracket that holds the bar and the transducer, with the electronics in a box that already exists, is smaller where space is tight and easier to repair.

Where it stands

Built, not yet installed

The camper sensor bracket and the converter board are built. New camper batteries arrive in the coming days, and the monitors will be installed with them. Then comes calibration. The Iveco battery sensor follows.

Until then, the questions at the top of this page are a goal, not a result. When the monitors are working, the energy account will be shown on the SCADA and the dashboard: the balance in each battery, and the share of income from diesel, shore power and sun.

Real battery current will also improve two things in the control system: the battery boost logic (How the truck thinks, Part 1) and the under-voltage protection (Part 3). Both can then be based on measured energy instead of voltage alone.

The series

The energy account