Part 2 of 5 · The instruments

The suspension controller

The PLCs in Part 1 switch things, but they cannot tell where the truck is or how it is leaning. This small controller can. It is the truck's main set of instruments today, and it will soon control the air suspension.

Roll−3.1°
Pitch+1.4°
Outside27.6 °C
Humidity48 %
Air pressure1009 hPa
Satellites14

EXAMPLE READINGS FOR ILLUSTRATION · NOT LIVE DATA

Why this name?

Named for its future job

We called it the suspension controller because its main job will be to control Tartaruga's four airbags. That job is not finished yet. Today the controller is the truck's instrument cluster. It measures position, movement and weather, and it makes those measurements available to every other device in the truck.

It is a small ESP32-P4 board in its own enclosure. It is programmed in C with Espressif's ESP-IDF framework, and it connects to the truck network over Ethernet.

The controller is a Modbus TCP server. It does not push its data to anyone. It keeps every measurement up to date in its own table, and any device that needs a value asks for it: the PLCs, the SCADA, the radar controller and, through the radar gateway, the web dashboard. This is the same Modbus TCP that every other controller in the truck uses.

In Part 1 we said that, with what we know today, we would not have chosen PLCs for this truck. This controller shows why. One small, low-cost board reads a satellite receiver, a motion sensor and several weather sensors, does the calculations, and serves the results to the whole network.

The suspension controller measures and calculates. It never switches anything itself.

The same rule from Part 1 applies here. The controller has no outputs that drive valves, pumps or motors. When it wants an airbag to move, it sends a request to a PLC, and the PLC decides whether to do it.

What it measures

What it measures

Satellite receiver

Position and time

  • Position, speed and direction of travel
  • Height above sea level
  • Number of satellites and quality of the fix
  • Distance from home

The receiver uses GPS and BeiDou satellites through an active roof antenna.

Motion sensor

Angle and movement

  • Roll: how far the truck leans left or right
  • Pitch: how far the nose points up or down
  • Yaw rate: how fast the truck is turning
  • Acceleration in all three directions

This is the information the airbags need, both while driving and when parked.

Weather sensors

Temperature and humidity

  • Inside temperature and humidity
  • Outside temperature and humidity
  • Air pressure, for the weather trend and a second height reading

Wind speed and sunlight are measured by the Underdash PLC, as described in Part 1.

From the PLCs

Airbag pressures

  • The pressure in all four airbags, read from the PLCs
  • Combined with roll and pitch, so the controller knows both the angle of the truck and the state of each bag
Driver input

Airbag joystick coming

  • Lets the driver level the truck on the move, by hand, without stopping
  • Joystick commands go to the PLCs as requests, like every other command
Exploded 3D view of the suspension controller: the mounting bracket at the bottom, the base with the electronics in the middle, and the cover lifted off at the top.
The suspension controller's 3D-printed case, drawn apart: the mounting bracket at the bottom, the base with the electronics, and the cover lifted off. Inside are the ESP32-P4 board with its network socket, the GPS module, the motion sensor, the power supplies, and plugs in the end wall for the temperature sensor and the joystick. A 3D model made from the case design; the parts inside are simplified.
PHOTO TO COME
GPS antenna and weather sensor
The roof antenna and the outside weather sensor.
One clock for the whole truck

Time synchronisation

The satellite receiver gives very accurate time. The suspension controller reads it and uses it to set the clocks of the two CAN bus controllers (Part 4) and the radar controller (Part 3).

This means every recorded event and every measurement in the truck is on the same timebase. If the engine computer logs a fault, the radar sees movement at the rear, and the truck is at a certain place on the map, all three records carry the same time. Without one common clock, records from different controllers cannot be lined up afterwards.

Comfort and protection

Temperature and humidity

Two sensors on the suspension controller measure temperature and humidity: one inside and one outside. In southern Africa the difference between the two can be very large: desert days in the Namib and the Richtersveld can reach 50 °C. Both values are shown on the SCADA, on the radar touchscreen and on the web dashboard.

The electronics also report their own temperature. The two CAN bus controllers (Part 4) share an enclosure with a small cooling fan. Each controller measures the temperature of its own chip, and the fan speed is set from the higher of the two, so the fan stays off most of the time.

Where the data goes

Measured once, used everywhere

Every measurement is made once, in this controller, and then shared. No other device in the truck needs its own GPS or its own motion sensor.

  • The PLCs receive the angle of the truck and the airbag requests.
  • The SCADA on the truck PC shows position, angle and weather, and records the GPS track to a database.
  • Navigation on the truck PC. The controller also sends standard GPS sentences (NMEA) to the truck PC. Franson GPSGate turns them into a GPS signal for Garmin nRoute, which navigates live from it.
  • The CAN bus controllers and the radar controller take their time from it.
  • The radar controller (Part 3) shows the readings on its touchscreen and passes them through the gateway to the web dashboard (Part 5).
The air suspension

Four airbags, and three ways to use them

Tartaruga has an airbag at each corner. Each bag has its own pressure sensor and its own inflate and deflate valves. A compressor at the rear supplies the air. The rear bags are controlled by the Airbag PLC and the front bags by the Underdash PLC.

Today the bags are set by hand from the SCADA. Soon the driver will also have a joystick, to level the truck by hand while driving. The PLCs already enforce pressure limits and a maximum open time for every valve. What is missing is the automatic part, and that is the suspension controller's job. This is how the chain will work:

While driving in progress

On a long side slope or in a series of bends, the controller sees the roll angle and the turning rate. It asks for the low side to be raised and the high side to be lowered, to keep the camper body as upright as possible.

At camp planned

Park, select levelling, and the bags bring the camper level in both directions. No more ramps and no more sleeping with your head lower than your feet.

Off-camber planned

On a steep side slope off-road, the bags on the low side are raised to bring the camper body closer to upright, within the limits the PLCs allow.

In every mode the final decision stays with the PLCs. If the suspension controller stops or sends nonsense, the PLCs keep the bags inside their pressure limits and stop moving them after their time limit.

PHOTO TO COME
Airbag and valve block
One of the airbags and its valves.
What it taught us

The difficult parts

A sensor is not always what the label says

The motion sensor board was sold as a 9-axis sensor with a built-in compass. When we asked the chip to identify itself, it reported a 6-axis part with no compass at all. Roll and pitch work perfectly, but heading has to come from the satellite receiver instead. Now we check the identity of every chip before we design around it.

Read the numbers, not the datasheet

The joystick was expected to return 12-bit values. It actually returns 16-bit values, so every calibration constant was wrong by a factor of sixteen. Only measuring the real output showed this.

Antennas need power too

The active GPS antenna needs a supply voltage from the receiver board. With the board running at 3.3 V, the antenna supply was too low for reliable reception. Moving the board to 5 V solved it.

A new chip has new problems

The ESP32-P4 was very new when we started. Early silicon has known faults, the development tools were changing every few months, and some features we wanted, such as a wireless link between controllers, were simply not supported. We finished the first phase, recorded a fixed baseline version with a full technical record, and closed it before adding anything new.

One USB cable is not enough

The board will not run reliably from a single USB port. It needs a separate supply for power, and a second connection for programming and monitoring.

Still growing

What comes next

Next: Part 3 describes the radar controller, its radar sensors, and the gateway to the outside world.

The series

How the truck thinks