Tag Archives: weather

Temperature Controlled Stair lights With Raspberry Pi

Ever wished to know the temperature on your way to breakfast after waking up in the morning? Now you can find it out in a fascinating way as Lorraine Underwood at The MagPi magazine designed a temperature controlled colorful stair lights system with raspberry pi. In this tutorial, we’re going to discuss that project.

Temperature Controlled Stair Lights
Temperature Controlled Stair Lights

Required Parts

  • Strip of 50 neopixels
  • A 5V power source for the lights
  • 2 x terminal blocks
  • 2 x male to female jumper cables
  • A raspberry pi zero with SD card with Raspian installed
  • Power supply for the Pi zero (temporary)


Make sure that the raspberry pi power supply gives exactly 5 volts and is capable of outputting 2.5A current.

Make The Circuit

At first, examine your LED strip and find out which pin is what. Connect two wires to GND, one wire to Din, and one wire to +5V pin. Now, connect the 5V pin to the “+” terminal of the female jack and GND pin to the “-” terminal. Tighten the screws of the terminal block to ensure that the wires are connected properly.

Connect the Din and GND pin of the LEDstrip to the GPIO 18 and GND of the Raspberry Pi respectively, using the male-to-female jumper wires. Please note that Broadcom numbering (BCM) is used in this tutorial, not the physical numbering. It will look like below after making the connections:

Connecting Wires To The LED Strip
Connecting Wires To The LED Strip

Set Up The Weather API

You need to set up a weather API in order to get the outside temperature in your area. In this tutorial, forecast.io is used as they allow you to make 1000 queries per day free of cost. Go to forecast.io and select Developer option. Then, click sign up to create a developer account and provide your email address. A secret key will be sent to that address. Store it securely as you’ll need in the next step.

Prepare The Raspberry Pi

At first, you need to install the Adafruit NeoPixel library rpi_ws281x. Go here and follow the instructions to install the required files on your raspberry pi. Once installed, navigate to the examples folder, run any script you wish, and check if the LED strip is functioning properly.

Now, save the below script as stair_lights.py in the Raspberry Pi:

from urllib.request import urlopen
import json
import time
from neopixel import *

apikey="get_your_own_key" # get a key from https://developer.forecast.io/register
# Latitude & longitude - current values are Lancaster University

LED_COUNT = 50 # Number of LED pixels.
LED_PIN = 18 # GPIO pin connected to the pixels (must support PWM!).
LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz)
LED_DMA = 5 # DMA channel to use for generating signal (try 5)
LED_BRIGHTNESS = 8 # Set to 0 for darkest and 255 for brightest
LED_INVERT = False # True to invert the signal (when using NPN transistor level shift)

def color(strip, color, start, end): 
 for i in range(start, end+1):
 strip.setPixelColor(i, color)

count = 0
 while True: 
 #get the data from the api website
 meteo = meteo.decode('utf-8')
 weather = json.loads(meteo)

currentTemp = weather['currently']['temperature']

#negative number will always be on 
 color(strip, Color(0, 0, 255), 0,7) # Blue
 #what's the temp?
 if currentTemp > 0:
 color(strip, Color(75, 75, 255), 8, 15) # light Blue
 if currentTemp > 5:
 color(strip, Color(0, 255, 0), 16, 23) # dark Green
 if currentTemp > 10:
 color(strip, Color(75, 255, 75), 24, 31) # light Green
 if currentTemp > 15:
 color(strip, Color(255, 100, 0), 32, 39) # yellow 
 elif currentTemp > 20:
 color(strip, Color(255, 50, 0), 40, 47) #orange 
 elif currentTemp > 25:
 color(strip, Color(255, 0, 0), 48, 50) # Red 
 #check every 5 minutes (change to crontab)
except KeyboardInterrupt:
 color(strip, Color(0,0,0), 0, 49)

Enter your own secret key in the apikey field on the 7th line. Also, replace the longitude and latitude values on line 9 and 10 with the coordinates of your area. Now save the file and you are almost done.

To start the script automatically after each reboot and check the outside temperature every five minutes, set up a cron task by entering the following command:

sudoE crontab -e

A file will be opened and add the following lines at the end of the file:

*/5 * * * * /usr/bin/python3 /home/pi/stair_lights.py
@reboot /usr/bin/python3 /home/pi/stair_lights.py

Save the file and exit.

The Color Scheme

The following table shows which color represents which temperature range. You can modify the script to change the current color scheme.

Temperature (°C) Lights (Nos) Color
 0 – 4  9 – 16 Light Blue
 5 – 9 17 – 24 Dark Green
 10 – 14 25 – 32 Light Green
 15 – 19 33 – 40 Yellow
 19 – 24  41 – 48 Orange
 25+  48 – 50 Red


Weather Widget using ESP8266

deba168‘s new instructable is a weather widget: “an application that can be downloaded on your PC, laptop or a mobile device and perform the job of providing easy access to weather information”

It’s an ESP8266 based weather display unit which retrieves localized weather information from http://www.wunderground.com by WLAN and displays it on a 128×64 OLED display. It displays the current time with date, some weather information like temperature, pressure, humidity and rainfall, and finally the forecasting for the next 3 days.

Check this demo video:

In order to build this project you need the following parts:

  1. ESP8266 -01 (eBay )
  2. Optional NodeMCU ESP8266-12 ( eBay )
  3. OLED Display (eBay )
  4. Voltage Regulator AMS1117 ( eBay )
  5. Tactile Switch (eBay )
  6. Slide Switch ( eBay )
  7. Resistors ( 10K and 330R )
  8. Female Double Row Straight Pin Header ( eBay )
  9. Male Double Row Right Angle Pin Header ( eBay )
  10. Jumper Wires ( eBay )
  11. Prototype Board ( eBay )

You can build the circuit as per the design below on a  prototype board or a PCB:


For programming you have to use these files:

Arduino Code: ESP8266 Weather Station

Libraries : Json Streaming Parser, ESP8266 Oled Driver for SSD1306 display

The project’s maker advises you to follow his steps in the code inside this zip file to avoid any problems in compiling.

For obtaining data from the Weather Underground , you need to get an API key through signing up in the website and purchasing one. Once you clarify that you won’t use it for commercial use, you won’t be asked for any pay methods.

To make sure that the code will work correctly, you have to change the following things.

  1. Enter the Wunderground API Key
  2. Enter your Wifi credentials
  3. Adjust the location according to Wunderground API
  4. Adjust UTC offset

The final step will be programming the ESP8266 module using FTDI programmer.

Check this video for more information and to see the project in action:


You can check the instructable page for more information and detailed tutorial.

MEAS: five weather sensors on one Arduino shield

by Jan Buiting @ elektormagazine.com:

In a stint of list-o-mania TE Connectivity have slapped five environmental sensors on a single board called MEAS for plugging onto the Arduino/Genuino 101 and Uno R3. Here goes in telegram style.

MEAS: five weather sensors on one Arduino shield – [Link]

A full-featured, portable weather data recorder


Do you wonder how to build a personal weather station with data logging capability? Well, Jesus Echavarria, a electronic engineer and DIY hardware maker from Spain, has shared the details of his design of a very professional-looking, full-featured, and portable weather data recorder that is capable of recording ambient temperature, humidity, and light level into a SD card along with a time stamp. The datalogger is based on the PIC18F2620 microcontroller and has options to be powered with a rechargeable 3.7V lithium battery as well as from a USB port. It also features a Lithium battery charger circuit on board using Microchip’s fully-integrated MCP73832 Li-Ion charge management controller IC that is configured to provide a charging current of ~200mA. Two on-board LEDs provide visual indications about the battery condition, such as fully charged or under charging.


On the sensor part, the project uses HDC1050 for temperature and humidity measurements, and TEMT6000X01 for ambient light sensing. The time keeping is performed using M41T00SM6 RTC chip with a separate back-up power supplied from a coin-cell battery.  Two push buttons and two extra leds used in his design to provide a minimal user interface, and most of the configuration part (like time and date settings) is done through a PC terminal program using a command-line interface. The MCP2221 based USB-UART bridge provides the communication interface between the PC terminal program and the PIC microcontroller. Jesus also shares the design files of the 3D printed case he made for his data logger to get a more professional look.

For more details: http://www.jechavarria.com/2016/08/31/portable-temperature-humidity-light-ambient-datalogger/

WiFi Weather display using a Wemos D1 board and operweathermap.org website

educ8s.tv published a new project, a ESP8266 Wifi weather display.

In this video we are going to build a WiFi Weather display with the impressive Wemos D1 board. The board uses the ESP8266 chip in order to connect to the internet and we are going to program it using the Arduino IDE. The project gets weather data from the openweathermap.org website and displays some of the data on the display. As you are going to find out, you can build this project in less then 10 minutes. Let’s start!

A few weeks ago I published a video about the impressive WeMOS D1 board which is an ESP8266 based board which resembles the Arduino Uno. Today we are going to build our first project with it. A weather display, using this old LCD display shield I was using with Arduino Uno a long time ago. As you can see, the display works fine with the WeMOS D1 board! The project, connects to my WiFi network, and then it downloads the weather data for my location from the openweathermap website, and prints some of data in the display! It downloads new data for my location every 10 minutes. It is nice project to start with the ESP8266 chip. Let’s see how to build it.

WiFi Weather display using a Wemos D1 board and operweathermap.org website – [Link]

LED Weather Forecast using Raspberry Pi


AughtNaughtZero @ instructables.com posted his latest project, a LED matrix visualizing data from a weather website such as temperature, pressure, humidity, wind speed etc.

This project utilizes a 6 x 16 matrix of RGB LEDs to visualize a weather forecast pulled from the Weather Underground API. A Raspberry Pi runs a python program designed to fetch weather forecast data from the API at regular intervals, parse the data into temperature, pressure, humidity, wind speed, chance of precipitation, and weather condition arrays, and then colorize and display that data across the LED matrix.

LED Weather Forecast using Raspberry Pi – [Link]

ATMEGA328 based Weather Station


Vlad @ denialmedia.ca has build a solar powered weather station based on ATMega328 microcontroller that is able to measure temperature, a humidity, and UV radiation and it uploads measurement on WeatherUnderground network. The data are send to the air using a 433MHz link. The sensors used are DHT22, ML8511, BMP180 and a TP4056 charger IC is used to charge the Li-Po battery from a solar cell.

ATMEGA328 based Weather Station – [Link]

Arduino TFT Forecast Weather Station with ESP8266


tufantas @ instructables.com has build a weather forecast display using  Arduino Mega 2560, 7″ inch TFT display and ESP8266 Wifi module. The display shows 3 days weather forecast, Current weather conditions, Current wind directions & speed with analog gauge meter, Indoor temperature and NTP time.

Arduino TFT Forecast Weather Station with ESP8266 – [Link]

ESP8266 weather display – work in progress


Markus Hirsch is working on a ESP8266 weather display using an AVR mcu and an OLED display:

This is a little weather monitor. It has a 2.2″ color display and is powered by an AVR and the ESP8266. The AVR controles the display. The ESP has a custom firmware written in the Arduino IDE and provides all the weather data in a neat and very simple pre-parsed protocol. The AVR can obtain different data via a simple UART command. It is still in development. A 512kB serial SPI flash provides all the icons, images and palette data.

ESP8266 weather display – work in progress – [Link]

ESP8266 Weather Widget


deba168 @ instructables.com has build an ESP8266 based OLED display weather widget.

This is an ESP8266 based Weather Display unit which retrieve localized weather information from http://www.wunderground.com/ by WLAN and display it on a 128×64 OLED Display.

ESP8266 Weather Widget – [Link]