Categories
Project

TPMS Project – Analysis for Adding Flexibility

The Arduino TPMS Tyre Pressure Display project posted on hackster.io is locked into the vehicle and sensor type at compile time. This does not make it easy to setup for a new vehicle. Additionally the sensor ids and positions cannot be changed after the code has been compiled. If you rotate the tires of your vehicle, you need to edit and recompile the code to change the positions. While these restrictions reduce code size, they do not make it easy to change anything unless you want to recompile the code.

The hard coding of values is fine for most people creating this project, but it would not be good if you want to build it for a friend or relative. Once the tires are rotated or a sensor is changed, it would not be useful to them any longer. If they live not too far, that may not be an issue as the person who built it could recompile the code with the necessary changes, but what if that individual was several hundred or thousands of miles away? The project may end up in the trash or gathering dust in the corner.

I have started looking at the differences in configuration and parameters for the vehicles and sensors supported in the code to identify similarities and differences. The goal is to keep the code as small as possible so that more microcontrollers may be supported but the main focus will be on supporting the Raspberry Pi Pico RP2040 microcontroller. Additionally an SD Card reader will be added to the code with the configuration stored in a file on the card. I’ve also added some buttons to my version, which will allow a menu to be added so it will be possible to switch between different sensor types, scan for TPMS sensors, and move or assign them to positions on the car. Below are some screenshots of the Excel Workbook that I’m using to do the analysis.

The next step is to determine the best way to move forward. Currently I’m considering determining what the most common configuration settings are, then adding code to make changes to the common configuration where there are differences. I have started down this path, but I see a few issues with this approach, primarily with maintaining the code. It would be necessary to keep the Excel workbook up to date with any code changes and only make changes in the proper case statements. While this would work fine, it could lead to bloated code especially if someone was unclear how to maintain the code and added all the parameters in a case statement. Another more flexible approach would be to have a configuration file for each sensor type but this could slow down the startup process but it is a viable option.

By richteel

Software and hardware developer who likes learning new things with a passion of sharing knowledge with others.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from TeelSys

Subscribe now to keep reading and get access to the full archive.

Continue reading