A DIY Pitch/Roll Gauge for Off-Roading
To help a friend who owns a Jeep Wrangler with off-road safety, Vaclav Krejci built this DIY pitch/roll gauge using a micro:bit.
Off-roading is skill like any other and it comes with challenges. But it is unique in that help isn't often nearby. If you get your rig stuck, you might need to recover it on your own. So it is important to avoid getting stuck as much as possible and a pitch/roll gauge can help. It will tell you how far your vehicle tips side-to-side and from front-to-back. Some 4x4 trucks and SUVs have pitch/roll gauges built into the dash, but most do not. To help a friend who owns a 1978 Jeep CJ-7, Vaclav Krejci built this DIY pitch/roll gauge.
Traditional pitch/roll gauges were mechanical and relied on gravity to keep a floating indicator level while the outer housing moved with the vehicle. But those have a tendency to stick and they have to be mounted so that the housing is perfectly parallel to level ground. That latter fact limits the mounting options and can make the gauge difficult to see. A digital pitch/roll gauge, like this one built by Krejci, can be mounted in any arbitrary location or orientation, because the firmware can compensate. Digital gauges are also more precise when everything is working properly.
Krejci chose to use a BBC micro:bit development board for this project, which is not a board we see very often anymore. But it has a couple of advantages: it has a built-in accelerometer/gyroscope and it is easy to code using a graphical block-based coding programming language called Microsoft MakeCode. Using that, Krejci was able to quickly and easily get the board to report its own orientation. It displayed that on the built-in LED matrix, but Krejci wanted something better for the actual gauge.
For that, Krejci selected a Nextion NX8048T050 5.0” Basic Series touchscreen. The cool thing about this display is that it can store its own images and handle all of the processing necessary to draw those. That makes it ideal for working with less powerful development boards like the BBC micro:bit, because the microcontroller only needs to tell the Nextion display which images to draw.
It would have required 289 individual images to cover every possible combination of the 17 pitch and 17 roll positions, so Krejci utilized a simple solution that cut that down to 35. The background is a single static picture, then each of the gauge positions are separate pictures. The BBC micro:bit simply tells the display to draw the background picture, then the two gauge pictures on top of that. This keeps everything efficient without relying on any transparency.
The result is an accurate and precise digital pitch/roll gauge tailored to the Jeep CJ-7. It was fairly affordable to build and receives power from USB, so it will be easy to install in the vehicle.