Introduction: Raspberry Pi Web Interface
These are the instructions to installing the web interface I developed for toggling the gpio pins of a raspberry pi in order to control an active low relay board desinged for arduino. It serves a simple page that allows you to click on a link to alter the state of the pins and gives you feedback on their status simply by turning the link green for an active relay and red for an inactive realy.
Step 1: Install Latest Raspbian Image
python 3.5 at least will be preinstalled
Step 2: Configure the Virtual Environment
This part is optional but it is good practice.
open a terminal and execute the folowing commands:
python3 -m venv env
The last command makes this terminal run in the virtual environment. You know it worked if you see the (env) in front of the terminal
also install the libraries:
pip install django
pip install RPi.GPIO
RPi.GPIO needs to be reinstalled if you are in (env)
Step 3: Download Gpio Folder
Download gpio folder from github in home folder
Step 4: Run the Project
exetute always in the same (env) terminal these commands:
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser (enter the administrator username email and password you are going to use to add links corresponding to GPIO pins)
python manage.py runserver 0:8000
Step 5: Final Thoughts
You can couple it with apache or what ever server you want. I did not find it necessary as there is no traffic to speak of. I run it behind a NAT with a port forwarding configuration and use no-ip for a dynamic dns domain name so I can access it from anywhere.
All you need for it to run in a remote location if a GSM Wifi access point as long as you use the recommended Raspberry pi zero w.
This Project is far from finished. It works but does not look pretty and has no security yet.
We have a be nice policy.
Please be positive and constructive.