All submissions

Interface LM35 temperature sensor

Solving Approach:

How do you plan to solve it?

 LM35 reads linear output Vout of 10mV/degC from --55 to 150

to read negative temps, raise the ground of LM35. Use a diode, see LM35 spec sheet.

so when reading Vout, subtract the forward voltage of the diodes = 2 * .65 V to get the corrected voltage which you then divide by 10 to get the temperature.

Code

/*Paste your code here*/

// C++ code
//
void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);
  analogReference(DEFAULT);
}

void loop()
{
  int signal;
  int voltage;
  int temperature;
  char line[80];
  
  signal= analogRead(A0);
  voltage= map(signal, 0, 1023, 0, 5000);
  voltage = voltage - 2 * 650;
  temperature = voltage / 10;
  sprintf(line, "signal: %d, voltage: %d mV, temperature: %d degC",
          signal, voltage, temperature);
  Serial.println(line);
  
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000); // Wait for 1000 millisecond(s)
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000); // Wait for 1000 millisecond(s)
}

 

Output

Video

Add video of output (know more)

 

 

 

 

 

Photo of Output

Add a photo of your hardware showing the output.

 

 

 

 

Submit Your Solution

Note: Once submitted, your solution goes public, helping others learn from your approach!