Raspberry Pico Pi W to Trigger a 330 MHz Gate/Garage Controller via a Relay Switch
- A lightweight web server on a Pi Pico W to toggle a relay switch.
- Easily integrated into Home Assistant to work with sensors, automations and scripts
- For my purposes, the relay switch is soldered to a 330Mhz gate controller to close the switch and simulate a physical button press.
- Minimal HTTP server with routes:
/– simple UI page/led_on,/led_off– onboard LED control, I used this to make sure everything was working before soldering the relay to the Pico Pi/toggle_gate– pulse a relay for 1s (GPIO 20 by default, but you can tweak this in the code)
- Raspberry Pi Pico W
- 1-channel Relay Switch
- 330MHz (or 433MHz) Gate Controller, or really any other similar remote
- Connect the Gate Controller to the Relay Module, and the Relay Module to GPIO 20 of the Pico Pi (adjustable in
main.py)
Flash the official MicroPython firmware to your Pico Pi W using the Raspberry Pi instructions.
git clone https://github.com/markbala/pico-gate-controller
cd pico-gate-controllerCopy the example file:
cp src/secrets.example.py src/secrets.pyEdit src/secrets.py with your details:
WIFI_SSID = "YourWiFi"
WIFI_PASSWORD = "YourPassword"src/secrets.pyis.gitignore’d — never commit your real passwords.
Use Thonny to upload the src folder (or just these 3 scripts) main.py, utils.py, and your secrets.py onto the board.
- Reboot
- Identify the IP address of the Pico Pi W through your router.
- Visit
http://<pico-ip>/in a browser. Should be a local IP, e.g.http://192.168.x.x - Set a fixed IP for this device for convenience thereafter.
- Use exclusively on private LANs or behind a VPN / reverse proxy (Tailscale, Cloudflare Tunnel).
- Never expose directly to the internet.
You can call the Pico endpoints from Home Assistant using rest_command, then wrap them in a script and trigger them via an automation or UI button.
rest_command:
pico_toggle_gate:
url: "http://PICO_IP/toggle_gate"
method: getReplace
PICO_IPwith the IP printed in the Pico serial logs (e.g.,192.168.1.123).
script:
toggle_gate:
alias: Toggle Gate
mode: single
sequence:
- service: rest_command.pico_toggle_gateExample: Open the gate when a specific person arrives home. Can be integrated with sensor that checks if the gate is open or closed
Add a Button card and call the script on tap:
type: button
name: Toggle Gate
icon: mdi:gate-open
tap_action:
action: call-service
service: script.toggle_gateNotes
- Home Assistant must be able to reach the Pico’s IP (same LAN/VLAN).
- If you use VLANs or firewalls, allow outbound HTTP (port 80) from Home Assistant to the Pico IP.
- The Pico server is HTTP only (no TLS). Don’t expose it directly to the internet.
MIT — see LICENSE.
Initial code by Vivian Balakrishnan Adapted for everyday use by Mark Balakrishnan

