Monday, March 4, 2013

GLCD Automotive Digital Gauge

After years of using aftermarket mechanical gauges in my truck (and repairing them several times) it was time to upgrade.  Not missing an opportunity to make something cool, I decided to go digital using a micro-controller and LCD display instead of analog gauges.

Starting off simple, I wrote a test program and wired up a 16x2 alphanumeric display.  The test program showed values for water temperature, oil pressure, Air/Fuel ratio, and battery voltage.


Thinking that I might want to display more parameters like indicators for 4x4, Low Range, and front & rear lockers, I moved the program to a larger 20x4 LCD.


After acquiring a 128x64 graphic LCD display to play with, I wrote a new test program to take advantage of the flexibility of the graphic display, including adding an intro screen with bitmap images.  The monitored parameters were changed slightly.  Displayed were values for water temperature, oil pressure,and voltages for the primary and secondary batteries.



Unfortunately the graphic LCD uses a LOT of I/O pins, including 5 of the 6 analog pins on the ATMega328, which makes it hard to monitor analog sensors.  One way to get around this would be to re-map the I/O pins to free up analog inputs.  Currently data and command pins are group together, each on their own port.  Remapping the pins would spread them across more than one port and slow performance slightly.
Other options include using a second uC to gather the data from the various sensors and pipe the information to the display via the serial UART, or use a analog multiplexing IC.  Depending on the performance penalty, the path of least resistance would appear to be remapping the I/Os.  More experimenting is in order!