Arduino Nano - LM35 Temperature Sensor OLED
This tutorial instructs you how to use Arduino Nano to read the temperature from an LM35 sensor and then display it on an OLED.

Hardware Preparation
Or you can buy the following kits:
| 1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
Buy Note: If you want a bigger OLED display, use the 2.42 inch OLED Display 128x64 .
Overview of OLED and LM35 Temperature Sensor
If you are unfamiliar with OLED and LM35 Temperature Sensor (including pinout, functionality, programming, etc.), the following tutorials can help:
- Arduino Nano - OLED tutorial
Wiring Diagram

This image is created using Fritzing. Click to enlarge image
The diagram below shows the same connections without a breadboard:

This image is created using Fritzing. Click to enlarge image
See The best way to supply power to the Arduino Nano and other components.
Arduino Nano Code - LM35 Temperature Sensor - OLED
Detailed Instructions
- Click to the Libraries icon on the left bar of the Arduino IDE.
- Search for “SSD1306” and locate the SSD1306 library by Adafruit.
- Then, press the Install button to complete the installation.

- You will be prompted to install additional library dependencies.
- To install all of them, click the Install All button.

- Copy the code and open it in the Arduino IDE.
- Click the Upload button in the Arduino IDE to send the code to the Arduino Nano.
- Place the sensor in hot and cold water, or hold it in your hand.
- Check out the result on the OLED and the Serial Monitor.
※ NOTE THAT:
The code in question will center the text both horizontally and vertically on an OLED display.