DEV Community

Cover image for Automating my standing desk with Alexa and a Raspberry Pico W
Matheus Calegaro
Matheus Calegaro

Posted on

Automating my standing desk with Alexa and a Raspberry Pico W


I love my standing desk, it's been a game changer for my posture and for my setup aesthetics. However, I'm lazy and I don't like having to manually adjust its height. I also love my Echo Dot and I wanted to see if I could make my desk voice-controlled. This project is the result of that.


You can preview it on my Instagram Reel


Flow diagram

It all starts by invoking the Alexa skill with the "subir a mesa" or "descer a mesa" intents, which are handled by the native IFTT integration. According to the received instruction, IFTT then sends a message ("UP" or "DOWN") to the Adafruit IO MQTT broker, whom then publishes the message to a specific topic that the Pico W is subscribed to.

When a message is received, the Pico W sends a signal to the corresponding 4n35 optocoupler, which is connected to the desk's pre-programmed up/down buttons. The optocoupler acts as a switch, closing the circuit and triggering the button press.

Image description


This project was built using the Pico W Arduino Framework integration and the code is available on my GitHub.

It's pretty straightforward, it just subscribes to the Adafruit IO MQTT broker and listens for messages, after connecting to the specified wifi network. When a message is received (being UP or DOWN), it triggers the corresponding optocoupler.

I haven't tried it yet, but I think it should be easy to port it over to the ESP32/ESP8266, since the code is pretty simple and the Adafruit IO MQTT library is compatible with both.

The end

I hope you enjoyed this fun little project like I did building it. If you have any questions or suggestions, feel free to comment down below or reach out to me using the links on my site.

Happy hacking =)

Top comments (0)