Hot Plate Automatic Control System (HPACS)
by nicengineering in Circuits > Arduino
1797 Views, 3 Favorites, 0 Comments
Hot Plate Automatic Control System (HPACS)


This project aims at providing a simple intuitive way of understanding how to do Automatic PID tuning using a heater. What I have made is based on the Åström–Hägglund method for deriving parameters using bang-bang control to reveal system characteristics and subsequenctly chose parameters based on this knowledge. There is nothing secret to it and info can be found here: https://en.wikipedia.org/wiki/PID_controller#Loop... And for chosing parameters you can read a bit here: https://en.wikipedia.org/wiki/PID_controller#Loop...
To make it nice a Nextion 3.2" HMI interface is added for user input and displaying different variables real-time. BUT I also made a Serial terminal version of the library which makes the project way cheaper !
The real background story is that partly I promised my dad to make a temperature control for melting bees wax, partly I wanted to refresh my basic control theory and finally I wanted to look into auto tuning of PID controllers. On the side I also managed to use it for Sous Vide making nice steaks and Bearnaise sauce as part of the testing !
WARNING!
I am working with 230 V here which is dangerous if you do not know what you are doing ! I am an electrician and electronics engineer so I have some experience here - but DO NOT work with 230 V if you are not comfortable with it and take great care not to touch live wires ! Also, beware of the cheap SS-relays with regards to possible fire hazard as this has been seen by some people (not by me though).
Supplies
- A cheap WASCO Hot Plate (could be a better one - e.g. an Ikea induction plate)
- A cheap SS-relay
- A Dallas onewire temperature sensor
- An Arduino Mega
- (Optional) A Nextion 3.2" HMI interface/display
- 5V power supply for the Arduino
Assembly




I only built an enclosure for the HMI version of the project since this is what I ended up using. So, I made an enclosure for fitting relay, HMI and Arduino. I also made a clamp for the temperature sensor just because I could...
Coding

All the code for HMI and Arduino is available at my Git repo for the project.
I commented a lot in the code to try making it easier to read and understand. But essentially I set up a really slow PWM for the hot-plate and a timer interrupt for the state-machine/control and that is really it.
Then there is of course the tuning routine and the control itself + HMI or Serial interface...
I do something that I'm not a big fan of in this code, and that is to use serial print in a timer interrupt. Serial print takes a lot of time and should really be avoided in a timer interrupt...
The tuning works as follows:
- Set PWM duty cycle to 40%
- Wait until setpoint temperature is reached
- Set PWM duty cycle to 0%
- Wait until temperature is below setpoint
- Repeat step 1-4 until e.g. 3 periods with almost same time and amplitude is seen
- Calculate paraemters for PID based on the above
Pretty simple ;)
Testing !







Now that the coding is done its time for testing. In the former section I showed the tuning graphically from a test - so for that there's not much left to say. But a couple of tests using the obtained parameters is shown here.