Reading temperature from ect sensor on car

Hi, i am beginner level on arduino. I want to make temp gauge to my twingo. I am reading voltage from ect sensor it works with 5v from car ecu.

Make same reference points for voltage and temperature but it is non linear i think.

My code working perfect until 75 degree celcius and after that it show belove 5 degree or more.

for example

2.75 v at 28 degree
2.50 v at 32 degree
2.10 v at 40 degree
1.95 v at 42 degree

i am working with modified tmp36 sensor code :slight_smile:

//the scale factor of TMP36 (temperature sensor) is 10 mV/°C with a 500 mV offset to allow for negative temperatures

// the analog pin number connected to the TMP36
int sensorPin = A0;
// delay between sensor reads
int readDelay = 1000;

void setup()
{
//initializing serial communication with the Omega2 for sending sensor data
Serial.begin(9600);
}

void loop()
{
// getting the voltage reading from the temperature sensor
int reading = analogRead(sensorPin);

// convert the analog reading (0 to 1023) to voltage (0 - 5V)
float voltage = (float)reading * 5.0;
voltage /= 1024.0;

// print out the voltage to Omega2
Serial.print(voltage); Serial.println(" volts");

if (voltage > 1.5 ) ;
float temperatureC = ((voltage - 3.75) * 25) * -1;
Serial.print(temperatureC); Serial.println(" degrees C");
else ;

float temperatureC = ((voltage - 3.75) * 28) * -1;
Serial.print(temperatureC); Serial.println(" degrees C");

delay(readDelay);

}

  1. Which Arduino.
  2. How do you power the Arduino, and how do you power/ground the TMP36.

Your code assumes that the 5volt supply of a 5volt-logic Arduino is, and stays, exactly 5.000 volt.
Is it?
Leo..

Im using arduino nano and powered via 12 v 5v dc converter. I use code for tmp36 but dont use actual sensor. I connect twingo's ect sensor signal wire to a0 pin of arduino. It is working with 5v.

I want to convert this voltage signal to temperature data.

Got it.
Don't know if it is possible to read the temp value directly from the ECU.

If you want to work with sensor voltage, then don't use the TMP36 code.
I think it's best to directly convert A/D values to temp values.

I assume you power the Nano with 5volt on the 5volt pin (not the V-in pin).
And have connected sensor voltage via a (10k) resistor (for pin safety) to an analogue pin.
Write simple code that just prints A/D values.

Serial.println(analogRead(A0));
delay(1000);

Write down the A/D values at different temperatures, say in 5C temp steps.
Use multiMap() to convert these A/D values directly into temp.
Leo..

thank you so much for your interest leo.
i am powered arduino from v in pin if it makes any difference and i am using resistor on a0 pin.

i cant understand how to use multiMap(), looking examples on google but still dont know how to use it.

can you please write little example how to convert analog read (0-1023) to temperature map.

It does.
V-in runs through the onboard 5volt regulator, and that loses a volt or so.
For a stable 5volt for the MCU, V-in needs to be 6.5 to 7volt minimum.
If you have a stable/reliable 5volt from your DC/DC converter, then connect it the 5volt pin.

Multimap converts an array of A/D values to an array of temp values.
With multiple A/D value to tempC points, any non-linearity is compensated.
for your table in post#1 that could be (sudo code)

int in[] = {563, 512, 430, 399}; // A/D values at 28C, 32C, 40C, 42C
int out[] = {28, 32, 40, 42}; // matching temp array

int rawValue = analogRead(A0);
int temp = multiMap(rawValue, in, out, 4); // (four data points)

Never needed to use multimap myself.
Maybe someone who did can help you further.
Leo..

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.