A versatile PID temperature controller designed for soldering rework stations, reflow ovens, and other precision temperature control applications. Supports ESP32 (with display and Bluetooth) and Arduino Nano (minimal configuration). Features thermocouple temperature sensing, optional OLED display, and Bluetooth/Serial control interface.
- PID Temperature Control: Precise temperature regulation with tunable PID parameters (Kp, Ki, Kd)
- Auto-Tune: Automatic PID parameter optimization using relay-feedback method
- Power Control: Configurable maximum power limit and manual power override for safety and testing
- Temperature Bridge Mode: Host-driven temperature input for bridged/multi-device setups (thermocouple ignored)
- MAX6675 Thermocouple Interface: Accurate temperature readings up to 1024°C
- Multiple Board Support: ESP32 (full features), Arduino Uno, or Arduino Nano
- OLED Display: Real-time temperature, power percentage, and status display (ESP32)
- Dual Control Interface: Bluetooth and Serial command support
- Time-Proportional SSR Control: Smooth 2-second cycle PWM for solid-state relays
- Persistent Settings: PID parameters and setpoint stored in flash/EEPROM
- Improved PID Algorithm: Fast 250ms updates with derivative filtering and smart anti-windup
- Open Source: MIT licensed for easy modification and integration
- Board: Heltec WiFi Kit 32 or compatible ESP32
- Features: Display, Bluetooth, persistent settings, all commands
- Environment:
heltec_wifi_kit_32
- Board: Arduino Uno (ATmega328P)
- Features: Serial control, persistent EEPROM settings, reliable USB (ATmega16U2/FTDI)
- Environment:
uno - Note: More reliable serial communication than Nano clones with CH340
- Board: Arduino Nano (AT, Arduino Uno, or Arduino Nano
- MAX6675 Thermocouple Interface Module
- K-Type Thermocouple
- Solid State Relay (SSR) for heater control
- SSD1306 OLED Display (128x64, I2C) - ESP32 only
- Optional: External FT232 USB-Serial module for reliable Nano serial communication
- ESP32 Development Board or Arduino Nano
- MAX6675 Thermocouple Interface Module
- K-Type Thermocouple
- Solid State Relay (SSR) for heater control
- SSD1306 OLED Display (128x64, I2C) - ESP32 only
CLK→ GPIO 18CS→ GPIO 5DO→ GPIO 19VCC→ 3.3VGND→ GND
SSR Signal→ GPIO 25Status LED→ GPIO 22
CLK→ Digital Pin 7CS→ Digital Pin 8DO→ Digital Pin 6VCC→ 5VGND→ GND
SSR Signal→ Digital Pin 3 (PWM)Status LED→ Digital Pin 13 (Built-in LED)
Note: For Nano with CH340 USB chip issues, connect external FT232 module to TX/RX pins for reliable serial communication.
DO→ Digital Pin 6VCC→ 5VGND→ GND
SSR Signal→ Digital Pin 3 (PWM)Status LED→ Digital Pin 13 (Built-in LED)
- PlatformIO (recommended) or Arduino IDE
- Required Libraries (ESP32 only):
- Adafruit GFX Library
- Adafruit SSD1306
-
Clone or download the repository
git clone <repository-url> cd ReworkTc
-
Build for ESP32
pio run -e heltec_wiUno** ```bash pio run -e uno
-
Build for Arduino Nano
pio run -e nanoatmega328
5 pio run -e nESP32**
pio run -e heltec_wifi_kit_32 --target upload --upload-port COMX-
Upload to Arduino Uno
pio run -e uno --target upload --upload-port COMX
-
Upload to Arduino Nano
pio run -e nanoatmega328 --target upload --upload-port COMX
Replace
COMXwith your board's serial port (e.g.,COM7on Windows,/dev/ttyUSB0on Linux)
8 ```
-
Upload to Arduino Nano
pio run -e nanoatmega328 --target upload --upload-port COMX
Replace
COMXwith your board's serial port (e.g.,COM7on Windows,/dev/ttyUSB0on Linux) -
Monitor Serial Output
pio device monitor
- Install ESP32 board support
- Install required libraries via Library Manager
- Open
src/main.cppand compile - Upload to your ESP32 board
Edit platformio.ini to customize pin assignments and features:
build_flags =
-DBT_ENABLED=1 ; Enable (1) or disable (0) Bluetooth
-DDISABLE_DISPLAY=0 ; Disable display if not used
-DPID_OUTPUT_PIN=25 ; SSR control pin
-DHEATER_LED_PIN=22 ; Status LED pin
-DSSR_PERIOD_MS=2000 ; SSR PWM cycle time (ms)
-DMAX6675_CLK=18 ; MAX6675 clock pin(ESP32) and Serial. Serial Settings:
- ESP32: 115200 baud
- Arduino Uno/Nano: 9600 baud
- Format: 8-N-1 (8 data bits, no parity, 1 stop bit)
Commands are case-sensitive and end with newline (\n).
| Command | Description | Example |
|---|---|---|
SET:<temp> |
Set target temperature (0-400°C) | SET:250 |
ON |
Enable PID controller | ON |
OFF |
Disable PID controller | OFF |
STATUS |
Get current status | STATUS |
KP:<value> |
Set proportional gain | KP:10.0 |
KI:<value> |
Set integral gain | KI:0.5 |
KD:<value> |
Set derivative gain | KD:50.0 |
TUNE |
Start PID auto-tune | TUNE |
POWER:<value> |
Manual power override (0-100%) | POWER:50 |
RELEASE |
Release manual power control | RELEASE |
MAXPOWER:<value> |
Set maximum power limit (saved) | MAXPOWER:80 |
TBRDG:ON |
Enable temperature bridge mode | TBRDG:ON |
TBRDG:OFF |
Disable temperature bridge mode | TBRDG:OFF |
BRT:<temp> |
Host-reported temperature in bridge mode | BRT:75 |
HELP |
Show command list | HELP |
OK Setpoint=120 (saved)
MAXPOWER:80 OK Max power limit set to 80% (saved)
POWER:50 OK Power set to 50% (manual override)
RELEASE OK Power control released to PID
TUNE OK Auto-tune started. Wait 5-10 minutes... WARNING: Monitor temperature! Stop if unstable.
[Wait for auto-tune to complete...]
Auto-tune complete! Kp=12.34 Ki=0.67 Kd=45.21
ON OK PID=ON
STATUS SETPOINT:120 ENABLED:1 TEMP:119.8 POWER:28 MAX_POWER:80 HOLD:0 KP:12.34 KI:0.67 KD:45.21 MAX_POWER:100 VERSION:1.4 BRIDGE:0 AT:0
Maximum Power Limit (MAXPOWER:<value>)
Set a maximum power limit to restrict PID output. Useful for safety or when working with delicate components.
- Range: 0-100% (default: 100%)
- Automatically saved to non-volatile memory
- Enforced in both normal PID mode and auto-tune mode
- Example:
MAXPOWER:75limits heater to 75% maximum power
Manual Power Override (POWER:<value> and RELEASE)
Temporarily override PID control with manual power setting for testing or manual temperature control.
POWER:<value>- Set manual power level (0-100%) and holdRELEASE- Release manual control back to PID- While in manual mode, display shows "HOLD" indicator
- STATUS command shows HOLD:1 when active
- Example use case: Test heater operation without PID
Example:
POWER:50
OK Power set to 50% (manual override)
[Test heater at 50% power...]
RELEASE
OK Power control released to PID
Temperature bridge mode lets the host machine supply the temperature instead of the onboard thermocouple. This is used when two controllers are bridged together, so one unit's measured temperature drives the other.
TBRDG:ON- Enable temperature bridge. The device stops reading the thermocouple (whether connected or not) and uses the temperature reported by the host.TBRDG:OFF- Disable temperature bridge. The device resumes reading the thermocouple and operates normally.BRT:<temp>- Host-reported temperature (0-400°C). The host should send this every second while bridged.
While bridged, the STATUS response includes BRIDGE:1; otherwise it includes BRIDGE:0.
Example:
TBRDG:ON
OK Temperature bridge ON
BRT:75
OK Bridge temperature=75
STATUS
SETPOINT:120 ENABLED:1 TEMP:75.0 POWER:28 BRIDGE:1 ...
TBRDG:OFF
OK Temperature bridge OFF
The controller includes an auto-tune feature that uses relay-feedback method with Ziegler-Nichols tuning:
- Set target temperature:
SET:120 - Start auto-tune:
TUNE - Wait 5-10 minutes while the system oscillates
- Parameters automatically calculated and saved
The auto-tune will:
- Heat to setpoint then cycle on/off
- Measure oscillation amplitude and period
- Calculate optimal PID values
- Save to EEPROM/flash automatically
** Monitor temperature during auto-tune!** Stop if unstable.
Default PID values work well for most systems:
- Smart anti-windup protection for integral term
- Power output clamped to 0-100%
- Time-proportional control for SSR longevity
- Thermocouple open-circuit detection
- Derivative filtering reduces noise-induced instability
- Auto-tune monitors oscillations to prevent runaway To manually adjust:
- Start with defaults:
KP:10.0,KI:0.5,KD:50.0 - If overshoots: Reduce Kp or increase Kd
- If slow response: Increase Kp
- If doesn't reach setpoint: Increase Ki
- If oscillates: Reduce Kp and Ki, increase Kd
Values are automatically saved to persistent storage.
- Update rate: 250ms (4 Hz) for responsive control
- Derivative filtering: Low-pass filter reduces thermocouple noise
- Smart anti-windup: Integral only accumulates when output is 5-95%
- Direct percentage output: 0-100% power to heater
Copyright (c) 2025 Black Horse Repairs LLC
Licensed under the MIT License. See project files for full license text.
Contributions are welcome! Please feel free to submit issues and pull requests.
For support and questions, please open an issue on the repository.