ESPHome on the Raspberry Pi Pico!

Raspberry Pi Pico with RP2040 Maker Pi from Cytron and Seeed Studio WIORP2040-A Dev Board

A couple weeks ago, I glanced through my ever-growing collection of Raspberry Pi RP2040-based boards—pictured above are three of the boards I've tested: a Cytron Maker Pi RP2040, a Raspberry Pi Pico, and a Seeed Studio Wio RP2040.

I'm not an expert in embedded programming by any means, but I've played with Arduinos, the ESP8266, and Raspberry Pi's RP2040—all of which are great for building little low-power home sensors to integrate into my Home Assistant Yellow...

But doing so requires a bit of programming work in MicroPython or C, and while it's not rocket science, the more I've seen of ESPHome and how you basically set up YAML files to flash your devices, the more I've been jealous of how easy ESP[8266/32] users have it.

So I was digging around, and I found there's actually a PR to add support for the RP2040 platform to ESPHome!

Naturally, I took it for a spin, and to my surprise—after working with the author to get some library versions updated so they'd run on my M1 Mac—basic functionality worked perfectly!

Hopefully the work is merged into ESPHome soon (along with WiFi support for boards like the WIORP2040 that support it), but for now, if you want to test out ESPHome on a Raspberry Pi Pico or another RP2040 device, here's how:

  1. Make sure you have Python 3 installed on your computer (check ESPHome's guide for instructions.
  2. If you already have ESPHome installed on your computer, uninstall it for now.
  3. Use pip3's source install feature to install from the pull request fork: pip3 install git+[email protected]
  4. Make sure the install is working correctly with esphome version. That should return something like 2022.7.0-dev.

For my Pico, just to make sure everything was working end-to-end, I created the following ESPHome config and named it led-blink.yml:

  name: rpi-pico

  board: pico

  - platform: gpio
      number: 25
      mode: output
    id: LED

  - interval: 500ms
      - output.turn_on: LED
      - delay: 250ms
      - output.turn_off: LED

Hold down the BOOTSEL button on your Pico as you plug it into your computer using a USB cable, and it should mount on your computer with a volume label like "RPI-RP2".

Run the following command to compile the led-blink configuration and flash it to the Pico:

$ esphome run led-blink.yml --device /Volumes/RPI-RP2

(That was how I ran it on my Mac—if you're on Linux or Windows, the path for the USB volume will be different.)

After about 30 seconds, the firmware was uploaded, and my Pico began blinking—all built with a single YAML configuration with ESPHome!

Blinking Raspberry Pi Pico


Thanks for this simple but informative post. I've just got a Pico W to play with, and a Wemos D1 mini on its way.
Knowing that ESPHome is easy to get installed and compatible with the Raspi is exciting indeed!

Oh boy, I can't imagine how difficult it would be to port PIO to esphome

Thanks for this, I was really looking forward to trying it as I have a couple of ESPHome scripts running on ESP8266. All went well: ESPHome version returned 2022.7.0-dev as expected so I wrote out your script and tried to load it. Alas, it reported that it couldn't find Arduino.h, which I see is requested by core.h. I see core.h also needs pico.h which I don't have either. Am I missing an important RPI2040 component?

That patch has seen a few more commits I believe, read through the comments on the PR issue on GitHub, there might also be some other steps to get it to work (especially on Windows, I think?).

Thanks for the steer. I looked at the original GitHub and finally got mine to work from my Mac by adding the framework: lines in the original GitHub entry, so:

  board: pico
    version: 2.2.2

Thanks for your prompt reply