Hot Plate Automatic Control System (HPACS)
by nicengineering in Circuits > Arduino
1565 Views, 3 Favorites, 0 Comments
Hot Plate Automatic Control System (HPACS)
![20200608_052754092_iOS.jpg](/proxy/?url=https://content.instructables.com/F8T/WG6Q/KCG8EXME/F8TWG6QKCG8EXME.jpg&filename=20200608_052754092_iOS.jpg)
![20200608_052800051_iOS.jpg](/proxy/?url=https://content.instructables.com/FNR/DD56/KCG8EXN6/FNRDD56KCG8EXN6.jpg&filename=20200608_052800051_iOS.jpg)
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
![20200602_063614526_iOS.jpg](/proxy/?url=https://content.instructables.com/F4Q/LKV1/KCG8EY43/F4QLKV1KCG8EY43.jpg&filename=20200602_063614526_iOS.jpg)
![20200607_114945879_iOS.jpg](/proxy/?url=https://content.instructables.com/F2L/X3P6/KCG8EY44/F2LX3P6KCG8EY44.jpg&filename=20200607_114945879_iOS.jpg)
![20200607_114951748_iOS.jpg](/proxy/?url=https://content.instructables.com/F02/P5I7/KCG8EY4U/F02P5I7KCG8EY4U.jpg&filename=20200607_114951748_iOS.jpg)
![20200608_052259463_iOS.jpg](/proxy/?url=https://content.instructables.com/FRA/24AZ/KCG8EY4V/FRA24AZKCG8EY4V.jpg&filename=20200608_052259463_iOS.jpg)
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
![Autotune.png](/proxy/?url=https://content.instructables.com/FC2/WLCT/KCG8EXLN/FC2WLCTKCG8EXLN.png&filename=Autotune.png)
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 !
![Pessen_55_sous_vide.png](/proxy/?url=https://content.instructables.com/FCQ/UOP9/KCG8EXJE/FCQUOP9KCG8EXJE.png&filename=Pessen_55_sous_vide.png)
![PID_57_5.png](/proxy/?url=https://content.instructables.com/FAK/8KGS/KCG8EYNS/FAK8KGSKCG8EYNS.png&filename=PID_57_5.png)
![NOOS_55.png](/proxy/?url=https://content.instructables.com/FI8/XYTE/KCG8EYOM/FI8XYTEKCG8EYOM.png&filename=NOOS_55.png)
![Pessen_55.png](/proxy/?url=https://content.instructables.com/FYV/J37U/KCG8EYQ3/FYVJ37UKCG8EYQ3.png&filename=Pessen_55.png)
![PI_55.png](/proxy/?url=https://content.instructables.com/F5W/D89I/KCG8EYQU/F5WD89IKCG8EYQU.png&filename=PI_55.png)
![PID_55.png](/proxy/?url=https://content.instructables.com/FHQ/YZGH/KCG8EYRL/FHQYZGHKCG8EYRL.png&filename=PID_55.png)
![Hot Plate Automatic Control System - HPACS](/proxy/?url=https://content.instructables.com/FR8/5PHB/KCG8F06V/FR85PHBKCG8F06V.jpg&filename=Hot Plate Automatic Control System - HPACS)
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.