PicoMQTTServoDemo
A Proof of concept demo using MQTT to control Servos using a Raspberry Pi Pico W
Dependencies
The demo has been built using the following libraries. Copies of which are included in the /lib directory (unchanged).
- The mqtt_as client from micropython-mqtt.
- I created a prototype asyncronous servo library servo_as to drive the servos.
Requirements
This is a list of items used:
- Raspberry Pi Pico W
- Waveshare Pico-Servo-Driver
- 2 SG90 Servos connected to pins 0 & 1
- A local Mosquitto Broker (or use test.mosquitto.org)
Getting Started
- Download/ Clone this repo
- Add a file secrets.py to the top-level directory with the following content :
SERVER = 'test.mosquitto.org' # Or the adress of your local MQTT Broker
SSID = '<Your WiFi SSID>'
PW = '<Your WiFi Password'
- Download the project to your pico and run demo.py
- Send commands using any MQTT Client (e.g.EasyMQTT) to topic /PicoMQTTServoDemo/command
Servo1 90
Servo2 -45
- Monitor servo status by subscribing to topic /PicoMQTTServoDemo/status