Skip to content

Repository files navigation

Raspberry Pi GPIO Network Server

A configurable Raspberry Pi gateway that turns physical GPIO inputs into UDP messages and UDP commands into GPIO output actions. It includes a browser-based configuration and diagnostics interface.

Features

  • Nine configurable GPI channels; BCM 17, 27, 22, 23, and 24 enabled by default
  • Dry-contact inputs to GND with internal pull-ups, debounce, and retrigger lockout
  • Per-input UDP destination, port, and message
  • Four configurable GPO channels with pulse, on, off, and toggle commands
  • Optional source-IP restriction per output
  • GPIO collision validation across inputs and outputs
  • Live state, counters, last results, and a 250-entry event log
  • Persistent JSON configuration without committing site-specific addresses
  • Rotating 5 MB log with five backups
  • systemd service and installer

Install

On Raspberry Pi OS:

git clone https://github.com/sogorman/Raspberry-PI-GPIO-Network-Server.git
cd Raspberry-PI-GPIO-Network-Server
sudo ./install.sh

Then browse to http://PI-IP:8080.

Useful commands:

sudo systemctl status pi-gpio-network-gateway
sudo systemctl restart pi-gpio-network-gateway
sudo journalctl -u pi-gpio-network-gateway -f

UDP commands

The default listener is UDP port 5005. With GPO 1 enabled, these defaults are available:

GPO1
GPO1 ON
GPO1 OFF
GPO1 TOGGLE

GPO1 pulses the output for 250 ms. Commands and pulse times are editable in the GUI.

Wiring

Inputs default to active-low with the Pi's pull-up enabled:

GPIO ---- dry-contact switch ---- GND

GPIO outputs are 3.3 V logic and must not directly drive relays, lamps, or other substantial loads. Use a suitable transistor/MOSFET/relay driver with flyback protection where applicable.

Configuration

Runtime configuration is stored at /opt/pi-gpio-network-gateway/config.json. The real configuration is ignored by Git; config.example.json contains safe defaults.

Environment overrides:

  • PI_GPIO_GATEWAY_CONFIG
  • PI_GPIO_GATEWAY_LOG
  • PI_GPIO_GATEWAY_MOCK_GPIO=1 for development without Raspberry Pi hardware

Development

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
PI_GPIO_GATEWAY_MOCK_GPIO=1 python app.py

The server intentionally binds its web interface to all interfaces. Use a trusted network or firewall rules; it has no built-in authentication.

About

Raspberry PI GPIO Network Server

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages