Go Down

Topic: Can it be done... Arduino-based full Digital Auto Instrument Cluster (Read 10762 times) previous topic - next topic

Okay, I'm bringing this back from the dead...

I have the PCB files and Gerber files done and checked.  However, I think  I need to make some adjustments to them now that I actually have the cluster they were designed for (93-96 Camaro), so those will need to wait.  I do have the KiCAD schematics right here, but could use some help transferring them into pics to post.

One question:  I NEED the Maxim MAX7221ENG, for the extended range temps (it gets cold here in the winter) for this project.  However, all I can readily find is the CNG series (starts at 0*C, 32*F on the low end) for cheap (ENGs are typically $16 while the others are like $6).  Heck, I can get 10 7219CNGs for that price, but those don't appear to have the SPI interface, according to the datasheet.  Question is, what effect does, say, 15*F (about -10*C, if I'm thinking correctly at about 1.8 degrees F per degree C), have on the chip not rated for that temp?

I still haven't started anything for this yet...  I'm still getting info before I start.  I ended up replacing the car body in April and have been building it up since, but I'm still a few pieces short.

Bump it up...

Had to completely redo the board files from scratch...  Most of the chips on the main board were in spots where they wouldn't fit and I didn't have any mounting holes in yet.  And the gauge board had to be completely redone with a different outline (they wasted SO much space on the gauge face with the small window!).  As it is, I have a 2-layer board for the gauges and a 4-layer for the brains, I'm thinking about $200 or so between them (until prices go up).

I still don't have a breadboard, LEDs or any MAX7221s.  Still waiting on the input for the temp effect between the CNG and ENG chips...

I'm attaching the schematics for the 2 boards...  The pinouts on the connectors that run between the boards are identical, pin 1 to 1, pin 12/16 to 12/16, etc.


How about a larger version of the second schematic?

Rob Gray aka the GRAYnomad www.robgray.com

Dec 02, 2012, 06:17 pm Last Edit: Dec 02, 2012, 06:20 pm by martianent Reason: 1
I'll get another version of the gauge schematic shortly.  I will need to completely start over with a new file from KiCAD before I resize it.  I didn't think it ended up as small as it did.

I got myself a starter kit from eBay, and it arrived yesterday.  I have the MAX7221s ordered, but apparently the Chinese are driving them across the ocean or something...   :smiley-eek-blue:

Now, I'm confused a bit.  With the sample analogRead sketch, I can get a basic potentiometer to work, but when I hook it up to the same "stimulator" used for testing my MegaSquirt II and turn the coolant temp pot, I get nothing but garbage.  I'm using the same code as is in the basic sketch, and I'm hooking up the +5V to the +5V line on the stim, and the A0 port to the "CTS" (coolant temp pot) output.  I THINK I'm supposed to be reading between close to 0V and 5V.  I already know that the factory gauge dives (under 100*F) when the circuit is open and pegs (over 260) when jumpered to ground.  My factory manual lists a tool that gauges between 50 ohms (hot) and 1260 (cold).

I'm stuck here as well as the intake temperature.

But, right now, I'd like to get a system voltage reading, between 8 and 18 volts (usual is about 14.7) for the volts gauge.  Would a sketch for this be similar to the sample used to read the reference +5V voltage?  I'll again be using the pot I got in the starter kit to simulate the proper voltage off of the stim (only 12V source I have right now).

And, I assume, I'm probably going to need some sort of power limiter, since I don't want to fry the Nano, and I already know my alternator can put out more than 20V if the regulator craps out (again, already replaced it once).  Any suggestions?


Can it be done

Surely yes. But that's not the challenge.

The challenge for such kind of applications is not to make it work when it works; It is to design for failure: when it fails, it fails safe.

Resized gauge schematic...  Don't mind the indicators in the top right...  Those are wired specific to the car's harness and are completely independent of the Arduino.


and I already know my alternator can put out more than 20V if the regulator craps out (again, already replaced it once).  Any suggestions?

More than that if you get a "load dump" situation (battery lead comes off), that can go > 100v I think.

There are regulators designed to handle that, like the MIC29150/29300/29500/29750 series.

You should probably make a hardened PSU for use in a vehicle, that said most people seem to just hang a regulator off the battery and get away with it.

I'd like to get a system voltage reading, between 8 and 18 volts (usual is about 14.7) for the volts gauge.

Use a voltage divider on the 18v input and read with an ADC pin.

Rob Gray aka the GRAYnomad www.robgray.com

Dec 04, 2012, 08:20 pm Last Edit: Dec 04, 2012, 08:23 pm by martianent Reason: 1
Well, for the power supply, since I got to thinking about it, I was thinking that the PSU used in the MultiDisplay project would work.  Or the one used in the MegaSquirt.  I'll have to modify the schematic and board  :smiley-roll-sweat: .  I almost think it would be better to modify the board with the MSII PSU since I need a 12V source leading out of the cluster to the alternator (backup sense wire, don't know why it needs to be connected since later models don't have this wire, but...).

As for the voltmeter, I saw this:


But there doesn't seem to be much info going along with it.  I'm assuming that it would be similar to the analogRead sketch?

I have to go out and hook up the battery in the car again so I can find out if the available voltage for the coolant temp and oil pressure senders is 12 or 5 volts so I can go from there.  I already listed the coolant temp resistance range, but the oil pressure unit goes from 0 ohms at 0 pressure to 90 ohms at max pressure (which on my factory gauge is 80 PSI, normal max pressure coming out of the oil pump regulator is 70 PSI), and the intake air temp is even weirder, going from 100K at -40*F to 450 at 160*F (same as engine coolant temp sensor for the ECM, but it won't get that hot).

Also did some basic math for the tach and speedometer:

Tach in RPM = (Input frequency x 120)/6 (number of cylinders)
Speedometer in MPH = (3600 sec/hour x frequency of pulses)/ 4000 (pulses per mile out of the speed sensor circuit)


As for the voltmeter, I saw this:

That link is to a PDF of a level-shift circuit (digital), nothing to do with an analogRead sketch or a voltmeter.

Rob Gray aka the GRAYnomad www.robgray.com

Dec 05, 2012, 07:21 pm Last Edit: Dec 05, 2012, 07:24 pm by martianent Reason: 1
That may be, but then if that were true, why does it say, "How to read voltages higher than 12V"?  Which seems to me to be the point of a VOLTmeter?  Be nice if there was some actual information to go with it as well...

Either way, I did a search and deleted that crud from the breadboard.  I've found something I think might work, but I need to find my adapter that puts out 18+V (supposed to be 12 max but I guess the regulator isn't working right).  Right now, with a 10.92V input, I'm dividing it down to about 3.4V (I've currently got the input pot set to about 7V).  I haven't tested it yet in the serial monitor.  The resistor values will probably need to change...  I think, at about 18V, I'm looking for about 4.5 at A5, unless I'm thinking wrong?

And, I suppose that when I get this figured out, since the gauges for the oil pressure and coolant temp are the same (with different inputs), I'm looking at a similar circuit/sketch for those as well?


"How to read voltages higher than 12V"?

Where does it say that, all I see is a schematic of two level-shifting ideas, there's no text or article.

I've found something I think might work,

That would be the voltage divider I mentioned? That's all you need.

I'm looking at a similar circuit/sketch for those as well?

I would say so.

Rob Gray aka the GRAYnomad www.robgray.com

Dec 06, 2012, 01:09 am Last Edit: Dec 06, 2012, 01:12 am by martianent Reason: 1
That PDF has the text "How to sense 12V or higher circuitry with Arduino" right above the schematic(s).  But that's not the issue anymore...

Had to put in a 10K "adjustment" pot on the ground side of the divider.  I got the circuit to read close to what the available voltage is coming out of the input pot (simulating changing system voltage from 12V down) and still need to remove the adjustment pot to measure it (to see if I can just put in a regular resistor).  I still need to find the other wall wart for testing higher voltages to see if it's accurate above 11V.  That thing always seems to go missing when I need it  :smiley-roll: .

Code: [Select]
[color=#7E7E7E]Reads an analog voltage on pin A5 and prints it to the Serial Monitor.[/color]

[color=#CC6600]void[/color] [color=#CC6600][b]setup[/b][/color]() {

[color=#CC6600]void[/color] [color=#CC6600][b]loop[/b][/color]() {
  [color=#CC6600]int[/color] sensorValue = [color=#CC6600]analogRead[/color](A5); [color=#7E7E7E]//Read input on A5[/color]
  [color=#CC6600]float[/color] voltage = sensorValue * (18.0 / 1023.0); [color=#7E7E7E]//Converts analog reading to voltage)[/color]
  [color=#CC6600][b]Serial[/b][/color].[color=#CC6600]println[/color](voltage); [color=#7E7E7E]//Sends voltage to serial monitor[/color]
  [color=#CC6600]delay[/color] (200);


(Ugh, that so didn't post right)

I wrote a basic code for the oil pressure gauge, basically the same as the voltmeter, printing the result over the serial monitor.  I need to go to RadioShack tomorrow and pick up a 1K pot to simulate the oil pressure sender and the coolant temp sender.

2 questions:

First, how do I constrain the result of the calculations to one decimal place (or none at all)?

Second, can anyone point me in the direction of a basic max7221spi sketch, so I know what the basics are that I need to input into a program to, say, make the 4-digit display show "1234" at medium brightness?  And will it be possible to make the gauge blink when overlimit?


Dec 06, 2012, 01:46 am Last Edit: Dec 06, 2012, 01:53 am by Graynomad Reason: 1
"How to sense 12V or higher circuitry with Arduino" right above the schematic(s).

Good thing it wasn't a snake :) Yes that's a bit ambiguous as the circuits are really just for digital.

(Ugh, that so didn't post right)

Right there. Did you cut that from a web page or something. Either way it's not readable.

First, how do I constrain the result of the calculations to one decimal place (or none at all)?

Use integers, that way you can't get any decimal places.

can anyone point me in the direction of a basic max7221spi sketch

Not me. Have you looked in the playground, there may be an example there.

You can use pots to tune the divider, or even as the divider itself (you don't need resistors as well although often a low-value pot is used for fine adjustment).

But for this application (ie doesn't need to be hugely accurate) where all you need is to reduce 18v to 5v all you really need are the two resistors I would think. If you /4 you have an easy calc in the code, so that's a 30k over a 10k to give a full scale of 4v5.

Rob Gray aka the GRAYnomad www.robgray.com

Actually, I used the "Copy to Forum" tool in the interface, and then posted it here using the button...  I take it I'm just supposed to post the code as it comes out of the interface right in the main text box?

The voltmeter is working.  Had to use a stubborn second 10K pot in line with the first.

Onto the oil pressure gauge.  Got that working, too.  Used the second 10K pot again.

I seem to have run into an issue...

Circuit looks kind of like this:

5V source from pot and voltage divider circuit---in port on second pot with other resistors added to bring resistance down to 90 ohms max, pot input pin---ground via ground pin on pot.  Output pin on pot is connected to the Nano.

Other than the intake temp sensor (tach and speedo/odometer are separate, obviously), I have ONE WIRE senders (and I don't think 2-wire senders are available).  Meaning that the gauge signal wire (use electromagnetic gauges) goes to ground through the sender.  There are 2 sets of resistance coils in the gauges, and they balance out according to how much voltage is being sent to ground via the sender.

I can't very well connect the analog input to the 5V line or the gauge would never read anything but low.  If I were to switch to CAN communication with the MSII, I'd lose oil pressure reading (MSII has signals for intake temp, battery voltage and coolant temp).

Also, the MAX7221s should be here tomorrow.  I've only been waiting since I ordered them from eBay on the 27th (same time as I ordered the starter kit which arrived almost 2 weeks ago now).  Once I get those, I'll see what I can do with the MAX7221spi example provided in the library.

Dec 12, 2012, 09:16 pm Last Edit: Dec 12, 2012, 10:02 pm by martianent Reason: 1
Okay, I spent several hours looking through the MultiDisplay stuff last night.  And searching to figure out what the coolant temp sender and oil pressure units' resistances are at various pressures and temps.

Looks like I'll be using the MCP3204 for the temp and oil pressure readings (2 temp, one pressure, one extra input).  So many extra parts now I thought I could get away without...

Although, if I were to connect the fuel gauge to the MCP3204 (and use its last input), and since the MAP (manifold pressure) sensor I plan on using works similar to the MPX4250 and has a 5V max voltage output, I could connect it straight to an analog pin and read it that way...

:edit:  Now that I've thought about it, I'm probably better off using the LM2917 as the outputs from the ignition module and VSS (speed sensor) are probably 12V...  And that means I'd need the MCP3208.

Go Up