/raspberry

Raspberry PI sensor and peripherals usage examples

Primary LanguagePython

Raspberry PI examples

Setup

Most examples in this repo are built for boards with RP2040 chipset, does not really matter if it's a Raspberry or something else, as long as chipset on that board is RP2040.

Install micropython

Depending on the board installation may slightly differ, but it will usually boil down to running board in boot mode so it can be recognised as USB storage device, to which micropython *.uf2 file will have to be copied.

For detailed instructions see either board vendor instructions, micropython docs or raspberry pi docs.

VSCode

I highly recommend using VSCode over Thonny (despite that second one is usually recommended as the default IDE for working with micropython).

In order to be able to push code to board you can use MicroPico extension.

Pipkin

In order to use specific libraries on board you might need to install them on the board. Pipkin makes this task as easy as:

pip install pipkin

and from there all you need is for example:

pipkin install picozero

Base Components

Affiliate link disclaimer!
Links to components in examples are affiliate links. If you buy component using any of those, you won't pay more, but I'll get a cut, which will allow me to add more examples.

If you'd like to get some cashback for your purchases on either Amazon or AliExpress I recommend using LetyShops for that.

Vast majority of examples are built using breadboard, some jumper wires and wither RaspberryPi Pico W or RP2040-Zero.

Examples

This example uses 2x16 LCD with I2C module already soldered in.

This example uses external libraries to communicate with display using I2C:

You will need two files from those repos:

copy them over to your project, and make sure to also send it to board

Components


This example uses HC-SR501 motion sensor.
Second example uses same sensor, but instead of relying only on micropython built in code, this one uses picozero library.

Components


This example uses RP2040-Zero onboard led (type ws2812).
Second example additionally uses tactile switch (both 6x6 mm and 12x12 mm will to just fine).

Components

This example uses SSD1306 128x32 OLED I2C display.

This example uses external library to communicate with display using I2C:

Components

This example uses Mini RC522 RFID module.

This example uses external library to communicate with RFID module:

Components