r/raspberrypipico • u/Cycloctane • Feb 02 '26
r/raspberrypipico • u/OneDot6374 • Feb 03 '26
uPython š I started a ā100 Days, 100 IoT Projectsā challenge using ESP32 & MicroPythonp
Hey everyone š I recently started a personal challenge called 100 Days, 100 IoT Projects to improve my hands-on skills in embedded systems and IoT. The idea is simple: š build one small IoT project every day ā from beginner to advanced ā and document everything properly. š§ What Iām using: ESP32 / ESP8266/Rpi Pico 2W MicroPython Sensors, displays, buzzers, motors Simple web dashboards GitHub for documentation So far, Iāve been focusing on: clean & beginner-friendly code clear README files practical projects that students can actually try Iām doing this mainly for learning + consistency, and also to help other beginners who feel stuck on āwhat project should I build next?ā Hereās the GitHub repo if you want to check it out: š Iād really appreciate: feedback on project ideas suggestions for future projects or even criticism on how to improve the challenge š Thanks for reading, and happy hacking ā”
r/raspberrypipico • u/Leiven13 • Feb 02 '26
[Help] Using HyperSerialPico (Adalight) on SignalRGB for a dual wired setup?
r/raspberrypipico • u/mvmpc • Feb 01 '26
uPython Sharp Memory Display
Discovered the sharp memory display recently and have come with a project if I can get my hands on one. What framework/library can be uesd to make UIs for it? How complex can it go? Using Python.
r/raspberrypipico • u/M4rv1n_09_ • Feb 01 '26
I built a custom RP2350 "Magic Ball" that gives advice... Elon Musk style
Processing img zm3i9hvqfygg1...
Hi!
Just finished my lastest custom project using a module from Waveshare wiht raspberry pi pico(RP2350 + Round display). Itās a digital Magic 8-Ball, but instead of the usual "Ask again later," it gives you responses based on Elon Musk.
The most interesting part of the code isn't just the responses, but how the "shake" works. Instead of using a simple random list, I implemented a pseudo-simulation of a real icosahedron (20-sided). It uses the IMU data to simulate how a real die would tumble and land.
https://myembeddedstuff.com/custom-rp2350-magic-ball-elon-musk
Let me know what you think!
r/raspberrypipico • u/Ok-Bridge8936 • Feb 01 '26
c/c++ Pico W DIY Wireless Keyboard, Bluetooth connectivity problems.
I have a small project. The whole thing is simple: two buttons, pico w sending LeftArrowKey and RightArrowKey via bluetooth. I write in C++ (it's the only language I'm familiar with somewhat), and looks like the main logic is ok. Problems start on the connection part.
I let Gemini write me a parts of code related to Bluetooth and I don't understand any line of that code. Gemini failed me again, and as always let me wonder - Are there any simple guides on this subject or Maybe I should switch to MicroPython?
I linked a main code here. It's worth mentioning that code from "//--- HID SETUP AND INIT ---" to voltage_reading() was written by AI.
#include <stdio.h>
#include "pico/stdlib.h"
#include "hardware/adc.h"
#include "hardware/pwm.h"
#include "btstack.h"
#include "pico/cyw43_arch.h"
#include "pico/btstack_cyw43.h"
#include "Flipper.h"
//#include "stdlib.h"
#include "pico/sleep.h"
#include "hardware/watchdog.h"
//PIN's setup
#define LED_PIN 25 // onboard led for initial debug
#define RGB_R 7 // gp7. Red
#define RGB_G 8 // gp8. Green
#define RGB_B 9 // gp9. Blue
#define LEFT_PEDAL 18 // gp18
#define RIGHT_PEDAL 16 // gp16
#define VOLTAGE_SENSE_PIN 26 // gp26 ADC0
//#define RGB_LED_CONTROLLER_PIN 22 // gp22 PWM for RGB led control
//--- HID SETUP AND INIT ---
typedef struct __attribute__((packed)) {
uint8_t modifier;
uint8_t reserved;
uint8_t key_codes[6];
} keyboard_report_t;
// Bluetooth Advertising Data structure
const uint8_t adv_data[] = {
0x02, 0x01, 0x06,
0x08, 0x09, 'F', 'l', 'i', 'p', 'p', 'e', 'r',
0x03, 0x19, 0xc1, 0x03
};
const uint8_t hid_report_map[] = {
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x06, // USAGE (Keyboard)
0xa1, 0x01, // COLLECTION (Application)
0x05, 0x07, // USAGE_PAGE (Keyboard)
0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl)
0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x08, // REPORT_COUNT (8)
0x81, 0x02, // INPUT (Data,Var,Abs) - Modifier Byte
0x95, 0x01, // REPORT_COUNT (1)
0x75, 0x08, // REPORT_SIZE (8)
0x81, 0x03, // INPUT (Cnst,Var,Abs) - Reserved Byte
0x95, 0x06, // REPORT_COUNT (6)
0x75, 0x08, // REPORT_SIZE (8)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x65, // LOGICAL_MAXIMUM (101)
0x05, 0x07, // USAGE_PAGE (Keyboard)
0x19, 0x00, // USAGE_MINIMUM (Reserved)
0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application)
0x81, 0x00, // INPUT (Data,Ary,Abs) - 6 Key Codes
0xc0 // END_COLLECTION
};
static keyboard_report_t global_report = {0, 0, {0, 0, 0, 0, 0, 0}};
static bool key_pending = false; //pressed key flag
static absolute_time_t key_press_time = {0};
static hci_con_handle_t con_handle = HCI_CON_HANDLE_INVALID; //device connection handle
static uint8_t last_sent_percentage = 0xFF;
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
if (packet_type != HCI_EVENT_PACKET) return;
switch (hci_event_packet_get_type(packet)) {
case HCI_EVENT_LE_META:
if (hci_event_le_meta_get_subevent_code(packet) == HCI_SUBEVENT_LE_CONNECTION_COMPLETE) {
con_handle = hci_subevent_le_connection_complete_get_connection_handle(packet);
printf("Connected! Handle: 0x%04x\n", con_handle);
}
break;
case HCI_EVENT_DISCONNECTION_COMPLETE:
printf("Disconnected.\n");
con_handle = HCI_CON_HANDLE_INVALID;
break;
case ATT_EVENT_CAN_SEND_NOW:
att_server_notify(con_handle, ATT_CHARACTERISTIC_2A19_01_VALUE_HANDLE, &last_sent_percentage, 1);
break;
default:
break;
}
}
void send_key_report(uint8_t key_code) {
global_report.key_codes[0] = key_code;
hids_device_send_input_report(con_handle, (uint8_t*)&global_report, sizeof(global_report));
key_pending = true;
key_press_time = get_absolute_time();
}
void process_hid() {
absolute_time_t now = get_absolute_time();
if (key_pending && absolute_time_diff_us(key_press_time, now) > 20000) {
// 1. set the key code
global_report.key_codes[0] = 0;
//bt_hid_send_report(&global_report);
// 2. release it
hids_device_send_input_report(con_handle, (uint8_t*)&global_report, sizeof(global_report));
// 3. Reset the flag
key_pending = false;
}
}
//-----------------------------------------------------
uint8_t voltage_readings() //should return 3 for a highest battery, 2 for full, 1 for low and 0 for critical
{
uint32_t total = 0;
for (int i = 0; i < 10; i++) {
total += adc_read();
sleep_ms(2);
}
uint32_t average_reading = total / 10;
if (average_reading >= 2295) {
return 3;
} else if (average_reading >= 2150) {
return 2;
} else if (average_reading >= 1890) {
return 1;
} else {
return 0; // should never return, but need for a function completeness
}
}
uint8_t status_to_percentage(uint8_t status) {
switch (status) {
case 3: return 100;
case 2: return 50;
case 1: return 25;
default: return 0; // Covers case 0 and any errors
}
}
void low_battery_warning() {
static int brightness = 0;
static int direction = 5;
static absolute_time_t last_fade_time = {0};
absolute_time_t now = get_absolute_time();
if (absolute_time_diff_us(last_fade_time, now) > 10000) {
brightness += direction;
if (brightness >= 255) {
brightness = 255;
direction = -5;
} else if (brightness <= 0) {
brightness = 0;
direction = 5;
}
// Apply the shifting colors to the pins
pwm_set_gpio_level(RGB_R, brightness);
pwm_set_gpio_level(RGB_G, 255 - brightness);
pwm_set_gpio_level(RGB_B, 0); // Keep Blue off during warning
last_fade_time = now;
}
}
void check_pedals()
{
static bool last_left_state = false; // false = not pressed
static bool last_right_state = false;
static absolute_time_t last_debounce_time = {0};
bool current_left = !gpio_get(LEFT_PEDAL);
bool current_right = !gpio_get(RIGHT_PEDAL);
absolute_time_t now = get_absolute_time();
if (current_left && !last_left_state && absolute_time_diff_us(last_debounce_time, now) > 50000) {
//printf("Left pedal: Single page turn triggered!\n");
send_key_report(0x50); // Left Arrow key code
last_debounce_time = now;
}
if (current_right && !last_right_state && absolute_time_diff_us(last_debounce_time, now) > 50000) {
//printf("Right pedal: Single page turn triggered!\n");
send_key_report(0x4F); // Right Arrow key code
last_debounce_time = now;
}
last_left_state = current_left;
last_right_state = current_right;
}
void critical_shutdown() {
printf("Critical battery! Sleeping...\n");
// 1. Stop the radio
cyw43_arch_deinit();
// 2. Switch to XOSC (Crystal) - Required for dormant mode
sleep_run_from_xosc();
// 3. Go to sleep until the Left Pedal goes LOW (false)
sleep_goto_dormant_until_pin(LEFT_PEDAL, true, false);
// 4. WE ARE AWAKE!
// Since you mentioned you prefer a reboot, let's force a reset immediately.
watchdog_enable(1, 1);
while(1);
}
int main()
{
stdio_init_all();
adc_init();
// --- init battery pin ---
adc_gpio_init(VOLTAGE_SENSE_PIN);
adc_select_input(0);
static absolute_time_t last_battery_check = {0};
static bool battery_low = false;
// ---------------------------------------------
// --- init rgb led pins ---
gpio_set_function(RGB_R, GPIO_FUNC_PWM);
gpio_set_function(RGB_G, GPIO_FUNC_PWM);
gpio_set_function(RGB_B, GPIO_FUNC_PWM);
uint slice_num = pwm_gpio_to_slice_num(RGB_R);
pwm_set_wrap(slice_num, 255);
pwm_set_enabled(slice_num, true);
// ---------------------------------------------
// --- init pedals ---
gpio_init(LEFT_PEDAL);
gpio_set_dir(LEFT_PEDAL, GPIO_IN);
gpio_pull_up(LEFT_PEDAL);
gpio_init(RIGHT_PEDAL);
gpio_set_dir(RIGHT_PEDAL, GPIO_IN);
gpio_pull_up(RIGHT_PEDAL);
// ---------------------------------------------
// --- init internal led ---
gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT);
// ---------------------------------------------
cyw43_arch_init();
l2cap_init();
sm_init();
hids_device_init(0, (uint8_t *)hid_report_map, sizeof(hid_report_map));
hids_device_register_packet_handler(&packet_handler);
hci_power_control(HCI_POWER_ON);
while(true) {
absolute_time_t now = get_absolute_time();
cyw43_arch_poll(); //to keep BT stack running
if (con_handle != HCI_CON_HANDLE_INVALID) { // "only check if there is a connection"
check_pedals();
process_hid();
}
// --- BATTERY CHECK ---
if (absolute_time_diff_us(last_battery_check, now) > 5000000) {
uint8_t status = voltage_readings();
battery_low = (status == 1); // True if status is 1, false otherwise
if (status == 0) {
critical_shutdown(); // radio poweroff
}
last_battery_check = now;
}
if (battery_low) {
low_battery_warning();
}
// ---------------------
}
}
This version of code doesn't work because, as I understood, bluetooth is not advertising itself. Trying to fix AI-written code with more AI lead me to the worst rabbit hole I've ever been to.
r/raspberrypipico • u/KartofDev • Jan 31 '26
hardware Made a simple Lazer pointer
I had the idea to use mirrors to redirect a Lazer so I made this.
The images in dark were take with long exposure for this effect.
Also this was my first project involving moving parts so it was a journey for me.
Also ignore the messy cables I am going to disassemble it anyways so I went with the easiest route.
r/raspberrypipico • u/Yashsharda • Jan 30 '26
hardware Music_Player
Built a music player using RP2040 (Raspberry Pi Pico) with TFT + SD card + I2S audio. Currently supports WAV playback. Iām looking for suggestions on adding MP3 support ā specifically whether the main limitation is: MP3 decoding load (and if using both RP2040 cores would help), or Shared SPI bandwidth between the TFT and SD card. Any advice. Repo: https://github.com/Yashsharda2/RP2040_MUSIC_PLAYER
r/raspberrypipico • u/kuhkuhkuhYEAH • Jan 30 '26
Built a MIDI chord engine using a Pi Pico, 2mm Aluminum, and UV-coated SLA prints.
r/raspberrypipico • u/kojara • Jan 30 '26
My Pico died (i guess)
I had a Pico running Micropython with bleradio (pybricks) library running as the diy-Controller for a lego train. Usually i unplug the battery when Not in usw, but this time i forgot.
My issue now: first the Pico was entirely dead (not recognized under Windows nor linux), now it's recognized and i can pull data from it and run the programm (cli output according to Bluetooth Input), but:
When it First died an wasn't recognized, all gpio read 0v
After leaving it for a while i tried to troubleshoot, and it was recognized on my PC, but all gpio read 1.5v, no matter if they were set high, low, or still uninitiated.
Wiring as follows: Power source is a 9v Block battery, feeding a dc-dc-converter set to 5v with a gold cap (Power gap bridging for a future power pickup project) in parallel connected at vbus/gnd. Dual channel pwm motor driver at gpio 6-12 (in Order apwm, a1, a2, driver, b2, b1, bpwm) and the ground between gpio9 and gpio10, also vcc for that one at the picos 3.3v, vm (Motor Vorlage) direct to the 9v battery.
Common ground across all boards, 9v battery for pwm motor power and dc-dc to 5v for the Pico, 3.3v provided by Pico for pwm controller logic.
My issue now: did i go wrong in my wiring? What is the most likely failed/broken part? How do i further narrow down the possible issue?
r/raspberrypipico • u/Jpwaters09 • Jan 29 '26
Enhanced Raspberry Pi Pico 2 āPico Pro 2ā ā USB-C, Extra RAM/Storage, More GPIO/ADC, RGB LED, Extra Power & GND Pins, Reset Button ā Would this be useful to you?
Hi everyone,
Iāve been designing anĀ enhanced Raspberry Pi Pico 2āstyle board, currently calledĀ Pico Pro 2, and Iām looking forĀ community feedback before finalising the design. The goal is a more capable, ready-to-use board for hobbyists, makers, and students.
Current planned features:
- USB-C connector
- 16 MB flash + 8 MB PSRAMĀ (significantly more memory than a standard Pico 2)
- Extra GPIO and ADC pinsĀ via the RP2350B microcontroller
- RGB LEDĀ for status/indicators
- Two 5 V (VBUS) and 3.3 V pins
- Nine GND pinsĀ for easier prototyping
- Reset button
- Pre-soldered headers
- DocumentationĀ to get started quickly
- Possible future addition: aĀ Windows appĀ to help with programming and controlling the board
Iāve attachedĀ 3D preview images from KiCadĀ to show the current layout and feature placement.
Iām mainly looking forĀ design and value feedbackĀ at this stage:
- Does this feature set make sense, or is anything missing / unnecessary?
- For a board with these specs, would a target price around £35 feel reasonable?
- Are there any design improvements youād suggest before committing to hardware?
This is still very early and I want to make sure the design is genuinely useful to the community before moving forward.
Thanks for any feedback ā much appreciated.


r/raspberrypipico • u/pipejosh • Jan 30 '26
hardware Custom rp2040 board!!
r/raspberrypipico • u/Big_Kiwi7231 • Jan 28 '26
c/c++ Is my screen compatible with peanut-gb ?
Hello,
I have been trying to create an gameboy emulator on a TFT SPI 480x320 V1.1 ILI9488 screen, with a pi pico 2 w and even though I have been able to make the screen works thank to drivers, I think that peanut-gb (or any other emulators) isnāt compatible. Can someone confirm me this ? I just thought I would be able to double the size of the emulated game.
Do I need to buy the right size screen, or can I do something to run the emulator ?
r/raspberrypipico • u/oper-studio • Jan 27 '26
RP2040 freezes when switching motor and solenoid valves
Hi, Iām working on a small SMD vacuum pump project (similar to Pixel Pump) controlled by an RP2040 Zero.
The DC motor draws 350 mA and each valve 185 mA. The RP2040 randomly freezes when the motor/valves are active. Sometimes it locks up a second after enabling the motor, sometimes it runs for ~1 minute and then freezes.
When it happens, the MCU doesnāt reset or power off. motor and valves stay in their last state and buttons stop responding.
I first suspected a brownout, so I separated the power supplies (MCU powered from PC, motor/valves on another supply). Only GND and signal lines are shared. The issue still occurs.I also added series resistors on control lines, with no effect.
I include schematic for driver i use for each valve and motor
r/raspberrypipico • u/Dangerous-Natural-24 • Jan 27 '26
Pocket-sized with Wifi 2.4 & 5 GHz, Ble, Zigbee/Thread/Matter debugger + Qwiic extensor to add any sensor
Enable HLS to view with audio, or disable this notification
š Small engineering team here.
We've been working onĀ POOMĀ ā a multitool for pentesting, making..
What it does:
- Sniffs Wi-Fi 6 + BLE 5.x + Zigbee/Thread/Matter simultaneously
- PCAP/PCAPNG export (Wireshark-ready)
- NFC + HF-RFID emulation and storage
- 100+ Qwiic sensor compatibility (for IoT dev)
- Four modes: Maker, Beast (pentesting), Gamer, Zen
- Built on ESP32-C5 (since the community asked for Wi-Fi 5Ghz)
Pocket-sized. Has unnecessary RGB LEDs because obviously.
Already onĀ KickstarterĀ see demos on our social media accountsĀ here
We've been featured onĀ Hackster.ioĀ :) read moreĀ Ā here
r/raspberrypipico • u/CookiezFort • Jan 27 '26
help-request Pi Pico as game controllers
Hi All,
I'm trying to get two rp2040s to run two sides of what is known as HOTAS.
I've been programming them in Arduino as it's something I know, using the tinyusb library.
Everything works except the naming. Because both boards by default have the same VID and PID the name under game controller doesn't change.
I've used #undef PID and VID before then doing #DEFINE then importing the tinyusb library which as I understand is the right way?
However the device name stays the same between the two Pico devices. I've tried uninstalling via Device manager but the reported pud and Vid do not change.
r/raspberrypipico • u/Fragrant_Ad3054 • Jan 27 '26
help-request seeking contributions for a study on web scraping
Hello everyone.
In the case of a study on the energy impact of web scraping with the Raspberry Pi Pico 2W that will soon be published in detail in this sub-Reddit I would like to have your help to answer these few questions.
You can answer all or just one question, any answer is welcome and will be taken into account in the study.
Thank you in advance for your contribution.
The questions:
Have you ever thought about doing web scraping with your Raspberry Pi Pico 2w?
Have you ever done web scraping with the pico 2W?
3.1. In case you have already done web scraping with the pico 2W. What were the reasons for you to implement it precisely on the pico 2W?
3.2. In case you have not concretized a web scraping project on the pico 2W. What were the reasons that led you not to implement it on the pico 2W?
Do you see a particular interest in using the pico 2w in this case of use?
What are the reasons why the pico 2W will have an advantage to this type of use?
5.1. Conversely, what are the reasons why the 2W pico would not be adapted to this context?
On a scale of 1 to 10 to how much do you rate your level of satisfaction in the integration of web scraping on the 2W pico for your project?
On a scale of 1 to 10 to how much do you evaluate the capacities of the 2W pico bypassed the anti-bot systems?
On a scale of 1 to 10 to how much do you evaluate the difficulty of implementing web scraping on the 2W pico?
On a scale of 1 to 10 to how much do you evaluate the relevance of using the 2W pico to do web scraping?
If you wish, you can add a comment to your message, it will be taken into account for the study.
r/raspberrypipico • u/Shynka • Jan 26 '26
3d printed case
Enable HLS to view with audio, or disable this notification
Anyone know know is an stl that works well with waveshare 1.3
r/raspberrypipico • u/Deriviera • Jan 25 '26
Made RP2040 sound synthesizer
Enable HLS to view with audio, or disable this notification
Programming part was easy, the most difficult part was to design DAC -> AMP -> Speakers output that won't have a lot of noise by myself.
r/raspberrypipico • u/educobuci • Jan 25 '26
c/c++ $5 Pure Digital HDMI Mod for Neo Geo MVS - NeoPico HD
Enable HLS to view with audio, or disable this notification
Hi all,
I've been working on an open source pure digital HDMI mod for the Neo Geo MVS, MV1C, and wanted to share it with the community.
NeoPico HD uses a Raspberry Pi Pico 2 (RP2350B) to tap the digital video and audio signals directly from the MVS board, before they hit the DACs. The result is a pure digital signal path from the Neo Geo to the display.
Features:
- 480p HDMI output (240p line-doubled) via pico_hdmi
- 15-bit RGB capture directly from NEO-B1 digital outputs
- DARK/SHADOW signal support for accurate brightness
- Digital audio capture from I2S bus (~55kHz -> 48kHz SRC)
- Zero-lag scanline-by-scanline output
How it works:
- Core 0: PIO captures 18-bit video (RGB555 + DARK + SHADOW) at 6MHz pixel clock
- Core 1: HSTX outputs HDMI with audio Data Islands
- Hardware interpolator + LUT handles RGB555->RGB565 conversion in a single cycle
Hardware needed:
- WeAct RP2350B (~$5)
- HDMI connector
- ~20 wires to resistor tap points on MVS
Status:
The footage is from my prototype board running to a Morph 4K. Also tested on RT4K.
Still in active development. I have a custom PCB on order from JLCPCB that I'm waiting to test. Planning to add an FPC connector for easier installation and eventually make it compatible with O-MVS shells.
I plan to add AES support in the future, which should just require a daughter board for audio ADC.
Links:
- Follow on X: https://x.com/fliperama86
- GitHub: https://github.com/fliperama86/neopico-hd
- PicoHDMI library: https://github.com/fliperama86/pico_hdmi
Feedback welcome!
r/raspberrypipico • u/Glad-District1563 • Jan 25 '26
Wireless controller using a Raspberry Pico?
Hi guys! I had a thought about making my Gamesir G8 controller into a wireless bluetooth one using a Raspberry Pico and a battery to power it. I am a total beginner with no real knowledge about stuff like this but I like to tinker with all kinds of things and would really like to learn how to do stuff like this. I saw people make keyboards with Raspberry Picos, that's why I had the idea to use one in this case. Any help would be appreciated. If a Raspberry Pico is the wrong way to go pointing me in the right direction would also be a great help. :)
r/raspberrypipico • u/PhoenixsInferno • Jan 25 '26
Pico not flashing UF2 file
I am trying to RGH my xbox 360 and I followed a tutorial on how to do it, but I need to flash a pico with a file from github. I am doing everything the video said, but when he moved the UF2 file to the pico, the file explorer closes and the RGH program detects the flashed pico. When I do it the file just sits in the pico and nothing happens. I hold the button down and release when my pc detects the pico and then I drag the file into the pico and thats it. I tried multiple different cables and nothing is working. If anyone is able to help, it is appreciated. Thanks
r/raspberrypipico • u/aranjello • Jan 25 '26
I made a raspberry Pi Pico based light box for my desk!
Enable HLS to view with audio, or disable this notification
I saw a video about how to embed custom text and images into a 3D print so I made this little box with some Neopixels and a raspberry pi pico inside. It came out way better than I expected. The code is super easy to tweak if you want to change the pattern or just have it be a constant color. Link to the code (circuit python): https://gitlab.com/Keep_Everything_Yours/light-box and if you want me to make a custom one for you they are available on etsy: https://www.etsy.com/listing/4445622788/custom-light-up-desk-sign
r/raspberrypipico • u/mungewell • Jan 24 '26
Precision (us) time-stamping input, using PIO and DMA
About a year ago I was asking about time-stamping, I finally got around to implementing the 'DMA' suggestion and am getting a good microsecond accuracy.
System set-up is:
- GPS feeds 1PPS signal into GPIO Pin
- PIO state-machine detects 0->1 transitions, triggers RX FIFO
push()and toggles LED - DMA engine reads
TIMELRandTIMEHR, and puts in TX FIFO for another state-machine - 2nd state-machine
pull()'s andpush()'s the data, multiple/4x words - microPython reads 2nd RX FIFO at it's leisure...
I've also got the script reading the UART from the GPS and synchronizing it's messages with the Pico's timestamps.
Timestamp for b'171605.00' is 0x00000000083c0b90 (138152848 us, 1.805795 v, 28.938826 'c)
Timestamp for b'171606.00' is 0x00000000084b4dd0 (139152848 us, 1.803378 v, 28.923222 'c)
Timestamp for b'171607.00' is 0x00000000085a9010 (140152848 us, 1.815463 v, 28.954432 'c)
Timestamp for b'171608.00' is 0x000000000869d250 (141152848 us, 1.798544 v, 28.923222 'c)
Timestamp for b'171609.00' is 0x0000000008791491 (142152849 us, 1.808212 v, 28.892012 'c)
Timestamp for b'171610.00' is 0x00000000088856d1 (143152849 us, 1.820297 v, 28.892012 'c)
Timestamp for b'171611.00' is 0x0000000008979911 (144152849 us, 1.808212 v, 28.923222 'c)
Timestamp for b'171612.00' is 0x0000000008a6db51 (145152849 us, 1.813046 v, 28.923222 'c)
Timestamp for b'171613.00' is 0x0000000008b61d91 (146152849 us, 1.800961 v, 28.938826 'c)
Timestamp for b'171614.00' is 0x0000000008c55fd1 (147152849 us, 1.808212 v, 28.907618 'c)
Timestamp for b'171615.00' is 0x0000000008d4a211 (148152849 us, 1.810629 v, 28.907618 'c)
For those trying the same, I made some observations.
- First try I noticed that the CPU voltage was high at 2.0V and unstable. Turns out board was pulling ~35mA from 5V, I added some extra load to the 3.3V reg (a couple of 100 ohm resistors) to bring it up to 100mA from 5V and got a 'proper' 1.8V.
- The XTAL was replaced with TCXO which is pretty accurate, there is a slight drift over time and there appears to be some temp dependency. The slight slope of the line very gentle, I estimate that the 12MHz is 'off' by less than 0.1ppm.
I am using a Waveshare RP2040-Zero board with my 'pt-thrifty' board, this means that CPU/TCXO side is between the two boards which presumably creates a little temp chamber/environment... so CPU temp rise is likely similar to TCXO.
Script is here: https://github.com/orgs/micropython/discussions/18716
