1.4 KiB
1.4 KiB
DLB Gate Keeper
A Raspberry Pi-based gate control system with a web interface.
Architecture
- Backend: Python FastAPI server with direct GPIO control
- Frontend: React/TypeScript web interface
- Database: SQLite for event logging and settings
- Service: Systemd service for automatic startup and monitoring
Development Setup
Backend (Python)
- Install Python dependencies:
cd backend
pip install -r requirements.txt
- Run the development server:
uvicorn main:app --reload --host 0.0.0.0 --port 3000
Frontend (React)
- Install Node.js dependencies:
cd frontend
npm install
- Start the development server:
npm run dev
Deployment
- Deploy to Raspberry Pi:
./deploy.sh
This will:
- Build the frontend
- Package the Python backend
- Copy files to the Raspberry Pi
- Install Python dependencies
- Set up and start the systemd service
GPIO Setup
The application uses GPIO pin 17 (BCM numbering) by default. You can change this by setting the RELAY_PIN environment variable in the systemd service file.
Make sure the gatekeeper user has access to GPIO:
sudo usermod -a -G gpio gatekeeper
API Endpoints
POST /api/trigger/{direction}- Trigger gate (direction: "open" or "close")GET /api/events- Get recent gate eventsGET /api/settings- Get current settingsPOST /api/settings- Update settings
License
MIT