Analog Intelligence: The Arduino Nano LM35 Manual

The LM35 is a definitive precision integrated-circuit temperature sensor whose output voltage is linearly proportional to the Celsius temperature. For the Arduino Nano, this sensor acts as a highly accurate analog thermometer. Unlike thermistors, which require complex logarithmic mathematics (Steinhart-Hart equation) to determine temperature, the LM35 provides a simple, direct linear scale that is pre-calibrated in degrees Celsius.

How it Works: The 10mV per Degree Scale

The LM35 operates on a definitive scale of 10mV per degree Celsius. At 0°C, the output is 0V; at 25°C, the output is 250mV; and at 100°C, the output is 1.0V. Because the device is an active integrated circuit, it has a very low output impedance and linear output, making it much less susceptible to self-heating than a standard thermistor.

Wiring the LM35 to Arduino Nano

The LM35 features three pins: VCC, Output, and GND. On the Arduino Nano, the Output pin must be connected to an Analog Input (A0-A7). The Nano's 10-bit ADC translates the 0V-5V range into digital values from 0 to 1023. To ensure high accuracy, the Nano's power supply must be stable, as the ADC reading is relative to the board's supply voltage.

LM35 PinFunctionArduino Nano Pin
Pin 1 (Left)VCC (4V - 30V)5V
Pin 2 (Middle)Analog Output (10mV/°C)Analog Pin A1
Pin 3 (Right)GroundGND

Programming: Converting Volts to Celsius

To calculate the temperature, the Nano first reads the ADC value. If using a 5V reference, each ADC unit represents $5V / 1024 = 4.88mV$. Since the LM35 outputs 10mV per degree, the formula becomes: $Temp = (ADC \times 4.88) / 10$.

// Define Pin Constant
const int sensorPin = A1;

void setup() {
  Serial.begin(9600);
  Serial.println("LM35 Thermal Monitoring System Online...");
}

void loop() {
  // Read the raw analog value (0 - 1023)
  int rawVal = analogRead(sensorPin);

  // Convert raw value to voltage (mV)
  float milliVolts = (rawVal / 1023.0) * 5000.0;

  // Convert voltage to Celsius (10mV = 1°C)
  float celsius = milliVolts / 10.0;

  Serial.print("Current Temperature: ");
  Serial.print(celsius);
  Serial.println("°C");

  delay(1000); // Sample every second
}

Real-World Thermal Scenarios

The Arduino Nano’s responsiveness and the LM35's linearity make it ideal for varied thermal management tasks:

  • Smart Fan Controllers: Using the Nano to adjust the speed of a cooling fan via PWM based on the real-time heat detected by the LM35.
  • Overheat Alarms: Triggering a buzzer or an emergency shutdown if the temperature of a battery pack or motor exceeds a safe limit.
  • Digital Thermometers: Building a compact, portable temperature gauge paired with an I2C OLED display for laboratory or kitchen use.
  • Indoor Climate Logging: Monitoring ambient room temperature and saving data to an SD card to analyze HVAC efficiency.

Common Pitfalls & Precision Optimization

  • Voltage Fluctuations: If the Nano is powered by USB, the 5V rail might actually be 4.7V, causing the temperature to read higher than it is. Fix: Measure the actual 5V pin voltage with a multimeter and use that value in your code's math.
  • Signal Jitter: Analog readings can be noisy. Fix: Implement a 'Software Filter' by taking 10 readings and averaging them, or use a 0.1\u00b5F capacitor across the LM35's output and ground pins.
  • Internal Reference: For much higher resolution (0.1°C), use the Nano's internal 1.1V reference: analogReference(INTERNAL);. This makes the 10-bit scale span 0V-1.1V instead of 0V-5V.
  • Self-Heating: If the LM35 is kept in an enclosed, non-ventilated space, the current it draws can slightly raise its own temperature. Ensure there is adequate airflow around the sensor body.

Final Summary

Interfacing the LM35 with the Arduino Nano is a fundamental skill for building accurate thermal feedback loops. By mastering the linear relationship between voltage and temperature, you bridge the gap between physical heat and digital logic, empowering your projects to monitor and regulate their environment with definitive, pre-calibrated precision.