Digital thermometer with Arduino and LM335 temperature sensor

Arduino with LM335 sensor

This post shows how to build a digital thermometer using Arduino and LM335 analog temperature sensor.
Simply, the LM335 is a 3-pin device (like a transistor) which converts temperature into analog voltage. This sensor requires an ADC (Analog-to-Digital) module in order to convert the analog voltage into digital data.

The LM335 temperature sensor has the following features (from the datasheet):

  • Directly Calibrated to the Kelvin Temperature Scale
  • 1°C Initial Accuracy Available
  • Operates from 400 μA to 5 mA
  • Less than 1-Ω Dynamic Impedance
  • Easily Calibrated
  • Wide Operating Temperature Range
  • 200°C Overrange
  • Low Cost

The LM335 has a breakdown voltage directly proportional to absolute temperature at 10 mV/°K. If the LM335 output voltage for example is 3.03 (3030 mV) that means the temperature is: 303 °Kelvin = 30 °Celsius.

Hardware Required:

  • Arduino board
  • LM335 Temperature sensor – datasheet
  • 16×2 LCD
  • 10K ohm variable resistor (or potentiometer)
  • 2.2K ohm resistor
  • Breadboard
  • Jumper wires

Arduino + LM335 sensor circuit:

Arduino LM335 temperature sensor circuit

The LM335 sensor has 3 pins (from left to right):
Pin 1 for calibration, not used in this example
Pin 2: output
Pin 3: GND (ground).
The output pin of the LM335 sensor is connected to analog channel 0 (A0). I chose the 2.2K ohm because as written in the datasheet for optimum accuracy the current flows through the LM335 should be 1mA. For example if the temperature = 27°C, the LM335 output voltage will be 3.00V and assume the supply voltage is exactly 5.00V that means the current flows through the sensor is ( 5 – 3)/2.2 = 0.90mA which is good enough. Also the value 2.2K is a standard value and well used.

Arduino + LM335 sensor code:
Arduino ADC module is used with 10-bit resolution which means the digital value of the input analog voltage varies between 0 (0V) and 1023 (5V). By multiplying the digital value by 0.489 we get the temperature in Kelvin (0.489 = 500/1023). The temperature in degree Celsius = Kelvin – 273.
Example full code is the one below.

The video below shows the Proteus simulation of the example:

Downloads:
To be able to simulate this example, Proteus needs the Arduino library which can be downloaded from the link below. After extracting the files (ARDUINO.IDX and ARDUINO.LIB) put it in the Library folder (ex: C:\Program Files\Labcenter Electronics\Proteus 8 Professional\LIBRARY):
Download

Arduino + LM335 sensor Proteus simulation file download:
Download

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.