Mini Weather Screen

by harryff in Circuits > Raspberry Pi

15 Views, 0 Favorites, 0 Comments

Mini Weather Screen

hq720.jpg

i am planning to make a mini screen that displays the weather hopefully using the app called willy wether as the main weather results

Supplies

  1. Raspberry Pi Pico 2W
  2. Waveshare 2.7inch e-Paper Display Module
  3. Jumper Wires
  4. Soldering Iron
  5. 3mm PVC Sunboard
  6. Paper Cutter
  7. All purpose Glue
  8. Wallpaper Sheet

Research

The Raspberry Pi Pico is a small and cheap microcontroller that can be used with a breadboard and LCD screen to make simple electronics projects. A breadboard allows you to build circuits without soldering, which makes it great for beginners. One of the easiest LCD screens to use is a 16x2 I2C LCD because it only needs four wires connected to the Pico: power, ground, SDA, and SCL. Popular beginner projects include displaying “Hello World” on the screen, showing temperature readings using the Pico’s built-in sensor, and making quiz games with buttons and an LCD display. Most projects use MicroPython, which is a simple programming language that can be written in the Thonny IDE. Common problems for beginners include loose breadboard connections, incorrect wiring, and wrong voltage settings. Helpful tutorials and guides can be found on Tom’s Hardware, the Official Raspberry Pi Website, and Thonny IDE.

Wiring

E-Paper SPI Wiring

E-Paper -------- Pico Pin

VCC -- 3.3V

GND-- GND

DIN -- GP11 (MOSI)

CLK -- GP10 (SCK)

CS -- GP9

DC -- GP8

RST -- GP12

BUSY -- GP13

System Cirkit Desgin

Screenshot 2026-05-15 at 9.23.27 am.png

Code

# ================================================
# Weather Monitoring Station for Raspberry Pi Pico + e-Paper
# Works with most Waveshare 2.13", 2.9", etc. displays
# ================================================

from machine import Pin, SPI
import time
import network
import urequests as requests
import json

# ================== CONFIG ==================
SSID = "YOUR_WIFI_SSID"
PASSWORD = "YOUR_WIFI_PASSWORD"

# OpenWeatherMap API (get free key at openweathermap.org)
API_KEY = "YOUR_OPENWEATHERMAP_API_KEY"
CITY = "Melbourne" # Change to your city
COUNTRY = "AU"

# Change these pins according to your wiring (from the image)
EPD_SPI = SPI(1, baudrate=4000000, sck=Pin(10), mosi=Pin(11)) # Example pins

CS = Pin(9, Pin.OUT)
DC = Pin(8, Pin.OUT)
RST = Pin(12, Pin.OUT)
BUSY = Pin(13, Pin.IN)

# ================== EPD DRIVER (simplified) ==================
class EPD:
def __init__(self):
self.cs = CS
self.dc = DC
self.rst = RST
self.busy = BUSY

def reset(self):
self.rst.value(0)
time.sleep(0.2)
self.rst.value(1)
time.sleep(0.2)

def send_command(self, command):
self.dc.value(0)
self.cs.value(0)
EPD_SPI.write(bytearray([command]))
self.cs.value(1)

def send_data(self, data):
self.dc.value(1)
self.cs.value(0)
if isinstance(data, int):
EPD_SPI.write(bytearray([data]))
else:
EPD_SPI.write(data)
self.cs.value(1)

def wait_until_idle(self):
while self.busy.value() == 0:
time.sleep(0.1)

def init(self):
self.reset()
# Basic initialization for 2.13" B/W (adjust for your display size)
self.send_command(0x01) # Power setting
self.send_data(0x03)
self.send_data(0x00)
self.send_data(0x2b)
self.send_data(0x2b)
self.send_data(0xff)

self.send_command(0x11) # Data entry mode
self.send_data(0x03)

self.send_command(0x44) # Set RAM X
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x0f)
self.send_data(0x00)

self.send_command(0x45) # Set RAM Y
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x7f)
self.send_data(0x00)

self.send_command(0x3C) # Border
self.send_data(0x80)

self.send_command(0x21) # Display update control
self.send_data(0x00)
self.send_data(0x80)

self.send_command(0x18) # Temperature sensor
self.send_data(0x80)

self.send_command(0x4E) # RAM X counter
self.send_data(0x00)

self.send_command(0x4F) # RAM Y counter
self.send_data(0x00)
self.send_data(0x00)

def clear(self):
self.send_command(0x24)
for i in range(2000): # Adjust for your resolution
self.send_data(0xFF)
self.update()

def update(self):
self.send_command(0x22)
self.send_data(0xF7)
self.send_command(0x20)
self.wait_until_idle()

# ================== WEATHER FUNCTIONS ==================
def connect_wifi():
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(SSID, PASSWORD)
print("Connecting to WiFi...")
while not wlan.isconnected():
time.sleep(1)
print("Connected!", wlan.ifconfig())

def get_weather():
url = f"http://api.openweathermap.org/data/2.5/weather?q={CITY},{COUNTRY}&appid={API_KEY}&units=metric"
try:
response = requests.get(url)
data = response.json()
temp = data['main']['temp']
feels_like = data['main']['feels_like']
humidity = data['main']['humidity']
description = data['weather'][0]['description']
icon = data['weather'][0]['icon']
return {
"temp": round(temp, 1),
"feels_like": round(feels_like, 1),
"humidity": humidity,
"description": description.capitalize(),
"icon": icon
}
except:
return None