Intro to Raspberry Pi Pico and RP2040 - MicroPython Part 2: I2C Sensor | Digi-Key Electronics

Previously, we saw how to run a simple MicroPython program on the Raspberry Pi Pico using Thonny. We printed “Hello, World!” to the console and blinked an LED. In this tutorial, we will use the I2C module to read from a Bosch BME280 temperature, pressure, and humidity sensor. I2C is a popular communication protocol used by various chipmakers and is commonly supported by many sensors. It uses 2 lines--data and clock--and supports multiple devices on a single bus. The RP2040 has 2 I2C buses (not counting the PIO, which we will cover next). We will connect the BME280 sensor to bus 0 and use a simple program to scan the bus. This scan program looks for any devices connected to the bus and returns their addresses. The BME280 sensor can have 2 addresses: 0x76 and 0x77. If the SDO line on the breakout board is connected to 3.3V (default), the address will be 0x77. If it is connected to GND, the address will be 0x76. Next, we install the bme280.py module from this GitHub repository (https://github.com/SebastianRoll/mpy_...) using the Thonny package manager. We construct a simple looping program that reads from the sensor and prints the temperature to the console once every 0.5 seconds. We recommend referring to the following documentation when working with MicroPython on the Raspberry Pi Pico: Raspberry Pi Pico Datasheet: https://datasheets.raspberrypi.org/pi... Raspberry Pi Pico Python SDK: https://datasheets.raspberrypi.org/pi... MicroPython API: https://docs.micropython.org/en/lates... Product Links: https://www.digikey.com/en/products/d... https://www.digikey.com/en/products/d... Related Videos: Intro to MicroPython -    • Intro to MicroPython – Maker.io Tutorial |...   Intro to Raspberry Pi Pico and RP2040 - MicroPython Part 1 -    • Intro to Raspberry Pi Pico and RP2040 - Mi...   Intro to Raspberry Pi Pico and RP2040 - MicroPython Part 2 -    • Intro to Raspberry Pi Pico and RP2040 - Mi...   Intro to Raspberry Pi Pico and RP2040 - MicroPython Part 3 -    • Intro to Raspberry Pi Pico and RP2040 - Mi...   Related Project Links: Written tutorial - https://www.digikey.com/en/maker/proj... Related Articles: Introduction to MicroPython - https://www.digikey.com/en/maker/blog... Raspberry Pi Pico and RP2040 - MicroPython Part 1 - https://www.digikey.com/en/maker/proj... Learn more: Maker.io - https://www.digikey.com/en/maker Digi-Key’s Blog – TheCircuit https://www.digikey.com/en/blog Connect with Digi-Key on Facebook   / digikey.electronics   And follow us on Twitter   / digikey  

Intro to Raspberry Pi Pico and RP2040 - MicroPython Part 3: PIO | Digi-Key Electronics
▶︎

Intro to Raspberry Pi Pico and RP2040 - MicroPython Part 3: PIO | Digi-Key Electronics

Intro to Raspberry Pi Pico and RP2040 - MicroPython Part 1: Blink | Digi-Key Electronics
▶︎

Intro to Raspberry Pi Pico and RP2040 - MicroPython Part 1: Blink | Digi-Key Electronics

Raspberry Pi PICO | Starting With MicroPython + Examples | I2C OLED, ADC, PWM
▶︎

Raspberry Pi PICO | Starting With MicroPython + Examples | I2C OLED, ADC, PWM

Beginners Guide to I2C on the Raspberry Pi Pico (BNO055 IMU Example)
▶︎

Beginners Guide to I2C on the Raspberry Pi Pico (BNO055 IMU Example)

Raspberry Pi Pico W LESSON 23: Temperature and Humidity Sensor with LCD Display
▶︎

Raspberry Pi Pico W LESSON 23: Temperature and Humidity Sensor with LCD Display

Hardware Design with the RP2040: Custom PCB Based on the Raspberry Pi Pico | Digi-Key Electronics
▶︎

Hardware Design with the RP2040: Custom PCB Based on the Raspberry Pi Pico | Digi-Key Electronics

Raspberry Pi Pico Xbox EEPROM Dumper, Quick and Easy
▶︎

Raspberry Pi Pico Xbox EEPROM Dumper, Quick and Easy

#372 How to use the two Cores of the Pi Pico? And how fast are Interrupts?
▶︎

#372 How to use the two Cores of the Pi Pico? And how fast are Interrupts?

Intro to Raspberry Pi Pico and RP2040 - C/C++ Part 3: How to Use PIO | Digi-Key Electronics
▶︎

Intro to Raspberry Pi Pico and RP2040 - C/C++ Part 3: How to Use PIO | Digi-Key Electronics

Capacitive Soil Moisture Sensors don't work correctly + Fix for v2.0 v1.2 Arduino ESP32 Raspberry Pi
▶︎

Capacitive Soil Moisture Sensors don't work correctly + Fix for v2.0 v1.2 Arduino ESP32 Raspberry Pi

Raspberry Pi  Pico PIO  - 8 Little Processors You Can Program
▶︎

Raspberry Pi Pico PIO - 8 Little Processors You Can Program

Intro to Raspberry Pi Pico and RP2040 - C/C++ Part 1: VS Code and Blink | Digi-Key Electronics
▶︎

Intro to Raspberry Pi Pico and RP2040 - C/C++ Part 1: VS Code and Blink | Digi-Key Electronics

Raspberry Pi Pico W: Wireless Weather Station
▶︎

Raspberry Pi Pico W: Wireless Weather Station

3 Easy @Raspberry Pi Pico Projects that ANYONE can tackle!
▶︎

3 Easy @Raspberry Pi Pico Projects that ANYONE can tackle!

UART | Raspberry Pi Pico Workshop: Chapter 4.2
▶︎

UART | Raspberry Pi Pico Workshop: Chapter 4.2

How to Debug the Raspberry Pi Pico Using Another Pico! - Picoprobe and VSCode Tutorial
▶︎

How to Debug the Raspberry Pi Pico Using Another Pico! - Picoprobe and VSCode Tutorial

PicoMite: Running BASIC on a Raspberry Pi Pico
▶︎

PicoMite: Running BASIC on a Raspberry Pi Pico

Raspberry Pi Pico: 10 Things You Might Not Know
▶︎

Raspberry Pi Pico: 10 Things You Might Not Know

In-depth: Raspberry Pi Pico's PIO - programmable I/O!
▶︎

In-depth: Raspberry Pi Pico's PIO - programmable I/O!

How to Use Asyncio in MicroPython (Raspberry Pi Pico) | Digi-Key Electronics
▶︎

How to Use Asyncio in MicroPython (Raspberry Pi Pico) | Digi-Key Electronics