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

preview_player
Показать описание
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.

We recommend referring to the following documentation when working with MicroPython on the Raspberry Pi Pico:

Product Links:

Related Videos:

Related Project Links:

Related Articles:

Learn more:
Рекомендации по теме
Комментарии
Автор

How fast can the SPI port run on the pico?

piconano
Автор

I am getting this error

File "/lib/bme280/bme280.py", line 9, in <module>
ImportError: no module named 'argparse'

mrbeardo
Автор

The Installation of the Library won’t work. It says Error when installing. It worked if I directly save the bme280.py into the pico. But I have the feeling it is not so right, is it?

javiers.
Автор

Thank you. I compared the syntax between Arduino IDE and Thonny IDE by blinking the built-in LED on both UNO and Pico boards. It's interesting to see the basic pros and cons of those physical programming languages.

tanleproe
Автор

Really nice video! I have a question regarding the Pico and I2C. I have a I2S dac and would like to connect it to the Pico but it's I2C. Are I2C and I2S compatible? If not, what can I do to make the Pico play sound with the Dac?

cheapnoiseinthehouse
Автор

Actually I am quite curious whether MicroPython would be integrated with TFLite somehow~

xingyuzhou
Автор

This is the only good tutorial on this I have found in over a week.

Kimchi_Studios