Anda di halaman 1dari 13

Arduino Powered Dash Display

Written by David Perkins 9-25-16

This is intended to be a tutorial and overview of the custom cluster that I made for my S13 with
Toyota 1UZ-FE engine and Nissan JK40C transmission. The mounting surface of the cluster is
a mild steel sheet cut to somewhat fit and screwed in place. The turn signal and high beam
LEDs are connected straight to the factory cluster harness with 220k ohm resistors so that they
wont be blindingly bright. Refer to your FSM to know which factory harness wires to
use. Seeing as the coolant temperature sensors are different between the KA24 and 1UZ, I
decided it would be nice to have a different temperature gauge using a GM coolant sensor. I
also wanted to pull the speed signal straight from a GPS since my transmission doesnt have a
speed sensor and the car does not have ABS. I have since then added a few other features
that Im sure will come in handy. The screen is fed and updated by an Arduino board and does
not communicate with the Speedhut tachometer or engine ECU. The number of devices you
wish to control or monitor is limited on how many I/Os your Arduino has. This guide will aid you
in building your own setup but it will be necessary to know basic electrical concepts and how to
solder. It would be beneficial to read a little about Arduino before trying to understand exactly
what all is going on. Im no great programmer and had zero experience with Arduino before
starting this project so I purchased a few books on learning Arduino that covered basic C++
coding. Its extremely important to test every circuit you build using a breadboard to make sure
it works as you intended before soldering all your components together.

You can play around with it like this by following simple online tutorials.

Helpful Websites for Learning


https://www.arduino.cc/en/Guide/HomePage
https://learn.adafruit.com/
https://www.sparkfun.com/

Features
Password protected engine start with hard-coded password
Turbo timer with programmable count time
Display values such as speed, various temperatures, battery voltage, fuel level and fuel
pressure.
Programmable coolant temperature warning lamp.
Expandable and adaptable to whatever you want to control or display.

Arduino Mega 2560

4D Systems uLCD-43DT-AR
This is the most expensive part at $170 for the starter kit.
http://www.4dsystems.com.au/product/uLCD_43DT_AR/
4D Systems offers other screens as well. I chose the 4.3 so it would fit nicely into my S13 dash.
The 4D Systems website is extremely helpful and has tutorials in their appnotes about most
everything you will need to program the display. Follow the instructions for connecting it to an
Arduino host.
http://www.4dsystems.com.au/appnotes

Parts List
Most of these parts can be found on Amazon.com.
Arduino Mega 2560
4D Systems uLCD-43DT-AR
Assorted resistors from 10 ohms to 1M ohms
Adafruit Ultimate GPS Breakout - 66 channel w/10 Hz updates - Version 3 (for better
satellite acquisition be sure to get the optional active antenna)
Thermistors (coolant temperature sensors)
0-100 PSI pressure transducer compatible with fuel/oil

DC-DC Converter capable of around 2A (12v to 9v converter or an adjustable power


converter)
5v relay Shield Module
Assorted color 5mm LEDs
22 gauge wire (solid and stranded)
22 gauge wire pinning kit
Breadboard and wire kit (for prototyping your work before soldering it)
Solder-able Breadboard (probably more than one depending on how efficient you are)
12 VDC 1000mA regulated power adapter
2-pin or 3pin Screw Terminal Blocks
Power switch (latching, NOT momentary)
10k potentiometer
3M double sided tape
Heat shrink
A nice box that can fit your Arduino Mega with the 4D Systems shield on top (if you cant fit
the board safely in or on your cluster then you will need to locate it elsewhere. I put mine in a
metal case and used DB26 connectors to plug it in the back of the cluster)

Tools

Wire crimpers
Wire cutters
Wire strippers
Fine tip soldering iron w/ rosin-core solder
Beer

To ensure that your Arduino Mega 2560 will read inputs and control outputs correctly, youll
need to make sure you wire up each sensor or component to the correct I/O. If you wish to use
a different I/O, you will need to change the code accordingly.

Arduino Pin to Component Reference:


Fuel Level Sending Unit - A8
Temp Sensor #1 (Coolant) - A9
Temp Sensor #2 (Oil) - A10
Screen Brightness - A11
Voltage Reading - A12
Pressure Transducer - A13
Warning LED - 22
Relay - 24

Warning LED

The warning LED should be connected in series with at least a 220 ohm resistor from pin 22 to
ground. If this is too bright, use a higher ohm resistor. The LED will blink at a rate of 500ms
(half a second) when coolant temperature rises above a predetermined value. The temperature
you wish to set as warning temperature can be changed by changing the highlighted number
below. Temperature is in degrees F.
#define TEMPERATURE_WARNING_DEGREES 200

Coolant/Oil Temp Sensor

A thermistor is a type of variable resistor. The variable resistor in the diagram above is a photocell used for measuring light but the concept is the same. Most of the automotive coolant
temperature sensors that were so familiar with have a negative temperature coefficient which
means that as temperature goes up, their resistance goes down. The analog inputs on the
Arduino board reads voltage, not resistance, so its important to add a pull-down resistor after
the sensor you want to read. Otherwise, the voltage drop across the thermistor will be 5v no
matter what the thermistor resistance is. There are calculations to find the optimal pull-down
resistor but an easy way to remember it is that it should be somewhere close to the resistance
range that the sensor will see most often. If you would like to know more about them check out
this website. http://www.resistorguide.com/pull-up-resistor_pull-down-resistor/
A 470 ohm resistor works well for this application. The change in resistance due to change in
temp for thermistors is not linear, however, so there is a formula we must use to accurately read
them. We will be using the Steinhart-Hart formula to help us find this curve. To begin we will
need to take three ohm readings of the thermistor at three different temperatures (0 degrees C,
50 degrees C and 100 degrees C are good temperatures to use) and put them in to the online
thermistor calculator here.
http://www.thinksrs.com/downloads/programs/Therm%20Calc/NTCCalibrator/NTCcalculator.htm
This will give you three coefficients that you may plug into the Steinhart-Hart formula found in
the code.
Here is a link for more information on reading a thermistor with Arduino.
http://playground.arduino.cc/ComponentLib/Thermistor2
Below is what the code should look like for the math part of reading an NTC thermistor.

//coolant temp
double Thermistor 1(int RawADC) {
double Temp;
Temp = log(460*((1024.0/RawADC-1)));
Temp = 1 / (0.001297009539 + (0.0002603415040 * Temp) + (0.0000001554845962 * Temp *
Temp * Temp));
Temp = Temp - 273.15;
// Convert Kelvin to Celsius
Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celsius to Fahrenheit
return Temp;
}
The highlighted numbers are the three coefficients (A, B and C) that I am using for my coolant
temperature sensor. These are different for the oil temp sensor. I have calculated for a 470
ohm pull-down resistor as can be seen above in green (this number can be altered slightly to
make the reading more accurate). I chose to use GM coolant temp sensors for both my coolant
and oil temps simply because they are pretty common and not very expensive.
Coolant temp sensor part number: BWD WT5132.
Oil temp sensor part number: Delphi TS10075
Here is a video to show you how it works.
https://www.youtube.com/watch?v=7GeF5PFtqS0

Fuel Level Sending Unit


The fuel level sensor in the tank is another type of variable resistor. You will need to wire it up
the same way you would wire a thermistor using a pull-down resistor. The resistance of the fuel
level sensor for an S13 is around 5-85 ohms so a 100 ohm resistor should work well. Since the
resistance is so low, we dont want to use the 5v pin as our power source. Instead, we will be
using the 3.3v pin which will set current at about 32mA when the fuel level sensor is at its
lowest resistance. Note that this is the only sensor that uses the 3.3v pin.
If you have a fuel level sending unit that has a different resistance range then you will need to
modify the analog values below. With the sending unit hooked up, use the serial monitor in the
Arduino IDE to find the minimum and maximum values for sending unit (tank full and tank
empty). Put these values in to replace the highlighted values.
//3.3v
int reading = analogRead(FUEL_PIN);
int fuel = map(reading, 200, 520, 0, 100);
int constrained = constrain(fuel, 0, 100);
genie.WriteObject(GENIE_OBJ_GAUGE, 0x00, constrained);

GPS

Wiring up the GPS is pretty straight forward. Serial connections are: Arduino TX to GPS RX
and Arduino RX to GPS TX. Getting the speed data is not so easy. This link may help you with
that. Dont worry, this part gets confusing fast so be patient.
https://learn.adafruit.com/adafruit-ultimate-gps/downloads?view=all
Youll need to use Serial1 for the GPS since the Serial0 port is used by the 4D Systems display
shield.
Heres another video. The update rate is 5Hz.
https://www.youtube.com/watch?v=JVEO6vmohhU

5V Relay Shield

The 5v relay from Sainsmart is the one Im using if I remember correctly. It must be pulled low
to energize, not high like most automotive relays. Use it to control +12v to something required
to start the car like clutch safety switch, fuel pump or main relay. If you wish to use the built in
turbo timer function then it will need to supply power with the key off to the main relay or relay
box that supports the fuel pump, ecu, injectors and ignition coils.
http://www.sainsmart.com/arduino-pro-mini.html

Connecting to Power

The Arduino board should be powered through a step-down DC-DC converter wired to constant
+12v (battery) with a fuse and latching button switch. Anytime power is removed the Arduino
board will turn off and anything that it was currently doing (like the turbo timer) will
stop. Password input will be required anytime power is restored. In the way my particular code
is written, the turbo timer will begin counting when the voltage input at pin A12 is removed. The
turbo timer count time may be changed with the number below (in seconds) from 0 to the
amount of time it would take for your car to run out of gas.
#define TURBO_TIMER_SECONDS 4
My timer counts for 4 seconds after the Key-Off condition is true at which time the controller will
turn the relay off and kill the engine. If the relay is not supplying a signal to the main relay or
relay box which in turn supplies power to everything required to run the engine, this function will
not work.
The password may be modified here by changing the number highlighted in yellow.
#define MY_PASSWORD "1234"

Reading Battery Voltage

A voltage divider is pretty simple and can be made with just a few resistors. You will need one
in order to measure 12-14.2 volts with the Arduino boards 0-5v analog input. Lets round up
14.2v to a solid 15v for simplicity. Now we need to divide it by three so that the max voltage
applied to the analog input will not be greater than 5v. To do this we need three resistors with
the same resistance. Use a 10k ohm resistor for all three. Then we need to tap in between R2
and R3 for the signal voltage back to the analog input. Use a multimeter to test that the voltage
is equal to or below 5v. The switched voltage supply needs to be from the key switch or some

other switched source than the one supplying power to the DC-DC converter. If it is the same
source then the 5v relay will not de-energize unless power to the converter is removed.

Screen Brightness Control

Screen brightness is adjusted via a 10k potentiometer. The direction you turn in to control the
brightness can by reversed by switching the red and black wires. If you know how a throttle
position sensor works then this should make sense.

Fuel/Oil/Boost Pressure Transducer


The pressure transducer that I am using has a 0.4v-4.5v output range from 0-100 PSI. You may
use one with a different range such as a 3 bar map sensor for vacuum/boost monitoring. The
wiring is the same but it will need to be coded accordingly. The transducer should have 3 wires
and be connected the same way you would connect a potentiometer with +5v power, ground,
and the signal wire going back to an analog input on the Arduino board. A 0.5v analog signal
should have a value of 102.3 rounded down to 102 (it may only round up I forget but in either
case its close enough). A 4.5v signal should have a value of 920.7 so I rounded that up to 921.
If your transducer produces a signal range other than 0.5v-4.5v then you will need to change the
values in yellow. The values in green are what you want to display. I have 0 to 100 because
that is the range in PSI of my specific transducer.
int rawFuel = analogRead(FUEL_PRESSURE_PIN);
int fuelPSI = map(rawFuel, 102, 921, 0, 100);
int constrainedFuel = constrain(fuelPSI, 0, 100);
genie.WriteObject(GENIE_OBJ_LED_DIGITS, 0x04, constrainedFuel);

Anda mungkin juga menyukai