Installation
Requirements
- Raspberry Pi (any model with GPIO pins)
- Python 3.x
- Modern web browser
Quick Start
Run the installation script:
./install.sh
This will:
- Install system dependencies
- Set up Python virtual environment
- Install Python packages
- Configure GPIO permissions
Backend API
Starting the Server
Activate the virtual environment and start the server:
source venv/bin/activate
python app.py
The server will start on http://localhost:5000
WebSocket Events
gpio_state
: Receives current state of all GPIO pinssystem_stats
: Receives CPU temperature and memory usagetoggle_pin
: Send to toggle individual pin stateset_all_pins
: Send to set all pins to same state
Frontend Interface
Overview
The frontend is built with vanilla HTML, CSS, and JavaScript, making it lightweight and easy to modify.
Key features:
- Real-time GPIO pin controls
- System status monitoring
- Connection status indicator
- Responsive design for mobile and desktop
Using the Interface
- Accessing the Interface
- Open
frontend/index.html
in a web browser - The interface will automatically connect to the backend
- Open
- Controlling GPIO Pins
- Click individual pins to toggle their state
- Use "All On" or "All Off" buttons for bulk control
- Monitoring System
- View real-time CPU temperature
- Monitor memory usage
- Check connection status
API Reference
WebSocket Events
Incoming Events
// GPIO State Update
{
"17": true,
"18": false,
// ... other pins
}
// System Stats Update
{
"cpu_temp": 45.2,
"memory_usage": 32.5
}
Outgoing Events
// Toggle Single Pin
{
"pin": 17
}
// Set All Pins
{
"state": true // or false
}