For those of you with an attention span similar to mine (that is, very short!) and therefore skipped the yawnfest preamble, welcome to the problem I am trying to solve! You didn't miss much...
For those who read the preamble, well done, and thank you!
So. A nixie dashboard is the goal, featuring:
4 digit nixie tachometer
2 digit nixie speedometer
nixie bar tachometer (to compliment the digital tachometer)
nixie bar oil temperature
nixie bar oil pressure
nixie bar turbo boost pressure
nixie bar fuel gauge
nixie bar fuel pressure
nixie bar battery / vehicle voltage
nixie bar lambda
4 or 6 digit nixie clock
Other functions:
Each bar will flash at whatever value it is currently reading when parameters fall below or above preset levels to alert of potential issues (such as boost creep, temperatures getting a shade high etc)
Each bar will flash at full scale when there is no input signal at all (that is, a zero input)
The tachometer bar will be set so that full scale is the optimum gear shift point, with some overhead to send it bright (since bars just get brighter when you try to drive them further than full scale) so it would act as a handy shift light (possibility to set the shift point manually - but I'll stick that in "pipe dreams" for now!)
The battery level bar will flash at full scale when the charge warning light from the alternator is on
The oil pressure bar will flash at full scale when the oil pressure warning is on.
(There's also a nixie gearshifter with the nixie tube embedded in the handle in the mix, but that needs no coding or programming since it operates on a set of microswitches)
So, I know what I want the code to do, so my "thinking" is this:
Analogue pin 0 = PWM Anaogue rev output
Analogue pin 1 = Oil temp input
Analogue pin 2= oil temp output
Analogue pin 3= oil pressure input
Analogue pin 4 = oil pressure output
Analogue pin 5 = boost pressure input
Analogue pin 6 = boost pressure output
Analogue pin 7 = Fuel level input
Analogue pin 8 = fuel level output
Analogue pin 9 = fuel pressure input
Analogue pin 10 = fuel pressure output
Analogue pin 11 = lambda input (from pin 9 on SLC)
Analogue pin 12 = lambda output
Analogue pin 13 = battery voltage input
Analogue pin 14 = battery voltage output
14 analogue pins used
Digital pin 0 = RPM interrupt input
Digital pin 1 = Speend interrupt input
Digital pin 2 = nixie 4 (rpm) least significant bit
Digital pin 3 = nixie 4 (rpm) data bit
Digital pin 4 = nixie 4 (rpm) data bit
Digital pin 5 = nixie 4 (rpm) most significant bit
Digital pin 6 = nixie 3 (rpm) least significant bit
Digital pin 7 = nixie 3 (rpm) data bit
Digital pin 8 = nixie 3 (rpm) data bit
Digital pin 9 = nixie 3 (rpm) most significant bit
Digital pin 10 = nixie 2 (rpm) least significant bit
Digital pin 11 = nixie 2 (rpm) data bit
Digital pin 12 = nixie 2 (rpm) data bit
Digital pin 13 = nixie 2 (rpm) most significant bit
Digital pin 14 = nixie 1 (rpm) least significant bit
Digital pin 15 = nixie 1 (rpm) data bit
Digital pin 16 = nixie 1 (rpm) data bit
Digital pin 17 = nixie 1 (rpm) most significant bit
Digital pin 18 = nixie 6 (speed) least significant bit
Digital pin 19 = nixie 6 (speed) data bit
Digital pin 20 = nixie 6 (speed) data bit
Digital pin 21 = nixie 6 (speed) most significant bit
Digital pin 22 = nixie 5 (speed)least significant bit
Digital pin 23 = nixie 5 (speed)data bit
Digital pin 24 = nixie 5 (speed) data bit
Digital pin 25 = nixie 5 (speed) most significant bit
Digital pin 26 = oil pressure warning
Digital pin 27 = charge warning
28 pins used
I could run the nixie clock on the Arduino, or on a seperate board, I've not decided yet.
// Startup
Cycle all nixies 0-9
Cycle all nixie bars 0-max (0-255 on analogue outputs)
// Tachometer
read interrupts on digital pin 0 (RPM) for 20mS
Count pulses per 20mS
store reading
take 5 readings
Detach interrupt
calculate average of the five readings
Divide by 2 // there are 2 pulses per crank revolution on a 4 cylinder engine
Write result to pins as 4 binary words (0000/0000/0000/0000):
digital 2, 3, 4, 5 (4th digit nixie - least significant digit)
digital 6, 7, 8, 9 (3rd digit nixie)
digital 10, 11, 12, 13 (2nd digit nixie)
digital 14, 15, 16, 17 (1st digit nixie - most significant digit)
Convert to PPM (0-254)
Output PPM signal (revs) on analogue 0
Flash analogue 0 when PPM = 255
write to SD card & bluetooth
// Speedometer
read interrupts on digital pin 1 (speed)
count pulses per 50mS
record value
Take 5 readings
Detach interrupt
calculate average of the five readings
Multiply by 2 to give revolutions per second // there are two pulses per speedo cable rotation - so multiply by 2 here rather than 4 to give RPS
Multiply by 3600 to give revolutions per hour // there are 3600 seconds in an hour
Divide by 894 to give miles per hour //894 is revolutions per mile for my tyres
Write result to digital pins as 2 binary words (0000/0000)
digital 18, 19, 20,21 (6th nixie)
digital 22, 23, 24, 25 (5th nixie)
write to SD card & bluetooth
// Oil Temperature
Read analogue 1 (oil temp)
Calculate to output 0-254 using voltage range from sender input
Output PPM signal (oil temp) on analogue 2
Flash analogue 2 when PPM = >200
Flash analogue 2 at 255 when PPM <10
write to SD card & bluetooth
// Oil pressure
read analogue 3 (oil pressure)
calculate to output 1-255 using voltage range from sender input
output PPM signal (oil pressure) on analogue 4
flash analogue 3 when PPM <50
flash analogue 3 at 255ppm when PPM <10
write to SD card & bluetooth
//Boost pressure
read ananolgue 5 (boost pressure)
calculate to output 0-255 using voltage range from sender input
output PPM signal (boost pressure) on analogue 6
flash analogue 6 when PPM >130
flash analogue 6 at 255 when PPM <10
write to SD card & bluetooth
//Fuel level
read analogue 7 (fuel level)
calculate to output 0-255 using voltage range from sender input
output PPM signal (fuel level) on analogue 8
flash analogue 8 when PPM <50
flash analogue 8 at 255 when PPM <10
write to SD card & bluetooth
// Fuel pressure
read analogue 9 (fuel pressure)
calculate to output 0-255 using voltage range from sender input
output PPM signal (fuel pressure) on analogue 10
flash analogue 10 when PPM >200 or <100
flash analogue 10 at 255 when PPM <10
write to SD card & bluetooth
// Lambda
read analogue 11 (lambda)
calculate to output 0-255 using voltage range from sender input
output PPM signal (lambda) on analogue 12
flash analogue 12 when PPM >140 or <100
flash analogue 12 at 255 when PPM <10
write to SD card & bluetooth
// Battery level
read analogue 13
calculate to output 0-255 using voltage divider input (10v - 15v
output PPM signal (battery) on analogue 14
flash analogue 14 when PPM >230 or <100
// Oil pressure warning
read digital 26 (oil pressure warning)
if high, flash analogue 3
if low, ignore
// charge warning
read digital 27 (charge warning)
if high, flash analogue 14 at 255
if low, ignore
Repeat!
The code I wrote to follow...