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.