Temperature sensor to car pc

the place to discus in car computers
The forum Administrator has chosen to advise you that this topic is 11 years and 3 months old and that you may wish to begin a new topic or use the search feature to find a similar but newer topic.
User avatar

Topic author
jata

Re: Temperature sensor to car pc

Post by jata »

Wow it seems like quite a few people have been looking into this. Ideally I'd be looking to measure the intake temps after the chargecooler and in as near to real time as possible. Using something Android based could be an option as I've just finished an Android project in work. The issue for me would be the sensor side of things as although I'm a software developer by trade I don't tend to deal with hardware. As such I guess I'll have to work backwards from what I can get to work sensor wise. Thanks for all the suggestions, I'll have more of a look into this and report back once I get anywhere...


User avatar

gavsdavs
Posts: 981
Joined: 10/08/10 12:30
Years of MR2 Ownership: 0
MR2's Owned: 1
Gender: Male
Location: London
Has thanked: 8 times
Been thanked: 10 times

Re: Temperature sensor to car pc

Post by gavsdavs »

Out of interest, how hard is it to replace the stock ECU with an obd2 one?
User avatar

shinny
Posts: 4507
Joined: 07/05/06 1:00
Years of MR2 Ownership: 12
MR2's Owned: 6
Real Name: Mark
Gender: Male
Location: Reading, UK
Been thanked: 2 times
Contact:

Re: Temperature sensor to car pc

Post by shinny »

Have been thinking about this a little more over the last few days - tempted to buy an Arduino Leonardo and 4 mini-servos to create 4 needles. Then using thermistors as potential dividers driving the A2D circuits and a little code to translate that into PWM signals to drive the servos. Then all you'd need is to create dial faces and needles to mount on the servos :th:
User avatar

Topic author
Marc2Turbo

Re: Temperature sensor to car pc

Post by Marc2Turbo »

Shinny, have a look at instrument steppers on ebay, much better than servos
User avatar

shinny
Posts: 4507
Joined: 07/05/06 1:00
Years of MR2 Ownership: 12
MR2's Owned: 6
Real Name: Mark
Gender: Male
Location: Reading, UK
Been thanked: 2 times
Contact:

Re: Temperature sensor to car pc

Post by shinny »

Marc2Turbo wrote:Shinny, have a look at instrument steppers on ebay, much better than servos
Yes... but more fiddly to drive :blush:
User avatar

Topic author
Marc2Turbo

Re: Temperature sensor to car pc

Post by Marc2Turbo »

Have facebooked you a link with sketches and build notes
User avatar

shinny
Posts: 4507
Joined: 07/05/06 1:00
Years of MR2 Ownership: 12
MR2's Owned: 6
Real Name: Mark
Gender: Male
Location: Reading, UK
Been thanked: 2 times
Contact:

Re: Temperature sensor to car pc

Post by shinny »

Part of the attraction of the servo is that it only requires one PWM pin to drive, meaning the Leonardo can driver 7 is need be. By contrast, a stepper motor requires 3 or 4 digital pins to drive, reducing the capacity of the board. Servos also rely on a sweep to a rest pin for calibration while the servo is always calibrated. Of course the servo has downsides too, but my idea would be to setup 4 small 180 sweeps next to each other which would be perfect for servos :th:

Edit: Driving the servo is pretty easy! http://www.youtube.com/watch?v=FKj9jJgj8Pc

At the end the guy says... "You don't need to be an electrical engineer or have a computer science degree to control a servo". As I DO have a computer science degree, it should be pretty darn simple! :blush:
User avatar

Topic author
Marc2Turbo

Re: Temperature sensor to car pc

Post by Marc2Turbo »

I see your point! I have some 9g micros if you want them?
User avatar

Topic author
Marc2Turbo

Re: Temperature sensor to car pc

Post by Marc2Turbo »

Haha one would hope! You've got me thinking now, you could just use the map command from sensor direct to servo... Now tearing house apart looking for my uno and a thermister!
User avatar

shinny
Posts: 4507
Joined: 07/05/06 1:00
Years of MR2 Ownership: 12
MR2's Owned: 6
Real Name: Mark
Gender: Male
Location: Reading, UK
Been thanked: 2 times
Contact:

Re: Temperature sensor to car pc

Post by shinny »

Marc2Turbo wrote:Haha one would hope! You've got me thinking now, you could just use the map command from sensor direct to servo... Now tearing house apart looking for my uno and a thermister!

You could, although for accuracy you might want to break the ADC range into a few sections and use individual map commands to better trace the non-linear nature of the thermistor.

Best would be to calculate offline the temperature for each of the 1024 possible voltage readings and create a lookup table. Then simply index the ADC value into the lookup table and feed that directly into the servo function (assuming it has bounds checking - which it really should given it's a user API)
User avatar

Topic author
Marc2Turbo

Re: Temperature sensor to car pc

Post by Marc2Turbo »

Yes that is the none lazy version, you planning on writing the entire 1024 tables? I'm just scouting through the mpguino code and seeing how feasible it is to grab the mpg data, if I use an at64 chip I should have enough io's to have a pre/post charge temp running off the same board, was also going to tie in to my central locking for folding the mirrors on lock/unlock,
User avatar

shinny
Posts: 4507
Joined: 07/05/06 1:00
Years of MR2 Ownership: 12
MR2's Owned: 6
Real Name: Mark
Gender: Male
Location: Reading, UK
Been thanked: 2 times
Contact:

Re: Temperature sensor to car pc

Post by shinny »

Marc2Turbo wrote:Yes that is the none lazy version, you planning on writing the entire 1024 tables?
Nah... you calculate them given the known resistance profile of your thermistor, the value of the other resistor in the potential divider and the voltage applied to the pair.

So, how I'd do it (given the tools I'm used to) is I'd get the formula right to calculate from the final voltage back to the temperature of the thermistor. Then, rather than implement it in the Arduino code (no point calculating it every loop when it's just static data), I'd put it into a spreadsheet so I had all 1024 ADC values represented next to the corresponding temperature. Export that as CSV and a little awk magic later I would have the exact C code to drop into my Arduino 'sketch' as a static global variable. Once you've got the temperature sorted accurately, it would be easy to use the map function to change the accurate temperature to the servo's deflection (because unlike resistance or voltage, those two will have a linear relationship). Besides accuracy, another advantage then is that it's then really easy to change the range of the gauge without having to work out the different low / high ADC values for the gauge's new min / max... handy if you're thinking about multiple gauges. In fact I'm even thinging or having a temperature change gauge (-5 to +15C) to show the difference between the in and out water temperatures on the charge cooler, and accurate conversion to a temperature first would be crucial then :th:
Marc2Turbo wrote:was also going to tie in to my central locking for folding the mirrors on lock/unlock,
You mean like this? http://www.youtube.com/watch?v=UZZIVFzEdXE ;)
User avatar

shinny
Posts: 4507
Joined: 07/05/06 1:00
Years of MR2 Ownership: 12
MR2's Owned: 6
Real Name: Mark
Gender: Male
Location: Reading, UK
Been thanked: 2 times
Contact:

Re: Temperature sensor to car pc

Post by shinny »

Did a proof of concept today with the Arduino Leonardo today... pretty easy to get running and the reaction with a small bead thermistor was reasonably good even just with my own breath. So I did some vaguely proper software engineering and created a 190 line sketch with two classes; one to read the analogue input input a temperature (reading in deci-Celcius or 1/10th of a degree C) and another to create a generic gauge from a servo given the start and end temperatures of the gauge. Naturally I built an opening sweep into it as well.

With a little more tweaking (notably, making the voltage to temperature conversion generic, rather than hard coded to my particular thermistor / resistor combination) I could probably release the code if anyone wants it. With all the framework setup it'll be darn easy to make whatever temperature readings you want, as you can see below.

Here's a snippet of code (without the implementation of my two classes) for running two gauges. One is an absolute IAT gauge (0C -> 50C on PWM pin 9) and the other is the temperature diference between the IAT (analogue pin 0) and the cold water temperature (analogue pin 1) for my chargecooler (-15C -> +15C on PWM pin 6):

Code: Select all

// Define a type for deciCelcius
typedef int deciCelcius;

// Class for a servo being used as a temperature guage
class ServoGauge;

// Class to get deci-Celcius temperatures from our sensor
class TempSensor;

TempSensor *iatSensor;
TempSensor *preCCSensor;
ServoGauge *iatGauge;
ServoGauge *preCCGauge;

void setup() 
{
  // Initialise everything
  iatSensor = new TempSensor(0);
  preCCSensor = new TempSensor(1);
  iatGauge = new ServoGauge(0, 50, 9);
  preCCGauge = new ServoGauge(-15, 15, 6);
} 

void loop() 
{
  deciCelcius iatTemp;
  deciCelcius preCCTemp;
  
  // Read temps
  iatTemp = iatSensor->getTemperature();
  preCCTemp = preCCSensor->getTemperature();
  
  // Write to gauges
  iatGauge->setTemperature(iatTemp);
  preCCGauge->setTemperature(iatTemp - preCCTemp);
  
  // Quick pause
  delay(5);
}
User avatar

MR2DI4
Posts: 1474
Joined: 20/04/11 23:18
Current Model: None
Years of MR2 Ownership: 23
MR2's Owned: 1
Real Name: 2023 i30N Hatch 6MT
Gender: Male
Location: Tauranga >>> New Zealand
Been thanked: 1 time
Contact:

Re: Temperature sensor to car pc

Post by MR2DI4 »

I just put a bead probe in the intake before the throttle body, slipped it under the hose and did up the clamp again. Connected a multimeter with a min/max hold on the temperature range and put it in the boot and went for a hard drive and looked at the results before and after I added a boost controlled fan switch to the 9" SPAL / custom shroud on mine. Really not a whole lot of point getting real time in cabin readings. You want to see what effect the modification has made for sure but after that you don't need to know. The effect on the peak temperature was huge, a 14 Deg C drop from memory between runs with and without the fan running. One of the new meters like the Fluke 287 that has logging would have been rather cool to compare the results though, if only I could get my hands on one.

Quick Reply

   
The forum Administrator has chosen to advise you that this topic is 11 years and 3 months old and that you may wish to begin a new topic or use the search feature to find a similar but newer topic.

Return to “Carputers”