mrpjevans / garagedoorbot

MagPi tutorial for controlling relays remotely

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GarageDoorBot

NOTICE

This version is as published in The MagPi. See the Version 2 branch for more features and more resiliant code.

Introduction

GarageDoorBot is a simple script for Raspbery Pi Pico W and the SB Components single-channel Pico relay board (https://shop.sb-components.co.uk/collections/pico-hats/products/pico-single-channel-relay-hat). Upon erceiving a ping over MQTT, the relay is closed for half a second. Useful for remote triggering of switches. In the example in The MagPi, we used this to open and close a garage door.

Requirements

  • Rapsberry Pi Pico W with MicroPython firmware.
  • MQTT Broker

Installation

Edit main.py and complete the values to set up your wifi network and MQTT broker.

Copy these files to the Pico W:

  • main.py
  • umqtt_simple.py

Testing

With the Pico W powered up, send a message to the MQTT topic (default: garage/door/operator/trigger) using your favourite client (e.g. mosquitto_pub). You should hear the relay click on and off. If you do, all is working well. Now you can connect the relay board to triggers using the NO and COM terminals. ALWAYS check the voltages are in safe ranges.

About

MagPi tutorial for controlling relays remotely

License:MIT License


Languages

Language:Python 100.0%