Hello I need help, I have a pid control to control the temperature but when it reaches the temperature after 1 minutes it resets to zero help please.
I am using a controllino and a DHT21 sensor
the output is permanently reset
it only changes if i restart the program at that moment it starts calculating again
I have solved it in the end it was a current problem, I was feeding a relay module with the 5v output of controllino Thanks to all
Start with Kp = 0
kp * error = Pterm
in other words, when error equals 0 output equals 0 so Proportional is not the best way to control the temperature as when you reach the temperature you add nothing to the environmental space you are controlling.
Start with "ti = 1.72". "ti" is additive When you have an error it adds a portion of the error to the output. Too much "ti" the temperature in the space will oscillate. too little it will take forever to reach setpoint. adjust this till your temperature overshoots just a little but has the ability to land on setpoint after a few oscillations. integral can wind up and could be a portion of your problem. I'm not sure if PID_v1.h has resolved this but you can try my version if you like it is 100% compatible with PID_v1.h Arduino_PID_Library_v3
if you choose to use this additional features are available and can simplify your code.
Set "td = 0" as we will only need it to help land the on the setpoint after the other two are calibrated
now add some kp until setpoint lands quickly td take change in error and can slow or speed up the change to help lock down setpoint quickly
The default myPID.SetSampleTime() is 100 ms for each iteration of myPID.Compute(), but you have a delay(500); at the end of loop(). Why is this delay there?
Of course, delete it, but there's 7 more blocking delays that affect the loop() rate:
line 125: delay(1500);
line 175: delay(2000);
line 193: delay(100);
line 208: delay(100);
line 212: delay(100);
line 239: delay(200);
line 248: delay(500);
Refactor your program to use a finite state machine and the millis() function for timing purposes. You can find plenty of tutorials on that with the forum search of Google.
(Note: I am not sure if that is the cause of your problem, I haven't looked at your code in depth.)
Which controllino model?
What are you controlling?
Could you post a schematic?
With the delays, It's surprising you have any usable control left. I guess your system must have a slow time constant, in which case some PID control is possible.
The delays may not be causing the 10 minute reset problem, but the delays are no help for smooth and precise PID control. There's many other possibilities like electrical, code, switching, EMI, watchdog timer?, lack of MOV's/Snubbers/Flyyback diodes, etc. There's also some warning on the controllino Mini sheet about the INT terminal, so answers to above would be helpful.
I am using the controllino mini,
Through the pid control I control a niquelina through a circuit that will take care of the AC control.
And the response is slow, there is a temperature change approximately each 10 seconds.
I have also noticed that the output goes to zero when there is no temperature change.
Even so, do not reach the set point if it takes too long at an unchanged temperature.
the output is reset stays there until the program is restarted
In setup, the PID is set to AUTOMATIC, which automatically initializes the PID, but in the lectura() function, it's conditionally set to AUTOMATIC once more ... possibly after 10 minutes?