These days if you wanted to know the temperature outside, or even the humidity levels you would probably just look it up on your phone or better still ask Alexa or Google about it. Here’s a project to challenge the maker in you. Instead of asking Google or Alexa the weather conditions how about building your own simple home weather monitoring project using a Raspberry Pi Pico and a BME 280 programmed with Micropython.
This tutorial is slightly different from the previous BME 280 tutorial. In this tutorial we will be using the PiStop PiMoroni module to light up some LED’s, include a push button which will be used to trigger reading of the value from the BME 280. If you do not have the PiStop PiMoroni module lying around you could consider using 3 LED’s and 3 x 10K Ohm resistors.
PiStop by PiMoroni : The PiStop module from PiMoroni is a simple traffic light module consisting of three LED’S i.e. Green, Amber, Red along with resistors on board to allow you directly interface with any maker board. In our case we chose to use PiStop from PiMoroni along with the Raspberry Pi Pico. The PiStop includes resistors in line with each of the LED’s along with a separate Vcc (power) and GND (ground) line, thus making it really easy for anyone to get started with their traffic light project. The entire package makes it very easy to work with the LED’s and allows embedding the PiStop into various maker projects where a visual traffic light setup might be required.
You can purchase the PiStop from PiMoroni from the following link – PiStop at PiMoroni

Raspberry Pi Pico – Raspberry Pi Pico is a tiny, fast, and versatile board built using RP2040, the flagship microcontroller chip designed by Raspberry Pi in the UK. From light displays and IoT devices to signage and manufacturing processes, Raspberry Pi Pico gives the maker the power to control countless home, hobby, and industrial projects. Programmable in C and MicroPython, the Pi Pico is adaptable to a vast range of applications and skill levels, and getting started is as easy as dragging and dropping a file. More experienced users can take advantage of Raspberry Pi Pico’s rich peripheral set, including SPI, I2C, and eight Programmable I/O (PIO) state machines for custom peripheral support.

Here’s the specifications (from Raspberry Pi Foundation website) of the Raspberry Pi Pico in case you are interested –
- 21 mm × 51 mm form factor
- RP2040 microcontroller chip designed by Raspberry Pi in the UK
- Dual-core Arm Cortex-M0+ processor, flexible clock running up to 133 MHz
- 264kB on-chip SRAM
- 2MB on-board QSPI flash
- 2.4GHz 802.11n wireless LAN (Raspberry Pi Pico W and WH only)
- 26 multifunction GPIO pins, including 3 analogue inputs
- 2 × UART, 2 × SPI controllers, 2 × I2C controllers, 16 × PWM channels
- 1 × USB 1.1 controller and PHY, with host and device support
- 8 × Programmable I/O (PIO) state machines for custom peripheral support
- Supported input power 1.8–5.5V DC
- Operating temperature -20°C to +85°C (Raspberry Pi Pico and Pico H); -20°C to +70°C (Raspberry Pi Pico W and Pico WH)
- Castellated module allows soldering direct to carrier boards (Raspberry Pi Pico and Pico W only)
- Drag-and-drop programming using mass storage over USB
- Low-power sleep and dormant modes
- Accurate on-chip clock
- Temperature sensor
- Accelerated integer and floating-point libraries on-chip
Pinout diagram for the Raspberry Pi Pico – To help you work out which pins are located where and what they are called you can refer to the pinout diagram for the Raspberry Pi Pico provided below.

BME 280 sensor – The BME280 is a humidity sensor especially developed for mobile applications and wearables where size and low power consumption are key design parameters. The unit combines high linearity and high accuracy sensors and is perfectly feasible for low current consumption, long-term stability and high EMC robustness. The humidity sensor offers an extremely fast response time and therefore supports performance requirements for emerging applications such as context awareness, and high accuracy over a wide temperature range. Operational range for the BME280 is :
- Pressure: 300…1100 hPa
- Temperature: -40…85°C

Bill Of Material – Here are the components you will need to build your home weather station –
- Raspberry Pi Pico microcontroller x 1
- BME280 (not a BMP280) x 1
- Dupont male to male wires x 4
- USB micro cable x 1
- 800 point Breadboard x 1
- 1 x Pi Stop PiMoroni board or 3 LED’s with 3 10K resistors
- 1 x Push button switch
Circuit diagram – Follow the circuit diagram provided below and assemble the circuit before you proceed with programming the Pi Pico to fetch temperature, pressure and humidity from the BME 280.

The above diagram was put together in Fritzing, not being able to access a PiStop module within Fritzing we have displayed the PiStop as three LED’s, each connected to a 10K Ohm resistors (in line with each LED). The connections for this tutorial are to be made as follows –
- PiStop Red LED connected to GPIO 18
- PiStop Amber LED connected to GPIO 17
- PiStop Green LED connected to GPIO 16
- PiStop Vcc connected to Vcc or 3V3 OUT
- PiStop GND (Ground) connected to GND
- BME 280 Vcc connected to Vcc or 3V3 OUT
- BME 280 GND (Ground) connected to GND
- BME 280 SCL connected to GPIO 1
- BME 280 SDA connected to GPIO 0
- 1 end of the push button connected to 3V3
- other end of the push button connected to GPIO 14
If you are using the PiStop PiMoroni module you do not have to use the resistors we’ve shown above. These PiStop module includes SMD resistors on the module. If you do not have the PiStop module you can just use 3 x 10K Ohm resistors instead.
Code for the tutorial – Open up your favourite Micropython editor and type in the following code. There are a number of editors out there for you to choose from. The two most commonly used editors for Micropython are Thonny and Mu. We tend to use Thonny a lot in class with our kids.
from machine import Pin, I2C #importing relevant modules & classes
import time
import bme280
# Setting up the pin which we'll use to blink the onboard LED:
led_green = Pin(16, Pin.OUT)
led_amber = Pin(17, Pin.OUT)
led_red = Pin(18, Pin.OUT)
# Setting up the button with a Pull_Down resistor
button = Pin(14, Pin.IN, Pin.PULL_DOWN)
# Setting up I2C pin for use with the BME280
i2c=I2C(0,sda=Pin(0), scl=Pin(1), freq=400000)
while True:
if button.value() == 1:
bme = bme280.BME280(i2c=i2c)
temp = bme.values[0]
pressure = bme.values[1]
humidity = bme.values[2]
print("Temp is ",temp," || Pressure is ",pressure," || Humidity is ",humidity)
#print(bme.values)
# Blinking the Green LED
led_green.on()
time.sleep(.5)
led_green.off()
# Blinking the Amber LED
led_amber.on()
time.sleep(.5)
led_amber.off()
# Blinking the Red LED
led_red.on()
time.sleep(.5)
led_red.off()
# Sleeping for 3s
time.sleep(2)
else:
# Turning all the LED's off
led_green.off()
led_red.off()
led_amber.off()
Summary – In this tutorial we used Micropython to program the Raspberry Pi Pico to grab temperature, pressure and humidity from the BME 280. The code is designed to run an infinite loop and grab data from the sensor every time the switch is pressed and light up the LED’s after reading the sensor.
We hope you enjoyed the tutorial. Drop us a note at trevor at hack2 dot live if you have any questions, comments or suggestions.