ESPHome: Raspberry PI Pico W

Another device I have lying around is a Raspberry PI Pico W which is the version with Wifi and Bluetooth. Running ESPHome on this small and cheap microcontrollers is not mature yet, but it works.

I followed some of the instructions from Koen Vervloesem in his post about the Pico and ESPHome. The wizard still doesn't work, but I didn't want to use the dashboard. So I started copy/pasting a yaml for my Pico W which looks like this:

esphome:
  name: pico2

rp2040:
  board: rpipicow
  framework:
    platform_version: https://github.com/maxgerhardt/platform-raspberrypi.git

api:
  password: ""

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

i2c:
  sda: 20
  scl: 21

sensor:
  - platform: bme280
    temperature:
      name: "BME280 Temperature"
    pressure:
      name: "BME280 Pressure"
    humidity:
      name: "BME280 Humidity"
    address: 0x76

Most of the setup is the same as in the previous post for an ESP32. The differences are the board and the i2c ports. There is no automatic upload yet because the Pico works a bit differently. When in boot mode (pressing the button and then connect to the PC) the Pico connects as a drive. To change the firmware an uf2-file needs to be copied on the device and when finished the Pico reboots. To get this file I used this Docker command and copied the file to the drive:

docker compose run --rm esphome compile pico2.yaml
cp config/.esphome/build/pico2/.pioenvs/pico2/firmware.uf2 /run/media/mfa/RPI-RP2/

After the automatic reboot the Pico is discovered by Homeassistant and everything works the same way as for an ESP32.

img1