DualPID
Multi-purpose View the repo
DualPID is firmware for M5Stack devices that provides two independent, configurable PID control channels, each capable of reading a sensor and driving an output (on/off or H‑Bridge) for applications such as temperature, humidity, or reflow oven control.
auto-summary
56 stars · 3 forks
- Maintainer
- knifter
- Chip families
- esp32
Runs on these boards
Unverified
- Core2Unverified
Flash Core2
Unverified esp-atlas asserts this board↔firmware link at the shown trust tier — it does not guarantee your specific unit or the current firmware version. Flashing can erase keys/config and can brick the device. At your own risk.
README
DualPID
Dual channel PID regulator. Each channel is (compile time) configurable to read out a sensor and control an output (on/off or H-Bridge). It could for example be used for:
- Temperature and/or Humidity control (Incubator or Grow box)
- Reflow Oven (either use one channel or two 'zones')
Currently used for controlling both temperature and humidity but should be versatile enough to control any two things from different sensors. The general design goals are:
- [x] Least work hardware: Use existing, easily buyable parts like M5Stack.
- [x] Two channel PID with
- [x] Lock detection
- [x] Linear forward term with offset and slope
- [x] Derivative-on-measurement
- [x] Intergral windup prevention
- [x] On-Device editable PID settings
- [x] Input filter
- [x] D-term filter
- [ ] Planned: Take-back-half
- [x] Fixed output setting to measure step response
- [x] Lock-detection
- [ ] Alarms
- [x] Expert-Mode: Hide Setup and PID settings on normal usage (press A+B+C for 2 seconds to open configuration)
- [ ] Two H-Bridge outputs able to control most things from heaters, peltiers, valves etc (temporarily removed)
- [x] Two single pin positive drive outputs capable of:
- [x] SlowPWM (<1Hz) and FastPWM (>1 Hz up to kHz) outputs
- [x] Easy to add sensors as inputs or other output methods (implemented in classes and run-time configurable)
- [x] Multiple sensors: Temperature, Humidity, CO2, more to come
- [x] Adjustable time intervals per channel (100ms - minutes)
- [x] run-time configurable: Input sensor and output drive configurable through GUI, no recomile for your combination
- [x] Error graphs
- [ ] Remote logging (csv, mqtt or other)
- [x] SerialPlot filterable data
- [ ] Yaapt is planned
- [ ] MQtt
Hardware
Start with M5Stack Cushion, mandatory lab equipment
Base
- M5Stack Core
- [ ] I2C HUB 1-to-6 Expansion Unit (External for TwoWireDevice)
Backplane (optional)
- M5Stack AC Power Base or
- M5Stack Din rail + LDO backplane (26mm) or
- M5Stack Din rail + LDO backplane (15mm)
- Power Supply
Sensor
- [x] SHT31-D breakout board
- [x] M5 Kmeter Isolation Unit with Thermocouple Temperature Sensor (MAX31855)
- [x] SprintIR CO2 sensors
- [x] MCP9600 Thermocouple Amplifier
- [x] MAX31856 Precision Thermocouple to Digital Converter
- [ ] (planned) M5 NCIR Non-Contact Infrared Thermometer Sensor Unit (MLX90614) (v1)
- [ ] DS18B20 1-Wire thermometer variants
- [ ] M5 Temperature Humidity Air Pressure Sensor (SHT40+BMP280)
- [ ] M5 ENV III Unit with Temperature Humidity Air Pressure Sensor (SHT30+QMP6988)
- [ ] M5 CO2 Unit with Temperature and humidity Sensor (SCD40)
- [ ] M5 CO2L Unit with Temperature and Humidity Sensor (SCD41)
- [ ] M5 Voltmeter Unit (ADS1115)
Output Drivers
- [x] TIP132 solution (see /Pictures), Simple On/Off regulator
- [x] Mini 3A Relay Unit
- [x] M5 2-Channel SPST Relay Unit
- [x] M5 4-Relay Unit
- [x] M5 DAC 2 I2C Unit (GP8413), 0..5V/10V
- [x] M5 Single-phase DC/AC SSR Unit
- [x] Single-phase AC&DC SSR Units (i2c)
- [x] M5 Solid State Relay Unit
- [x] M5 H-bridge Unit v1.1
Ideas which could be added/supported/implemented:
- [x] RTC Module
- [ ] (Planned) WT32 SC01 3.2" TFT Touch Screen module
- [ ] Core2 with touch interface
- [ ] 4Ch Lego Motor module
- [ ] 3Ch Stepmotor module
- [ ] Base+4x Lego Motor Module
- [ ] Fan for motor module
- [ ] M5 Tube/Air Pressure Unit
Dependencies
- PID Library: lib-FPID
- TwoWireDevice: I2C Device library wrapper: lib-TwoWireDevice
- Various TwoWireSensor Libraries
- Soogh: GUI Layer: lib-soogh
- Tools library lib-tools
Credits
The user interface is build with the Light Weight Versatile Graphics library: LVGL The screen library is written by lovyan03, LovyanGFX
Read the full README on GitHub
source github.com/knifter/DualPID