How to connect a Raspberry Pi Pico to Home Assistant with ESPHome
The world of smart home technology often feels exclusive, dominated by expensive, pre-built devices that limit customization and control. However, a powerful and accessible alternative exists for those eager to take home automation into their own hands. By combining the compact yet capable Raspberry Pi Pico (especially the Pico W with its Wi-Fi capabilities) with ESPHome, an open-source firmware project, hobbyists and DIY enthusiasts can craft bespoke smart devices tailored to their exact needs. This pairing unlocks a world of possibilities, enabling you to transform simple sensors, switches, and displays into seamlessly integrated components of your smart home ecosystem, often with no coding required.
At its core, this project involves using a Raspberry Pi Pico W (the Wi-Fi enabled version of the Pico microcontroller) programmed with ESPHome. ESPHome is an open-source framework that simplifies the process of creating custom firmware for microcontrollers, allowing users to define device behavior and integrations through simple YAML configuration files, often eliminating the need for traditional coding. This matters because it democratizes smart home development, offering a highly customizable, privacy-focused, and often more affordable alternative to commercial products. Unlike many off-the-shelf devices, ESPHome runs locally, removing reliance on cloud services and enhancing data privacy and system reliability, even during internet outages. Real-world applications are vast, from creating intelligent temperature and humidity sensors for climate control, automating lighting based on presence detection, to building custom relay boards for controlling appliances, or even setting up smart pet feeders and monitoring systems.
What you’ll need:
- Raspberry Pi Pico WH
- DHT11 Temperature and Humidity Sensor
- Female – Female Jumper Cables
- Official Raspberry Pi USB-A to Micro-B Cable
- Home Assistant Setup
Step 1: Hardware setup
Connect the DHT11 sensor to the Pico using the following diagram and some jumper cables:

Step 2: Adding ESPHome to Home Assistant
Install ESPhome via the add-on store on your Home Assistant front-end. You can find the Add-on store by clicking on settings, then add-ons. You can either search for ESPHome or find it under the ESPHome heading. After installation, start the add-on and open the web-ui.


Step 3: Installing ESPHome on your Pico
Install ESPhome via the add-on store on your Home Assistant front-end.

1.Click on add new device

2. Add your device name as well as your network name and password.

3. Choose the type of hardware your using, the Raspberry Pi Pico W.

4. Choose manual download. Plug the USB cable into your computer and hold the bootsel button on your Pico W while plugging the USB cable into it.

5. Drag and drop the downloaded YAML file into your Pico W. Close the current pop-up on Home Assistant, and you’ll see a new device has been added. Give it a few seconds to show that it’s online.

You can then edit the YAML file by clicking edit and add the following script if you are using a DHT Temperature and Humidity Sensor. Click save and install, then drag and drop the folder into your Pico W as previously done. You should now be collecting Temperature and humidity data, and it should be displayed on your home page as well! If you want to add the device to your dashboard, you can do so through the integrations page.
sensor:
- platform: dht
pin: GPIO1
temperature:
name: "Living Room Temperature"
humidity:
name: "Living Room Humidity"
update_interval: 15s
Take Control of Your Smart Home
This article has shown you how the powerful combination of the Raspberry Pi Pico W and ESPHome empowers you to build personalized, private, and affordable smart devices. We covered the essential steps, from hardware setup to flashing your Pico W and collecting data. You now have the knowledge to move beyond off-the-shelf products and truly control your smart home.
Ready to get started? We encourage you to try this project yourself! Experiment with different sensors and explore ESPHome’s vast capabilities. Share your unique creations in the comments below – we’d love to see what you build!
For all your project needs, explore our comprehensive catalog of Raspberry Pi Picos, sensors, and accessories at PiShop. You can also find more inspiring guides in our Blog and socials.