Weather Data on OLED Using Pi Pico and MicroPython

by mahesh_jo in Circuits > Raspberry Pi

4167 Views, 8 Favorites, 0 Comments

Weather Data on OLED Using Pi Pico and MicroPython

Barometric pressure and temperature sensor and OLED display with Raspberry Pi Pico
vlcsnap-2021-05-21-11h55m22s025.jpg

In this project we are connecting BMP-280 barometric pressure and temperature sensor and SSD-1306 OLED display using Raspberry Pi Pico and showing barometric pressure and temperature using microPython coding.

Supplies

  • Raspberry Pi Pico board
  • BMP-280 Barometric Pressure and Temperature sensor wit I2C support
  • SSD-1306 OLED 0.96" display with SPI support
  • Breadboard and few jumper wires
  • and a Windows/Linux Computer having Thonny installed on it

Attach Pi Pico on Breadboard

IMG_20210520_072526.jpg

Attach Pi Pico on breadboard such that the micro USB port should point outside of breadboard.

Attach BMP-280 and SSD-1306

IMG_20210520_072515.jpg
IMG_20210520_072507.jpg

Attach BMP-280 and SSD-1306 such that their pins point toward the power supply rail of breadboard.

Connect Power Rail

IMG_20210520_072455.jpg

Connect pin 38, ground pin, of Pi Pico to bottom power rail and pin 36, 3.3 volt, to upper power rail of breadboard.

Connect Power to BMP-280 and SSD-1306

IMG_20210520_072444.jpg
IMG_20210520_072436.jpg

Now connect VCC pins of BMP-280 and SSD-1306 to upper power rail i.e. 3.3 volt from Pi Pico.
Connect GND pins of BMP-280 and SSD-1306 to lower power rail i.e. GND of Pi Pico.

Connect SSD-1306 Data Lines

IMG_20210520_072416.jpg

Connect SSD-1306's other pins to Pi Pico, using jumper wires, as given below:

  • SCL of 1306 to GP2 of Pico
  • SDA of 1306 to GP3 of Pico
  • DC of 1306 to GP4 of Pico
  • RES of 1306 to GP5 of Pico

Connect BMP-280 Data Lines

IMG_20210520_072326.jpg

Connect BMP-280's other pins to Pi Pico, using jumper wires, as given below:

  • SDA of 1306 to GP0 of Pico
  • SCL of 1306 to GP1 of Pico

Final: MicroPython Code

vlcsnap-2021-05-21-11h56m20s681.jpg
vlcsnap-2021-05-21-11h55m35s330.jpg

Download python code file baro.py and other 3 support libraries and open it in Thonny.

Press F5 or Run/Current Script to execute the code. The barometric pressure data and temperature from BMP-280 will be displayed on OLED display in every 2 seconds.

This code can be further modified to send this data to a server using WiFi board or can be stored on a SD card.