LM35 Temperature Sensor with an Arduino Uno

A precision analog temperature sensor that outputs 10 mV per °C, calibrated directly in Celsius.

LM35 Temperature Sensor, A precision analog temperature sensor that outputs 10 mV per °C, calibrated directly in Celsius.
In short

The LM35 needs at least 4 V, so it runs from the Arduino Uno's 5V, and its 10 mV per °C output goes to A0. The sketch switches the Uno's ADC to its internal 1.1 V reference, which turns a coarse half-degree step into about a tenth of a degree.

Wiring the LM35 Temperature Sensor to the Arduino Uno

Pin by pin.

LM35 Temperature SensorArduino Uno
VCC5V
VOUTA0
GNDGND

What to know on the Arduino Uno

  • With the default 5 V reference, one step of the Uno's 10-bit ADC is about 4.9 mV, nearly half a degree. analogReference(INTERNAL) uses the ATmega328P's 1.1 V reference instead: about 1.07 mV, or 0.11 °C, per step, with readings up to 110 °C.Arduino language reference, analogReference(); TI LM35 datasheet SNIS159H, p. 1
  • The internal reference is nominally 1.1 V but varies from chip to chip. For accuracy, measure the voltage on the Uno's AREF pin with a meter while the sketch runs and put that value in ADC_VREF.Microchip ATmega328P datasheet DS40002061B, ADC characteristics
  • analogReference() applies to every analog pin. A project that also reads 0 to 5 V sensors must switch references and, as the sketch does, discard the first reading after each switch.Arduino language reference, analogReference()
  • The LM35 draws 80 µA at most on 5 V and needs 4 V minimum, so the Uno's 3.3V pin cannot power it.TI LM35 datasheet SNIS159H, pp. 4, 10

LM35 Temperature Sensor code for the Arduino Uno

Compiled for arduino:avr:uno on 2026-10-29.

No library needed
// LM35 Temperature Sensor on Arduino Uno: wiring and a free simulation at https://www.tinkered.ai/components/lm35/arduino-uno
const int VOUT_PIN = A0;          // LM35 VOUT
const float ADC_VREF = 1.1;       // analogReference(INTERNAL): the Uno's 1.1 V reference
const float ADC_STEPS = 1024.0;   // 10-bit ADC

void setup() {
  Serial.begin(9600);
  analogReference(INTERNAL);      // 0.1 °C steps, up to 110 °C
  analogRead(VOUT_PIN);           // the first reading after a reference change is discarded
  delay(10);
}

void loop() {
  long sum = 0;
  for (int i = 0; i < 8; i++) sum += analogRead(VOUT_PIN);
  float volts = (sum / 8.0) * ADC_VREF / ADC_STEPS;
  float tempC = volts * 100.0;              // 10 mV per °C, 0 V at 0 °C
  Serial.print("Temperature: ");
  Serial.print(tempC, 1);
  Serial.println(" C");
  delay(1000);
}

LM35 Temperature Sensor on the Arduino Uno: questions

How do I get better resolution from an LM35 on an Arduino Uno?

Call analogReference(INTERNAL) to use the Uno's 1.1 V reference. Each ADC step is then about 1.07 mV, about 0.11 °C, instead of 4.9 mV, and the sensor reads up to 110 °C.

Why is my LM35 reading a few degrees off on the Uno?

The internal 1.1 V reference varies between chips. Measure AREF with a multimeter while using INTERNAL and use that value in the conversion; also average several readings.

Can I power the LM35 from the Uno's 3.3V pin?

No. The LM35 needs 4 V to 30 V (TI datasheet, p. 4). Use the Uno's 5V pin.

Keep going

For AI assistants

This guide as plain Markdown. /components/lm35/arduino-uno.md

What will you build with it?