Skip to content

A little app to watch for changes to GPIO pins on the Raspberry Pi and send them to an MQTT topic written in Go

License

Notifications You must be signed in to change notification settings

heathbar/raspi-gpio-mqtt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

raspi-gpio-mqtt

A little app written in Go to watch for changes to GPIO pins on the Raspberry Pi and relay them to an MQTT topic.

The app uses the os.select() to receive changes from the kernel rather than polling to keep CPU usage to a minimum. It also debounces the input so that the MQTT topic does not get spammed.

Dependencies: github.com/brian-armstrong/gpio, github.com/eclipse/paho.mqtt.golang

Setup

git clone [email protected]:heathbar/raspi-gpio-mqtt.git
cd raspi-gpio-mqtt
go get
go build

# root/sudo is required to access the GPIO pins on the raspberry pi. 
sudo ./raspi-gpi-mqtt -b tcp://my-mqtt-server.com:1883

systemd

sudo cp ./raspi-gpio-mqtt.service /etc/systemd/system/
sudo systemd enable raspi-gpio-mqtt
sudo systemd start raspi-gpio-mqtt

TODO

  • mqtt security
  • mqtt QoS
  • configurable debounce timeout

About

A little app to watch for changes to GPIO pins on the Raspberry Pi and send them to an MQTT topic written in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages