I’ve been working on this project for a few months now. I’m trying to build a complete dashboard replacement for my Mitsubishi Eclipse. I’m looking to display things like speed and water temp through obdlink. Other things like the check engine light and turn signals will go through my Arduino.
My question is how to I read an individual input from Arduino mega and output that to a light on realdash? I’ve started with turn signals to experiment. I apply 5v to my signal pin and have the negative/ground attached to the ground for whatever row of pins I’m working with.
This causes the three lights I’m working with to all come on (Check engine and both turn signals).
I’ve looked all over, but haven’t seen an example in the xml file of how to write an easy “if this pin has power, light up this indicator.”
In addition, I can’t figure out how to read more than the 13 digital pins it originally started with in the sample code. I’ve changed the number in the Arduino sketch to 52 in the loop hoping it would cause it to move through all the inputs and report them to the realdash app to be addressed, but haven’t had any luck getting any sort of response from the higher numbered inputs.
So, sorry to write a book, but that’s where I’m at! I think a straightforward explanation of how this works is in order. If I’ve somehow missed it in my hours of searching, I’d appreciate if someone could point me in the right direction. If I haven’t, I’ll write down everything I learn to make this easy for someone with the same question in the future!
You have to write CAN packets to send the data to Realdash.
Simplified Process
-Read The Digital IO into a variable
-Store the variable into a buffer that will be sent via CAN
-Send the CAN packet to ReadDash
Here is a small program I used for testing the exact same thing. It sends the serial data over the SERIAL1 port on a MEGA. It also uses ground triggers instead of 5V trigger, but that is easily changed with the PINMODE parameter.
// =======================================================
// Sample Program for sending digital singals to RealDash
// =======================================================
/// Define variables to track scan times
unsigned long Time;
byte LastBroadcast;
// Define variables for reading IO
bool LBLr; // Left Blinker from Digital in on Arduino
bool RBLr; // Right Blinker from Digital in on Arduino
bool HBr; // High Beams from Digital in on Arduino
bool MALFr; // Check Engine Light from Digital in on Arduino
// Defin pin modes for physical IO
int LBLPin = 43; //Left Blinker on Pin 43
int RBLPin = 45; // Right Blinker on Pin 45
int HBPin = 47; // High Beams on Pin 47
int MALFPin = 49; // Check Engine (MALF) on Pin 49
void setup() {
Serial.begin(115200); //for diagnostics
Serial1.begin(115200); // for TTL to Dash
pinMode(LBLPin, INPUT_PULLUP); // Left Blinker will ground when activated
pinMode(RBLPin, INPUT_PULLUP); // Right Blinker will ground when activated
pinMode(HBPin, INPUT_PULLUP); // High Beams will ground when activated
pinMode(MALFPin, INPUT_PULLUP); //Check engine light will ground when activated
}
// =======================================================
void loop() {
Time = millis();
// Go read the ardiuno IO
ReadIOPins();
// Send Data to CanBus every 23 millisecons
if (Time - LastBroadcast > 23) {
LastBroadcast = millis();
BuildCanFrames();
}
}
void ReadIOPins(){
LBLr = !digitalRead(LBLPin);
RBLr = !digitalRead(RBLPin);
HBr = !digitalRead(HBPin);
MALFr = !digitalRead(MALFPin);
}
void BuildCanFrames()
{
byte CanBuffer[8];
// build & send CAN frames to RealDash.
// a CAN frame payload is always 8 bytes containing data in a manner
// described by the RealDash custom channel description XML file
// all multibyte values are handled as little endian by default.
// endianess of the values can be specified in XML file if it is required to use big endian values
// build 1st CAN frame:
CanBuffer[0] = HBr;
CanBuffer[1] = MALFr;
CanBuffer[2] = LBLr;
CanBuffer[3] = RBLr;
CanBuffer[4] = 0;
CanBuffer[5] = 0;
CanBuffer[6] = 0;
CanBuffer[7] = 0;
// write first CAN frame to serial
SendCANFrameToSerial(3200, CanBuffer);
}
void SendCANFrameToSerial(unsigned long canFrameId, const byte* frameData)
{
// the 4 byte identifier at the beginning of each CAN frame
// this is required for RealDash to 'catch-up' on ongoing stream of CAN frames
const byte serialBlockTag[4] = { 0x44, 0x33, 0x22, 0x11 };
Serial1.write(serialBlockTag, 4);
// the CAN frame id number (as 32bit little endian value)
Serial1.write((const byte*)&canFrameId, 4);
// CAN frame payload
Serial1.write(frameData, 8);
}
Thank you so much for the response! I hadn’t thought of using variables to store and transmit individual pin values! My next question is how does the realdash app obtain these values? Are they interpreted by bit position?
Hi guys,
Fine to find this topic.
Thats the way to get I/O commands listed in RealDash.
My Problem is how to wire a Temp sensor like a VDO it is Perm grounded per threads got 1 wire on top and changes the resistance by temp. I got All data to the sensor.
But how to Programm that?
And the second Thing is how to wire a preassuresensor or a Egt to the arduino.
I got some oldschool gauges installed. So anywhere i got a Signal that i can use to Show the data. But the canexamples on github are terrible for newbies
If there is anyone who can explain something in german to me it would be loveley too.
For NTC thermistors like the VDO gauge senders you need to use the Steinhart Hart equation. You will need to find the coefficients from VDO or measure the temperature and resistance values yourself at a few points and use on of the many online calculators to work out the coefficients yourself.
You set up a voltage divider on the analogue input of your Arduino and read the voltage across the thermistor, back calculate the resistance and temperature in your code. Just google for Arduino Thermistor and there are many tutorials.