arduino-pico
I'm pretty excited about Pico W: it's such a reliable, high-quality board and each one costs just $6 (if you can find one).
I'm building an IoT project with Pico W and Home Assistant, and it took weeks of research and experimentation to figure out the basics of integration of all the necessary components. This starter pulls together everything I've learned so you can get to building quickly.
Fill out src/Credentials.h
, upload to your Pico W, then you'll have a working integration that allows you to toggle the Pico W's board LED from the Home Assistant dashboard. From this starter you'll have a solid foundation to build your own custom device in a private, local Intranet of Things.
This readme will provide pointers to everything you'll need. Let me know if it's missing anything!
arduino-pico
: a community-developed Arduino core for Pico/Pico W and other RP2040 boards with constant updates and excellent support for existing Arduino codearduino-home-assistant
: a thorough Arduino/Home Assistant integration using MQTTBOOTSEL
button on your Pico W while connecting it via USBsrc/Credentials.h
with:
- WiFi SSID
- WiFi Password
- MQTT Username
- MQTT Password
- MQTT Broker IP
X devices
Pico W HA Starter
Board LED
. Toggle the switch to turn your green board LED on and offThat's it. Now you've got a working example integration of all the pieces needed to communicate between an inexpensive, high-quality microcontroller and Home Assistant, all happening on your local network.
See the examples in arduino-home-assistant
for additional components you can easily integrate, including sensors, buttons, even HVAC controls.
Home Assistant can be installed several ways on all kinds of hardware. Raspberry Pi is a popular choice, but you can also use your existing computer for initial explorations. Home Assistant Container is probably the quickest and most portable way to get started, whichever hardware you're using, though this does mean you'll have to manage some add-ons yourself, including MQTT.
MQTT provides realtime messaging between devices in a network. The Eclipse Mosquitto project offers a server that can act as an MQTT broker, a central hub for MQTT devices to send and receive data.
If you're using Home Assistant Operating System, check these instructions to install the Mosquitto MQTT broker add-on.
If you're using Home Assistant Container, this tutorial provides a great overview on how to set up and secure Mosquitto in a seperate container.
Once your MQTT broker is enabled, add the MQTT integration to your Home Assistant instance.
PRs are welcome on these points:
The goal of the project is to provide enough example structure to allow developers to add complexity without making a messy, crowded main.cpp
file. PRs that simplify down to a single file probably won't be merged. If you have ideas on how to make this an even better foundation for building complex IoT projects, I'm all ears.
Questions? Comments? Gripes? Open an issue if you think there will be general interest or impact on the project. Otherwise hit me up: mail@danilocampos.com.