Go Down

Topic: Vehicle temperature sensor reading (Read 3 times) previous topic - next topic

Pyrice4

As part of my first Arduino ECU/Datalogging project im trying to read the coolant temperature on a CBR600RR motorcycle engine (for FSAE). The temperature sensor has 3 pins; pin 1 receives 5V from the ECU, pin 2 connects to ground through the ECU, and pin 3 goes to the gauge cluster. Ive read the "Decoding thermistor characteristics table" post but it seems overly complicated for what I need to do.
The temperature range will be between 100-250 degrees F and I only need an accuracy of around 5 degrees F and a reading only about once every 5-10 seconds.
So, I connected the sensor directly to my arduino with Pin 1 to 5V, Pin 2 to ground, Pin 3 to analog input 1(A0). Here is my code


int val = 0;           // variable for value read
int temp = 0;

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

void loop()
{
  val = analogRead(A0);    // read the input pin
  Serial.println(val);   
  temp = map(val, 0, 1023, 100, 250);     //scale input value to temperature
// Serial.println(temp);
 
  delay(2000);
}


I know I need to get the min/max resistance of the thermistor so I can set up the scale part right. But my problem right now is that im not getting a consistant reading (anything from 250-500) even though temperature is not changing.

Is this likely to be a software or wiring problem? Or maybe out of range of the thermistor (its at ambient for this test)?

Im a mechanical engineering student so I have only basic knowledge of circuits and software so I would appreciate any help/suggestions.
Thanks
 

RuggedCircuits

Make sure you have everything set up right by testing it with a known voltage first. I suggest connecting the +3.3V output of your Arduino to your analog input and verifying the reading (should be 675 or so). If it's around 675 and holding steady(ish) then your software is good and there's something wrong with your sensor or how you have it hooked up.

--
The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected

Pyrice4

Alright, I hooked the analog input to the 5V and 3.3V, im getting 1022-1024 @ 5V and 698-709 @ 3.3V. So I think my software should be fine. Im not sure how else to hook up the  wiring. There is only three pins.

RuggedCircuits

Do you have any data on what's actually inside the temperature sensor? If it is just a thermistor then it is ignoring the 5V coming to it and just behaving like a temperature-dependent resistor. You won't get any "voltage" out of it then -- you'll have to configure it in a resistor divider configuration or something like this.

Any more info on the sensor? Can you open it up to see what's inside?

--
The Aussie Shield: breakout all 28 pins to quick-connect terminals

Pyrice4

#4
Jan 31, 2011, 01:17 am Last Edit: Jan 31, 2011, 01:36 am by Pyrice4 Reason: 1
I cant open it up, its a copper cylinder like this:


But I think I may have figured it out. I put it in a voltage divider arangement like so
5V---Thermistor----A0 input----1k resistor----GND
and I connected the 5V to Pin 3 of the thermistor and the copper exterior of the thermistor to A0.

My data is now consistant jumping around only +/- 2  and increasing when I heat up the thermistor.

Now my question is how to adjust the data to reflect actual temperature values? The data im getting now is around 50(at ambient) and increased to around 100 when I heated up the thermistor.

Would getting two known points like 100F and 200F and finding their relative arduino readings (maybe 60 and 150) then doing some interpolation work?
                               

Go Up