Signal temp do Palio

Good evening, could anyone help me with a car temperature sensor, I’m getting a signal via wire for realdashe and I got the signal from the temperature wire on the sensor panel, could anyone give me a tip if I need to make a signal splitter or some help? in the Arduino code so that realdashe recognizes it?

don’t know what’s your code but signal to A0 GND to GND of arduino 10KΩ resistor between GND and pin A0 and XML file to send the frame value to realdash

I have these two models of NTC sensor and I am having difficulty creating a signal divider for my Arduino so that it can be recognized in realdash and could someone help me with some assistance, I would be very grateful

parts number and arduino code well try to help you

sensors are 3071 and 3041

int ThermistorPin = A1;
int Vo;
float R1 = 100000;
float logR2, R2, T;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;

void setup() {
Serial.begin(9600);
}

void loop() {

Vo = analogRead(ThermistorPin);
R2 = R1 * (1023.0 / (float)Vo - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2logR2 + c3logR2logR2logR2));
T = T - 273.15;

Serial.print("Temperature: ");
Serial.print(T);
Serial.println(“c”);

delay(100);
}

ok just wirth the name of the sensors model

const int sensorPin1 = A0; // Pin for the first sensor
const int sensorPin2 = A1; // Pin for the second sensor

void setup() {
  Serial.begin(9600); // Start serial communication
}

void loop() {
  int sensorValue1 = analogRead(sensorPin1); // Read value from the first sensor
  int sensorValue2 = analogRead(sensorPin2); // Read value from the second sensor

  float temperature1 = calculateTemperature(sensorValue1); // Calculate temperature from the first sensor
  float temperature2 = calculateTemperature(sensorValue2); // Calculate temperature from the second sensor

  Serial.print("Temperature 1: ");
  Serial.print(temperature1);
  Serial.println(" °C");

  Serial.print("Temperature 2: ");
  Serial.print(temperature2);
  Serial.println(" °C");

  delay(1000); // Delay of one second
}

float calculateTemperature(int sensorValue) {
  // Add the formula to calculate the temperature from the sensor's analog value
  // For example, if you have a formula that fits your sensor:
  float resistance = (1023.0 / sensorValue) - 1.0;
  resistance = 10000.0 / resistance; // Assuming a 10k ohm resistor

  float temperature = 1.0 / (log(resistance / 10000.0) / 3950.0 + 1.0 / 298.15) - 273.15; 
  return temperature;
}

edit the frames in the code & xml

or your code

int ThermistorPin1 = A0; // Pin for the first sensor
int ThermistorPin2 = A1; // Pin for the second sensor
int Vo1, Vo2;
float R1 = 100000;
float logR2, R2, T1, T2;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;

void setup() {
  Serial.begin(9600); // Start serial communication
}

void loop() {
  Vo1 = analogRead(ThermistorPin1); // Read value from the first sensor
  Vo2 = analogRead(ThermistorPin2); // Read value from the second sensor

  R2 = R1 * (1023.0 / (float)Vo1 - 1.0); // Calculate resistance for the first sensor
  logR2 = log(R2);
  T1 = (1.0 / (c1 + c2 * logR2 + c3 * logR2 * logR2 * logR2));
  T1 = T1 - 273.15; // Convert from Kelvin to Celsius

  R2 = R1 * (1023.0 / (float)Vo2 - 1.0); // Calculate resistance for the second sensor
  logR2 = log(R2);
  T2 = (1.0 / (c1 + c2 * logR2 + c3 * logR2 * logR2 * logR2));
  T2 = T2 - 273.15; // Convert from Kelvin to Celsius

  Serial.print("Temperature 1: ");
  Serial.print(T1);
  Serial.println(" °C");

  Serial.print("Temperature 2: ");
  Serial.print(T2);
  Serial.println(" °C");

  sendCANFrameToRealDash(3071, T1); // Send CAN frame for the first sensor
  sendCANFrameToRealDash(3041, T2); // Send CAN frame for the second sensor

  delay(1000); // Delay of one second
}

void sendCANFrameToRealDash(unsigned long canFrameId, float temperature) {
  byte frameData[8];
  memset(frameData, 0, sizeof(frameData));
  int tempInt = (int)(temperature * 100); // Multiply by 100 to keep two decimal places

  frameData[0] = (tempInt >> 8) & 0xFF;
  frameData[1] = tempInt & 0xFF;

  Serial.write(0x44);
  Serial.write(0x33);
  Serial.write(0x22);
  Serial.write(0x11);
  Serial.write((byte*)&canFrameId, 4);
  Serial.write(frameData, 8);
}
1 Like

My friend, thank you very much, I was able to use your code to recognize it in realdash, and I made some changes and it worked, now it’s marked, thank you very much