Arduino

LM335 Temperature Sensor with Arduino

In this article, we will perform an Arduino project to print the ambient temperature on the screen with the LM335.

You can access the datasheet of the LM335 temperature sensor at the following address;

https://www.st.com/resource/en/datasheet/lm335.pdf

After making the simple connection in the image below on the arduino board, we can start the measurement by uploading the given code to our board.

LM335 Arduino Circuit Wiring
int outputPin= 0; //analogread A0

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


void loop()
{
  int raw_voltage= analogRead(outputPin);
  float millivolts= (raw_voltage/1024.0) * 5000;
  float kelvin= (millivolts/10);
  Serial.print(kelvin);
  Serial.println(" degrees Kelvin");
  
  float celsius= kelvin - 273.15;
  Serial.print(celsius);
  Serial.println(" degrees Celsius");
  
  float fahrenheit= ((celsius * 9)/5 +32);
  Serial.print(fahrenheit);
  Serial.println(" degrees Fahrenheit\n");
  
  delay(3000);
}
Output on SerialMonitor
LM335 arduino output
Output on SerialMonitor

Leave a Reply

Your email address will not be published. Required fields are marked *