Skip to content

vipconsult/rpi-web-control

Repository files navigation

Raspberry Pi web GPIO controller Build Status

a very minimalistic app to control the RPi outputs using a web browser

  • garage or front door
  • heating appliances the app uses go routines and it is non blocking so you can control different pins with different delays and trigger options

Download and run the latest release

it is single executable binary so no dependancies just download and run - quick and effective 👍 tested with RPi-Zero but should also work with Pi-3 when you download the rpi-web-control-pi-3 version

Usage

rpi-web-control -pp password
// -h  - help
// -pp - required - the password that each client should use to authenticate
// -p  - optional - the port for the server - default is 80

open the home page: http://raspberrypi.local
the RPi support avahi/bonjour so you can access it by its hostname: raspberrypi.local

Web Gui Preview

pass  (required) the password set when you started the server using -pp  
type  (optional) timer(set 1 wait and set 0) or toggle(toggle between 1 and 0)
pin   (optional) the pin to control,    default is 18
delay (optional) delay for the timer,   default is `2s`

the home page sends AJAX requests to

http://raspberrypi.local/control?pass=password&pin=18&type=timer&delay=2s

RPi pinout

Build from Source (fun and educational):neckbeard:

Install go on the RPi..

ssh pi@raspberrypi.local
wget https://storage.googleapis.com/golang/go1.8.1.linux-armv6l.tar.gz
tar -C /usr/local -xzf go1.8.1.linux-armv6l.tar.gz
go get github.com/krasi-georgiev/rpi-web-control
~/go/bin/rpi-web-control -pp password

Build on any system and copy it to the Pi

GOOS=linux GOARCH=arm GOARM=6 go build -o rpi-web-control -v *.go
// GOOS,GOARCH - sets the target architecture. This example is for Pi Zero

scp ./rpi-web-control pi@raspberrypi.local:/usr/local/bin/rpi-web-control
ssh pi@raspberrypi.local
rpi-web-control -pp password

[OPTIONAL]Create systemd service so it runs at boot and restarts if killed.

Create the service file nano /lib/systemd/system/rpi-web-control.service

  [Unit]
  Description=Rpi Web Controller

  [Service]
  ExecStart=/usr/local/bin/rpi-web-control -pp password
  WatchdogSec=10s
  Restart=always

  [Install]
  WantedBy=multi-user.target

Enable and start the service...

systemctl daemon-reload
systemctl enable rpi-web-control.service
systemctl start rpi-web-control.service