Part 3 of 5 · Eyes and the gateway

The radar controller

This controller watches the area all round the truck with radar sensors that report to it over Wi-Fi. It gives the driver a large touchscreen, and it connects the truck to the outside world. It is built and working on the bench, and it will be installed in the truck next.

Why this name?

Radar sensors all round

The controller is named after its radar sensors. Three are fixed to the truck: one on the left side, one on the right side, and one on the back facing backwards. A fourth, portable unit runs on its own battery. We put it on the bonnet when we want it, and then the radar watches all round the truck: 360 degrees. The sensors are small 24 GHz millimetre-wave radar units. Each one can follow up to three people or objects at the same time, and it reports where each one is, how far away it is, how fast it moves, and in which direction.

Radar works in complete darkness, in rain and in dust, and it sees through thin plastic covers. It does not need light, so it does not tell anyone outside that they are being watched.

Security

When the truck is parked or we are asleep, the controller watches the zones around the camper. Anyone who comes close raises an alarm. The alarm stays latched, so we can see afterwards that something happened and where.

Blind spots

While driving, the side and rear sensors cover the areas the mirrors cannot show, for example a motorcycle beside the camper body or a person behind the truck when reversing.

Night visitors

In the bush, the same sensors can wake us when an animal walks through the campsite at night. A rare nocturnal animal is worth getting out of bed for.

The first version used simpler sensors that could follow only one target each. One target is not enough when two people walk past together. We replaced them with sensors that follow three targets.

The new radar map on the touchscreen: a plan of the truck on a 1-metre grid, with the front bumper marked as the zero point, and buttons for RDR, Stations and Coverage.
The new radar map. The truck is drawn to scale on a 1-metre grid, with the front bumper as the zero point. Each radar station is shown where it is placed, labelled with its name and the direction it points, for example "Q4 180°", so fixed and portable stations appear on one map. The Stations button opens the list where each station's position, height and direction are set, and the Coverage button draws the area each station watches. Here no stations are connected yet.
A change of plan

From wires to Wi-Fi

At first the radar sensors were wired directly to the controller. Then the truck got a new MikroTik hAP router, which has Wi-Fi made for small connected devices. To use it, we changed the design. Each radar sensor now has its own small ESP32-S3 processor. The processor reads the radar and sends the results to the controller over the router's Wi-Fi.

There are no signal cables from the sensors to the controller any more. The fixed sensors only need a power cable, and the portable one needs nothing at all. The system has been tested and works.

Which Wi-Fi network a sensor joins is set in the software configuration before the program is loaded into its processor. So the same sensor can be set up to join the truck's router or another Wi-Fi network.

Each station has a name that says where it is: Q1 at the front, Q2 on the left, Q3 on the right and Q4 at the rear. Its position on the truck, its height and the direction it points are entered once on the touchscreen. The controller uses them to put every target in the right place on one map of the whole truck.

Fixed units

Three units mounted high on the truck: left, right and rear. The side units point backwards, 35 degrees off the side of the camper, so they see along the side of the truck and behind it. Each one has a radar board in the domed cover, and a voltage converter and processor in the base. The truck supplies the power.

Portable unit

The same electronics with two rechargeable lithium cells in the base. It runs on its own battery, so it can stand anywhere. On the bonnet it covers the front, the one direction the fixed sensors cannot see.

A fixed radar sensor unit opened: the radar board in the domed cover, and a voltage converter board and a small processor board in the base, with the power lead coming in.
A fixed unit, opened. The radar board sits in the domed cover. The base holds the voltage converter and the ESP32-S3 processor. The red and black lead brings power from the truck.
The base of the portable radar unit with two blue lithium cells lying side by side in their compartment.
The portable unit's battery compartment, under the electronics: two lithium cells side by side.
3D view of the two printed housing parts of a fixed radar unit: an oval ring and an oval base.
The 3D-printed housing parts of a fixed unit.
3D view of the three printed housing parts of the portable radar unit: an oval ring with a square block, the inner body with the battery compartment, and the bottom lid.
The 3D-printed housing parts of the portable unit, with the battery compartment in the middle.
In the cab

A touchscreen that backs up the SCADA

The controller drives a 10-inch touchscreen in the cab. In Part 1 we described the WinCC SCADA on the truck PC. The touchscreen is its backup. If the truck PC is switched off or not working, we can still see the state of the truck and operate the PLC functions from the touchscreen.

The touchscreen has six pages:

3D view of the radar controller case with the 10-inch touchscreen lifted above it. Inside the case: a 25 W DC-DC power converter, the ESP32-P4 controller board, a small voltage converter and an adapter board, and three round multi-pin connectors in the front wall.
The controller in its 3D-printed case, with the touchscreen lifted off to show the inside. Left to right: the 25 W DC-DC converter that powers the unit, the ESP32-P4 controller board, and a small voltage converter with an adapter board. The round multi-pin connectors in the front wall take the cables. A 3D model made from the case design; the parts inside are simplified.
CameraPrepared for a camera view
ServicesLights, air, water, winches, solar panels
PowerBoth battery systems, charging
RadarA scale map of the truck with every radar station and its targets
NetworkRouter, Wi-Fi and every controller
SystemHealth of the controllers and sensors
Services page: switches for lighting, air and water, solar panels, airbags and winches, with temperatures, humidity, solar and battery values and airbag pressures.
Services. Lights, air and water, solar panels, airbags and winches, with the values that go with them.
Power page: a live single-line diagram of solar, both alternators, the Iveco battery, the battery link, the chargers, the inverter, shore power and the three camper batteries, with battery panels below.
Power. A live single-line diagram of both electrical systems: solar, both alternators, the battery link, the chargers, the inverter, shore power and the three camper batteries.
Network page in day colours: the internet link through the VPS and VPN, the router with its two internet paths (one active, one on standby), the network switches, every controller with its response time, the devices still to be fitted on Wi-Fi, and the GPS receiver status.
Network. The whole truck network on one page: the internet link to the server, the router with two internet paths (one active, one standing by), the four network switches (Dashboard, Drivers cab, Main and Airbag), and every controller with its response time. On the right are the Wi-Fi devices still to come: a light, the fridge and three radar stations. Shown here in day colours. Addresses are blurred.
System health page: one card per controller, PLC and sensor group with its state, plus the Modbus link load.
System. The health of every controller, PLC, sensor and Modbus link on one page. On the bench the radar sensors show FAULT because they are not connected. Addresses are blurred.

SCREENSHOTS TAKEN WITH THE CONTROLLER'S OWN SCREENSHOT FUNCTION · TAP TO ENLARGE

A button on the touchscreen does not switch anything directly. Like every other device in this series, it sends a request to the PLCs, and the PLCs decide.

The gateway

The connection to the outside world

The radar controller is also the gateway between the truck and our web dashboard (Part 5). Measurements leave the truck through it, and requests from the dashboard come back in through it.

Remote control is deliberately limited:

  • Only lights and solar panels can be operated from the web dashboard. Air, water, winches and airbags can only be operated from inside the truck.
  • Remote control must be enabled at the SCADA in the truck. Without that, the dashboard can only show data.
  • Every remote request needs a heartbeat. While a dashboard button is held, the dashboard confirms it every second. If the confirmations stop for two seconds, the controller cancels the request. A lost internet connection cannot leave a light switched on or a panel motor running.

The Network page on the touchscreen watches the router, the Wi-Fi access point, every controller on the network and the internet connection. If one part of the network fails, the driver sees which one at a glance.

The controller also takes its time from the suspension controller (Part 2), which reads it from the satellites. Its clock, its logs and the time shown on the web dashboard are therefore always the same as every other controller in the truck.

When things go wrong

A diagnostic web page in every controller

A controller behind a panel in a truck is difficult to diagnose. You cannot easily connect a laptop and a USB cable to it at the roadside. So every ESP32 controller in Tartaruga, the suspension controller, the radar controller and both CAN bus controllers, has its own diagnostic web page. Any browser on the truck network can open it. No special software and no cable are needed.

Each page shows the same kind of information:

  • Live status cards for every sensor and function: is it answering, when did it last answer, and what is it reading?
  • Connections: which other devices are reading from this controller, and when each one was last heard.
  • The controller itself: firmware version and build date, running time, free memory, and the reason for the last restart.
  • The live log, the same text a programmer would see on a USB cable, with buttons to pause it, clear it, or restart the controller. The radar controller's page also has a Screenshot button that saves an exact image of the touchscreen; the screens on this page were taken with it.
Diagnostic web page of the radar controller, with cards for the three radar sensors, the alarm, Modbus connections, time synchronisation, network, dashboard link and firmware, and the live log below.
The radar controller's diagnostic page on the bench. The three sensors show "no response" because they are not connected on the bench. Time sync shows GPS time received from the suspension controller. The reset reason is BROWNOUT. Tap to see it full size; the public internet address is blurred.

Every firmware we write also prints its version and build date as the very first thing it does after a restart. When we look at a controller, we always know exactly which software is running on it.

Diagnostic web page of the suspension controller, with cards for the GPS receiver, position, motion sensor, temperature, joystick and system, and the live log below.
The suspension controller's diagnostic page (Part 2): satellite receiver health, position, motion sensor, temperatures, joystick and system. The position is blurred.
What it taught us

The difficult parts

A good supply can hide a dying battery

Every ESP32 in the truck is fed through a buck-boost converter that holds its supply steady at 3.3 V. During a five-hour mains failure at home, the bench batteries ran flat. As the battery voltage fell, the converter changed from stepping the voltage down to stepping it up, and pulled ever harder on a battery that was already failing. The ESP32 saw a perfect 3.3 V until the very end, so it had no warning. It did not switch off cleanly. It kept running in a half-working state and stopped answering the network, until we switched the power off and on by hand. The diagnostic page showed the cause immediately: reset reason BROWNOUT.

In the truck this cannot happen in the same way. The camper batteries are connected through three contactors, and the Main Control PLC opens them when the battery voltage falls to about 10 V. It does not close them again until the voltage has recovered. The controllers therefore always see a clean power-off and a clean start. On the bench, the fix will come with our battery monitoring project: a supply disconnect with a lockout, and a measurement of the real input voltage that the ESP32 can see.

Not every feature exists on every chip

We wanted the controllers to talk to each other wirelessly as well as over Ethernet. The ESP32-P4 has no built-in radio, and the wireless link we planned turned out not to be supported on it at all. We removed it and put everything on Ethernet.

Jumper wires cause "software" faults

Single jumper wires on the bench stretch, fall off, and some make contact only one way round. Many faults that looked like software were a bad jumper. We use multi-pin connectors wherever we can (more in Part 4).

A large screen needs a lot of memory

A 10-inch display with six pages of graphics does not fit into the chip's internal memory. Getting the graphics library to use the external memory correctly took many attempts, and some settings only took effect when edited by hand in the configuration files.

Still growing

What comes next

Next: Part 4 describes the two CAN bus controllers, which listen to the Iveco's own computers.

The series

How the truck thinks