Arduino with LM335 temperature sensor and seven-segment display

This Arduino project shows how to read temperature from LM335 analog temperature sensor and print its value on a 3-digit seven-segment display.
The LM335 sensor is a 3-pin analog device which can measure temperature (converts temperature to analog voltage). This sensor requires an ADC module to convert the analog voltage into digital data. Arduino UNO microcontroller (ATmega328P) has one ADC module with 10-bit resolution.

The LM335 sensor has the following features (from LM335 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. For example if the LM335 output voltage is equal to 3.03 (3030 mV) that means the temperature is: 303 Kelvin = 30 °Celsius.

To see how to interface Arduino with 7-segment display visit the following post:
Interfacing Arduino with 7-segment display | 4-Digit counter example

Parts Required:

  • Arduino UNO board
  • 3-Digit (or 4-digit) common anode 7-segment display
  • LM335 temperature sensor   —->   datasheet
  • 3 x PNP transistor (2SA1015, 2S9015, 2N3906 …)
  • 7 x 100 ohm resistor
  • 3 x 4.7k ohm resistor
  • 2.2k ohm resistor
  • Breadboard
  • Jumper wires

Arduino with LM335 sensor and 7-segment display circuit:
Project circuit schematic diagram is shown below.

Arduino with LM335 temperature sensor and 7-segment display - LM335 7 segment

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) of the Arduino. 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 output 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.

The 3 transistors are of the same type (PNP).

Arduino with LM335 sensor and 7-segment display code:
The Arduino code below doesn’t use any library for the 7-segment display.

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.

The connection of LM335 output pin with Arduino is defined in the code as:

Full Arduino code:

The following video shows Proteus simulation of this project (simulation circuit is not the same as real hardware circuit, example circuit diagram is shown above):

Proteus simulation file download:
Arduino + LM335 sensor + 7-segment display

Leave a Reply

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