Automotive Tire Pyrometer Project
By Daniel Hankewycz, Mouser Electronics
Licensed under CC BY-SA 4.0
Download Full Project
BOM
System Build Up
Now that the groundwork has been laid, it has to be implemented in programming, creation of the hardware circuit,
and the final step of fitting it into an enclosure and testing it.
Step 6: Using the Look-Up-Table
Now that we have the look-up table for these line segments, we need to write code that will use them to calculate
the temperature. The process starts with the analog-to-digital converter measuring the voltage at THERM_VAL in
the schematic diagram from step 2. The ADC will return a 10-bit value that we can use to index the array and
find the given slope and y-intercept pair. To get this index, simply mask off the upper 5-bits from the ADC
value, and use the found slope, y-intercept, and full ADC value to compute the temperature. It basically boils
down to a single multiply and add operation in C code. The key thing to pay attention to in the function above,
is the shift right 11 operation which keeps the binary points aligned as they are in the previous step.
Step 7: Menu Interface
In order to navigate the pyrometer's many different options, I had to develop a well-structured menu system. Like
most graphical user interfaces, I wanted a list of options to choose from, and also a method of “feedback” to
show the user which item they have selected. With such a limited resolution display and a non-object oriented
language, this task proved to be a bit challenging.
The first thing I designed was the overall layout of each menu page. Due to the limited screen dimensions, I
chose to divide the display into 4 quadrants that would each contain a menu option. With this in place, having a
pointer character next to the user's selection restricts each option to having a length of 9 characters. As the
code snippet in the above image shows, each menu label is stored in a fixed length array with null strings
placed where no option is provided. The second component to the menu system is a jump table with #defines that
tell a switch case handler where to look to display the next menu page. For every label in the menu array, there
must exist an element in the jump table. With this structure, it allows you to create an easily expandable menu
system with a small memory footprint.