Raspberry Pi Pico weather display (MicroPython)
Your first MicroPython project: temperature and humidity on an OLED.
Shop by category
Shop all componentsThe RP2350-Zero is a thumb-sized RP2350 board with USB-C. With the Earle Philhower Arduino core and Adafruit TinyUSB it can act as a USB consumer-control device, the same class that media keys use. An EC11 rotary encoder with push switch gives volume up, down and mute.
Tick anything you already have and the total updates.
EC11 rotary encoder with switch
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB-C from the computer.
volume_knob.inoVerify & upload in Electrolark#include <Adafruit_TinyUSB.h>
uint8_t const desc[] = { TUD_HID_REPORT_DESC_CONSUMER() };
Adafruit_USBD_HID hid(desc, sizeof(desc), HID_ITF_PROTOCOL_NONE, 2, false);
int lastA;
void send(uint16_t code) {
hid.sendReport16(0, code); delay(5); hid.sendReport16(0, 0);
}
void setup() {
hid.begin();
pinMode(2, INPUT_PULLUP); pinMode(3, INPUT_PULLUP); pinMode(4, INPUT_PULLUP);
lastA = digitalRead(2);
}
void loop() {
int a = digitalRead(2);
if (a != lastA && a == LOW) {
send(digitalRead(3) == HIGH ? HID_USAGE_CONSUMER_VOLUME_INCREMENT : HID_USAGE_CONSUMER_VOLUME_DECREMENT);
}
lastA = a;
if (digitalRead(4) == LOW) { send(HID_USAGE_CONSUMER_MUTE); delay(300); }
}
Swap the A and B wires or the two codes in the sketch.
Choose the Adafruit TinyUSB stack in the Tools menu and upload again.
Encoders differ; count only every second change of A.
No, consumer control is a standard USB class on Windows, macOS and Linux.
Yes, send the next/previous track codes on a long press.
Yes, the same code runs on any RP2040 or RP2350 board.
4 parts: Waveshare RP2350-Zero Mini Development Board, Hongyan Technology EC11H 7CE20P1ZY20 5-Pin Vertical Rotary Encoder with Switch, Solderless Breadboard and Dupont Jumper Wires (40 pcs). On this page you can tick the parts you already have and add only the rest to your cart.
It is a beginner project and takes about 1 hour. The build on this page has 5 steps.
No. This page has the complete, tested code (volume_knob.ino).
About ₹724 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
USB HID consumer control; Reading a quadrature rotary encoder; Using the RP2350's internal pull-ups.
Your first MicroPython project: temperature and humidity on an OLED.
A web page with ON and OFF buttons that switches a relay over Wi-Fi.
A warm ring light that fades up at dusk and down at dawn.
Turn a Pi and a touchscreen into a home command centre with a clock and to-do list.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.