In a previous post I played around with an Acura Legend gauge cluster I found at a junkyard:
I found the workshop manual for the car online, which included a detailed schematic of the cluster:
Since I had all the information I needed to display pretty much any data I wanted on the cluster, I mulled over what would make sense to display. I settled on local weather conditions, with the tach representing relative humidity (x10), the speedometer showing temperature in Fahrenheit, the temp gauge displaying barometric pressure, and the fuel gauge indicating percent of the moon visible. I plan on putting this in my garage when it’s finished, it will make a nice looking (and useful) indicator. To measure all these parameters I bought an Arudino Pro Mini, RHT03 temp and humidity sensor, BMP180 barometric pressure sensor, and a SparkFun real time clock module.
Interfacing with the temp and real time clock were relatively straight forward, they both use I2C communications and I followed some examples for each. The RHT03 uses it’s own 1 wire communication scheme, I followed the tutorial here which I found in the product comments. A note on using 3.3V and 5V components on the same I2C bus: both breakouts come with pullup resistors on the data lines to VCC. Since the real time clock was 5v nominal and 3.3v tolerant, I desoldered the pullups on it, letting the BMP180 breakout pull the bus to 3.3V.
The tutorials for the sensors showed how to get data from the sensors, but I wanted the fuel gauge to show percent moon visible. I knew the time, so I thought how hard could it be to calculate percent visible? Hard. Harder than I thought, at least. I ended up “flattening” the time to minutes since Jan 1, 2014. Given that, I looked up the closest full moon after Jan 1. By subtracting the difference, I had a t=0 that corresponded with a known full moon. By taking the “minutes since known full moon” and dividing by the lunar month, I ended up with a float representing the number of lunar months since t=0. I converted the division to an int (which truncates the decimal), subtracted (number of moons * lunar month) from time since t=0, which gave me time into the current lunar month. From there I calculated the percent visible keeping in mind that halfway through the calendar there is a new moon, so in one month the percent visible goes 100-0-100.
With that, I had all the information I needed. The next step was to get the Arduino to talk to the guage cluster in it’s native language – a variable frequency square wave. I tried a few different software methods, but all of them were either unreliable or used up a ton of processor power. I settled on a XR4151CP-F voltage to frequency converter which can be “programmed” (in a very loose sense of the word) with an external RC network. I tried going through the calculation they provided, but I couldn’t make any sense of it. They put some equations in the datasheet, but none seemed to really predict anything, even using the values in the example. I ended up building the example circuit and adding capacitance to CO until I got in the range I needed, 150 Hz at 5V output for the gauge cluster and 400 Hz for the tach. Since the V to F converter takes an analog voltage, I designed a RC filter using this calculator to convert the PWM output to a nice smooth analog value.
Once I had everything built it was time to check the linearity, and map speed to the PWM duty cycle. The Arduino uses an 8 bit int for output, so the range is from 0-255. I incremented the PWM output and recorded frequency and speed:
This was interesting, but kind of the opposite of what I needed. I have temperature (MPH) and want to know the PWM value to output. Note that I truncated the speed data on either end to remove the saturation. I could have adjusted the V to F converter to get rid of that saturation, but it’s so high that I’ll (hopefully) never see it, it would mean the garage was 140*F!
Ah, that’s better. I had excel plot a linear trend line and display the equation. Now I have a PWM value as a function of speed (temperature)!. I plugged this into my program and…
Holy crap it works! The speedometer accurately displays temperature. This was the biggest hurdle, as the tach is the same setup, just different range. I’ll have to use a transistor array on the output for the tach since it only responds to a 12V square wave, but that’s not difficult. Both fuel and temp sensors were voltage dividers with rheostats on the low side, and the gauges are damped heavily enough that I can replace the sensor with a transistor and vary the PWM duty cycle to emulate the sensors.
And with that, I’m going to call it a night. I’ll probably try out the tach in the same manner, but avoid hooking a whole other circuit for it, it takes like 45 minute to build it. With the proof of concept working, I’ll design a board in eagle and send it out to get made! On a side note, if you would be interested in either a populated or unpopulated board for a cluster of your own, let me know and we can discuss.
As for the motor controller, I ended up just buying a Curtis 500 amp DC motor controller from Ebay for the golf cart – I simply didn’t have time to finish the one I started on. I’d still like to revive the one I designed, maybe turn it into a completely overpowered switched mode power supply.