Home

Awesome

LM35 temperature sensor library for Arduino

Build Status

This is an accurate LM35 analog temperature sensor library for Arduino with noise cancellation.

Library features

Hardware

Supported hardware

Notes:

Arduino UNO - LM35 example

Schematic LM35 and Arduino UNO

LM35Arduino UNO
GNDGND
Vs5V (or 3.3V)
VoutA0 (ANALOG pin)

Notes:

LM35 pins

LM35 pins

LM35 specifications

Examples

Arduino IDE | Examples | Erriez LM35 analog temperature:

Documentation

Usage

Initialization

#include <ErriezLM35.h>
  
// Connect LM35 data pin to Arduino DIGITAL pin
#define LM35_PIN   A0
  
LM35 lm35 = LM35(LM35_PIN);

Read temperature and humidity

void loop()
{
  // Read unsigned temperature from sensor
  uint16_t lm35_temp = lm35.readTemperature();
  
  // Print temperature
  Serial.print(F("LM35: "));
  Serial.print(lm35_temp / 10);
  Serial.print(F("."));
  Serial.print(lm35_temp % 10);
  Serial.println(F(" *C"));
  
  // Wait some time
  delay(2000);
}

Serial output

Analog LM35 temperature sensor example
  
LM35: 18.1 *C
LM35: 18.2 *C
LM35: 18.2 *C
  
...

Library dependencies

Library installation

Please refer to the Wiki page.

Other Arduino Libraries and Sketches from Erriez