I combined PID Front End and AutoTune.

2,146 views
Skip to first unread message

Konstantine Palanski

unread,
Feb 28, 2013, 10:28:47 PM2/28/13
to diy-pid...@googlegroups.com
Hello fellow PID'ers!

First of all, many thanks to Brett and his efforts to bring us this wonderful library and its many parts.

The PID front end is very useful to visualize what's going on in the PID itself, while the AutoTune library allows for an excellent way to get starting values for the PID parameters. However, the separate parts are fairly fragmented, and there's no easy way (I found) to understand and use these parts.

Here, I'd like to present you with a combined AutoTune and PID Front End Library. 

The attached file has two pieces of code: one to be uploaded to the Arduino, the other to be run in Processing with the ControlP5 library

This code will not work without editing!

I have tried to comment as much of both files to help with all the appropriate edits that are required for you to have a successful autotuning. Look for //KP I would like to point out how I used it:
  • I was tuning a SousVide setup with a relay output.
  • I was using a Dallas OneWire temperature probe.
  • I was using a Macintosh.
  • The Simulation portion of the library is not taken into consideration.
  • I ask you search the code for //KP for areas that need your attention or editing.
After all editing: Upload this code to Arduino with the appropriate pin settings, sensor settings, and Setpoint value. Run the PID_FrontEnd_v03 (set appropriate COM). Allow the system to come to equilibrium after setting an initial setpoint. When system is at equilibrium, toggle Tuning to 'On' and click 'Send to Arduino'.  When the tuning is finished, the Tuning toggle will go to 'Off', and the new PID values will be on the screen.

Again, SEARCH ALL CODE FOR //KP to see where edits MUST be made by YOU for this to be effective in the tuning.

After trying unsuccessfully to tune my cooker manually, this finally gave me appropriate values for PI.

Thanks again and I hope this will be useful for someone.
PID Autotune and Front End.zip

Kenneth McCall

unread,
Apr 21, 2014, 2:21:20 PM4/21/14
to diy-pid...@googlegroups.com
There's a problem where Kd isn't been set from the front end. It reporting 0 after "send to arduino" has been clicked.

Gearhead

unread,
May 3, 2014, 6:58:56 PM5/3/14
to diy-pid...@googlegroups.com
Kenneth,

Thanks for this. I, too have the same problem. I can set Kd in the arduino sketch and it passes through. If I change it, what returns is 0. If you run the tuning sketch and start tuning from the serial port, it seems to be fine. If you try to change it through the processing front end, it always puts 0 as Kd. 

I have a hunch it is not with Processing or with the serial interface to processing, but with the atune example, somehow. I have recreated the processing sketch and and the serial send/receive routines for the arduino sketch from scratch and get the same result.

Still looking at it. 

Gearhead 

don pattison

unread,
Jun 17, 2014, 8:35:39 AM6/17/14
to diy-pid...@googlegroups.com
Hi Konstantine,

I would just like to thank you for sharing this combination, now that I see it working I'm beginning to understand the concept.

I'm a little confused about your telling us to set the appropriate COM, in Processing 2.2.1 when I set [6] which is the Arduino's COM I get an array error.
However when left at [0] it connects perfectly. Not sure what I'm missing?

It is still busy tuning, will let you know about the Kd that others commented on when it's done>

Regards Don


Agostino Iacobazzi

unread,
Sep 19, 2014, 5:30:59 AM9/19/14
to diy-pid...@googlegroups.com
Hi all. I had the problem with kd, too, so I rewrote the code (Arduino and Processing) eliminating the Direct/Reverse field (I'm buinding a Sous vide PID so I do not need to change it) and substituing it with AutoTuning data.
Apparently it works!!
Let me know if you agree, I hope this will be useful for someone.
Thanks so much for the big effort needed to get here
PID Autotune and Front End SV Mago.zip
Message has been deleted

tksn...@uci.edu

unread,
Feb 16, 2017, 9:04:14 PM2/16/17
to DIY PID Control
Hi all,

Thank you so much for the edits and the great combined Autotune Code.I have it running but I have a question about what values to use for aTuneStep, aTuneNoise and aTuneStartValue. I set aTuneStep=500, aTuneNoise=10, aTuneStartValue=750 which I think will give me a square wave that has a small frequency because of the Noise parameter, though my output graph in processing is a high frequency square wave. I am trying to find the tuning parameters for a small 5in by 2in by 1in piece of aluminum. What values do you recommend I use for the process to go a bit smoother. 

Thanks so much,

Tarik

Alexandre Bensi

unread,
Oct 9, 2019, 5:38:07 PM10/9/19
to DIY PID Control
Hello!

 I try to run the Front End, but I have problems. My processing is 3.5.3, I changed ValueLabel().getText() to getValueLabel().getText() to solve issues, but it still broken.
 Did You have the Front End updated with last processing or this project is die?

Thanks a lot! Best regards,
Alexandre

Benjamin Cote

unread,
Dec 15, 2022, 1:37:48 PM12/15/22
to DIY PID Control
Hey Guys, 

I am working on a smart Argentinian grill project and would like to hire someone that can help us create a PID type predictive algorithm that can determine how long is left on a particular cook to reach the desired temperature. 

This is a Comercial product to be sold initially to Comercial kitchens. Is anyone interested in heating more? 

Ben
Reply all
Reply to author
Forward
0 new messages