Red Light Racing

  • Increase font size
  • Default font size
  • Decrease font size

Intake Air Temperature Sensor

E-mail Print PDF

Code used to take 1.2L intake air temperature sensor reading and turn it into a resistance to be shown to the Insight ECU. For the time being I've decided to show the Insight ECU a constant resistance value (a constant temperature in other words). There really is no reason to tell the Insight ECU the real temperature as we're not trying to run the Honda engine. If the Insight ECU does for some reason require the real temperature then the mathematical relationship need an update as the variation with temperature is non-linear.

/*
 * Lupo to Insight Intake Air Temperature (IAT) Conversion
 * by Jake Staub
 *
 * Takes the Lupo IAT voltage signal, converts it to a temperature,
 * then turns the temperature into the required Insight resistance
 * value.
 * Lupo temp(volt) = m1*volt + b1.
 * Insight res(temp) = m2*temp + b2.
 */

int IATvolt = 2;   // Lupo IAT sensor input pin
int val = 0;         // variable to store the value coming from the Lupo IAT sensor
float volt = 0;     // variable to store Lupo analog voltage value
int fractional;      // variable to store fractional value
int temp = 0;     // variable to store Lupo analog temperature value
int res = 0;        // variable to strore Insight analog resistance value
int m1 = -44;     // slope for Lupo temperature function
int b1 = 186;     // y intercept for Lupo temperature function
int m2 = -89;     // slope for Insight resistance function
int b2 = 8800;    // y intercept for Insight resistance function

void setup() {
  Serial.begin(9600);  // opens serial port for debugging
}

void loop() {
  val = analogRead(IATvolt);            // reads the value from the sensor
  volt = val / 204.8;                       // converts digital val to analog volt
  val = val / 205;                           // converts digital val to analog val
  fractional = (volt - val)*1000;        // calculates decimal voltage value
  Serial.print("volt = ");                  // prints "volt = "
  Serial.print(val);                          // prints integer volt value
  Serial.print(".");                          // prints "."
  Serial.println(fractional);               // prints decimal volt value
  delay(3000);                              // 3 second delay (3000 ms)
  temp = m1*volt + b1;                 // Lupo temperature as a function of voltage
  Serial.print("temp = ");                // prints "temp = "
  Serial.println(temp);                    // prints analog temperature value
  delay(3000);                              // 3 second delay (3000 ms) 
  res = m2*temp + b2;                  // Insight resistance as a function of temperature
  if (res < 100)                            // limits low resistance value
  {res = 100;}                              // 100 ohm minimum resistance 
  Serial.print("res = ");                   // prints "res = "
  Serial.println(res);                      // prints analog resistance value
  delay(3000);                              // 3 second delay (3000 ms)
 }
 

Donate

Help us shake things up!

Powered by easy paypal donation

User Login

Countdown to Bonneville

 
 Auto X-Prize Contender