Today I will introduce a interesting LED thermometer.

It can automatically Cycle through the list of cities and show the temperature on the OLED display and LED strip. You can also use the buttons on the side to manually select the cities to display. It will turn into inactive mode if there's no action in few minutes, and turn off all the LEDs and OLED screen. Any significant light change detected will turn it back on.

Bill of materials

Raspberry Pi Zero W × 1
SD card × 1
1.5-inch OLED module × 1
5V 2.4A power supply × 1
WS2812B LED light bar 5 m (30 pcs / m) × 1
Custom PCB × 1
4mm plywood × 1
6mm plywood × 1
3mm white acrylic sheet × 1
Screws × several
Bolts × several
Washers × several
Stand × several
Soldering iron × 1
Solder × 1
Hot melt adhesive × 1
Wood glue × 1

Weather data

Get free weather data from, which provides weather data for big cities in many countries. Use as follows.

  1. Create a free account on
  2. Copy your apikey for later use.
  3. Download, unzip and open the city.list.json.gz file, search for the city you want to display, and then copy the city ID for later use.

Here's the city ID file. file

Setting Up Raspberry Pi and Coding

Connect the OLED display to the Raspberry Pi and install the library for the OLED display. Make sure the Raspberry Pi is connected to the Internet.

Install the libraries required, as described by the manufacturer, here.

You need to enable the I2C and SPI interfaces and then run update.

sudo apt-get update

Run the commands below to install the necessary libraries.

sudo apt-get install python-dev
sudo apt-get install python-smbus
sudo apt-get install python-serial
sudo apt-get install python-imaging

Run the command below to open the configuration file:

sudo nano /etc/modules

Make sure two lines listed below are included.


Run the command below to get the repo:

git clone https:/ /

Go into the new folder, and unzip

cd 1.5inch-OLED-with-RPi

Run the commands below to install the library:

cd RPi_GPIO-0_6_5
sudo python install

Go back to the main folder:

cd /home/pi/1.5inch-OLED-with-RPi


cd ..

Do the same for


unzip wiringPi
cd wiringPi

Run the following command:

chmod 777 build

Use the following command to check the installation:

gpio -v

Go back to the main folder, and unzip

cd bcm2835-1_45

Then run the following commands to install the library:

sudo make check
sudo make install

Return to /home/pi/1.5inch-OLED-with-RPi/ again and run the command to test the OLED:

cd /Demo_Code/Python/
sudo python

Finally, just write the code, you can refer to my code, please get it on GitHub:

Configuring the Weather API

Go to the folder LED_Thermometer_Code_and_OLED_driver:

cd LED_Thermometer_Code_and_OLED_driver



Finally, as shown, scroll down and change api-key from to your api key. Also, change the city ID and city name to the city you want.

Custom PCB

As shown in the figure, after I figured out the required electronic components, I started to customize the PCB on the Internet. All files are available on GitHub.

The Laser Cutted Enclosure

  1. Use 4mm plywood and 6mm plywood to laser cut the shell. A diffuser model of a 3mm white acrylic sheet for laser cutting LEDs.
  2. Connect electronic equipment and LED strips to laser-cut plywood. Then assemble the case.
  3. 3D printed buttons and switches for matching use.

Download all 3D printed files on GitHub. You may need to shrink the SVG file to 75%.


So far, the entire project is completed.

Last modified: February 15, 2020



Leave a Reply