A software-based PID controller for Rancilio Silvia espresso machines, running on Raspberry Pi with Docker.
This PID controller provides precise temperature control for the Rancilio Silvia espresso machine, eliminating the need for "temperature surfing" and providing consistent brew temperatures. The system uses:
- MCP9600 thermocouple for accurate temperature sensing
- Node.js PID controller for precise heating control
- Real-time web interface with WebSocket updates
- MongoDB for temperature history and graphing
- Docker for easy deployment and updates
Created and tested using a V6 E edition Silvia. Results may vary with other models - please share your experiences in Issues!
- π‘οΈ Real-time temperature monitoring and control
- π Live temperature graphing via web interface
- ποΈ Adjustable PID parameters via REST API
- π WebSocket-based live updates (no polling!)
- π³ Containerized deployment with Docker Compose
- π Optional SSL/HTTPS support
- π Comprehensive logging and error handling
- π‘οΈ Safety features (automatic shutdown on sensor failures)
- Raspberry Pi 3/4/5 with 64-bit Raspberry Pi OS (Bookworm/Trixie/Debian)
- MCP9600 thermocouple amplifier connected via I2C
- K-type thermocouple attached to boiler
- Solid-state relay or relay module on GPIO 16
- Internet connection for initial setup
Note: Works with Debian Bookworm and Trixie. The installation script automatically compiles pigpio from source since it's no longer available in these repos.
- Clone this repository to your Raspberry Pi:
git clone <repository-url> silvia-pid
cd silvia-pid- Run the automated installation script:
sudo bash deploy/install.sh- Reboot:
sudo reboot- Start the service:
sudo systemctl start silvia-pid- Access the web interface at
http://raspberrypi.localor your Pi's IP address
π For detailed installation instructions, hardware setup, and troubleshooting, see DEPLOYMENT.md
Edit /opt/silvia-pid/config.json to adjust PID parameters:
{
"target_temperature": 100,
"proportional": 2.6,
"integral": 0.8,
"derivative": 80.0
}Changes are applied automatically within 1 second - no need to restart!
Optional settings can be configured in /opt/silvia-pid/.env:
USE_SSL=true- Enable HTTPSHTTP_PORT=80- HTTP portMONGODB_URL- MongoDB connection string
See env.example for all available options.
- Raspberry Pi (3/4/5) with 64-bit OS
- MCP9600 I2C thermocouple amplifier (address 0x60)
- K-type thermocouple attached to Silvia boiler
- SSR or relay module for heater control (GPIO 16)
See DEPLOYMENT.md for wiring diagrams and detailed hardware setup.
cd /opt/silvia-pid
node scripts/test-thermocouple.jscd /opt/silvia-pid
node scripts/validate-hardware.js# Start the service
sudo systemctl start silvia-pid
# Stop the service
sudo systemctl stop silvia-pid
# Restart the service
sudo systemctl restart silvia-pid
# Check status
sudo systemctl status silvia-pid
# View logs
sudo journalctl -u silvia-pid -fcd /opt/silvia-pid
# View running containers
sudo docker compose ps
# View logs
sudo docker compose logs -f
# Restart containers
sudo docker compose restart
# Rebuild after code changes
sudo docker compose build --no-cache
sudo docker compose up -dGET /- Web interface with live temperature graphGET /api/temp/get/:limit- Get temperature historyGET /api/temp/set/:temp- Set target temperature (Β°C)GET /api/pid/set/:p-:i-:d- Set PID parameters (Kp-Ki-Kd)
WebSocket connection provides real-time temperature updates every 3 seconds.
βββββββββββββββββββββββββββββββββββββββββββ
β Raspberry Pi β
β β
β ββββββββββββββββββββββββββββββββββββββ β
β β Docker Compose β β
β β β β
β β ββββββββββββββββ ββββββββββββββ β β
β β β Node.js App β β MongoDB β β β
β β β β β β β β
β β β β’ PID Loop β β β’ Temp β β β
β β β β’ Web Server β β History β β β
β β β β’ WebSockets β β β’ Graphing β β β
β β ββββββββββββββββ ββββββββββββββ β β
β ββββββββββββββββββββββββββββββββββββββ β
β β β β
β ββββββββββββ ββββββββββββ β
β β MCP9600 β β GPIO 16 β β
β β (I2C) β β (Relay) β β
β ββββββββββββ ββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββ
β β
Thermocouple Heating Element
- Language: Node.js (JavaScript) + Python for thermocouple reading
- PID Library: liquid-pid
- Web Framework: Express.js
- Real-time Updates: Socket.IO (WebSockets)
- Database: MongoDB 7.0 (64-bit)
- Deployment: Docker + Docker Compose + systemd
- Temperature Sensor: MCP9600 via I2C (Python library)
- GPIO Control: pigpio library
The system uses WebSockets instead of HTTP polling for real-time updates, which dramatically reduces load and provides truly live data streaming to clients.
- Automatic heater shutdown after 5 consecutive temperature read failures
- Temperature range validation (0-200Β°C)
- Configurable safety limits
- Comprehensive error logging
- Graceful degradation on sensor failures
Contributions are welcome! Please:
- Test your changes on actual hardware
- Update documentation as needed
- Follow existing code style
- Submit pull requests with clear descriptions
Common issues and solutions are documented in DEPLOYMENT.md.
Quick checks:
- Is I2C enabled?
sudo i2cdetect -y 1 - Are containers running?
sudo docker compose ps - Check logs:
sudo journalctl -u silvia-pid -f
ISC License - See LICENSE file for details
Originally created by srjwebster
Tested on Rancilio Silvia V6 E edition