Pages

5.11.13

Stripboard PID Arduino Shield, Part 3: Serial Interface

The graphical user interface allows every feature of the Arduino PID controller shield to be governed remotely via the serial interface. A powerful additional feature is the ability to set multi-stage temperature profiles for applications where the set point changes over time.



A DIY PID Controller: Serial Interface



The PID controller is remotely operable using the Arduino serial input. The display is based on the original osPID software, completely revamped and extended with lots of new options.

Download the software from the Github repository. The graphical user interface (GUI) is written in Processing, an easy Java variant that is great for graphical applications. The Processing IDE (downloadable from this link) will look very familiar to Arduino users. Just load up the main sketch osPID-FrontEnd.pde and press the start button (triangle in the top left corner.)

Start out by selecting the serial port connected to the Arduino, then press Connect to establish a link at 9600 baud. Once the connection is up and running, a scrolling display will graph the set value, input temperature, and output. You can get around by selecting from these tabs, which are organized in a similar way to the LCD menu on the PID controller itself:

  • Run. The front tab is the main dashboard. Input fields allow manual setting of the set value and output, and a button toggles between manual and automatic temperature control. All the alarm settings can be programmed, and in the bottom left corner a status bar reports on recent events.
  • Tune. This tab is where to set the PID tunings and turn the auto tune on or off. You can also select the autotune method and parameter settings.
  • Config. The config tab is where to select the input sensor and set its calibration value (temperature offset), or set the output cycle length.
  • Preferences. If you want to resize the GUI, or change any of its other presets, navigate to this tab. Settings are printed in a file prefs.txt saved in the same folder as the osPID-Front-End sketch.
  • Profile. This is the place to view, upload, and run temperature profiles. Read on for more details.


Temperature Profiles


Standard PID control is useful when you just want to hit a set temperature and stay there. Well, the stripboard PID shieldcan do a whole lot more than that. Sometimes you will want to step or ramp between different set points, or program multiple transitions in a temperature profile. An example might be DIY reflow soldering in a converted toaster oven. Or just maybe, step mashing a specialty grain bill on brew day.


Creating a Profile


Each profile is defined in a text file. The first line of the file provides the name of the profile. Each line that follows defines one step in the profile, and consists of three numbers separated by commas and/or whitespace. Up to 16 steps are allowed. The file might look a little bit like this:

Test_profile// Name of the profile, can be up to 15 characters
0,100,30// Ramp to set value of 100° over 30 seconds
1,0,10// Soak at set point for 10 seconds
2,125,60// Jump to set point 125° and hold for 60 seconds
3,0,0// Wait to cross previous set point
64,0,1// Sound buzzer for 1 second

Each kind of step has its own code, defined by the first number on the line (0, Ramp to set value. 1, Soak at set value. 2, Jump to set value. 3, Wait to cross. 64, Sound buzzer.)

The second number is a temperature setting. For Ramp to set value and Jump to set value this is the target temperature.  Ramp to set value increments the set point gradually over the duration of the step, whereas Jump to set value changes the set point immediately and holds it there.

The third number is the duration of the step in seconds. For Wait to cross this both values are ignored. The step lasts until the process value (input temperature) crosses the previous set point. Wait to cross is useful after ramping the set point to ensure that the process value catches up to the desired temperature before moving on the next step. 

Save your profile definitions in the profiles directory. There you will find a couple of presets included for solder reflow: "Leaded" and "RoHS". These might be useful when using a repurposed toaster oven with a thermocouple or high temperature thermistor. Rocket Scream, maker of the osPID and Reflow Oven Controller Shield which can both also be used for this purpose, have published a handy guide to toaster ovens to help you along this road. Myself, I fancy using a DS18B20+ temperature probe in a stainless steel thermowell and using the profile for step mashing when brewing with unmalted or partially modified grains.

You can view a graphic representing the rise and fall of the set temperature with each step on the Profile



Running A Profile


Having defined a profile in a text file, open the GUI and browse to the Profile tab. Select the profile from the drop down menu on the Profile tab under Available Profiles. Next you need to upload it to the Arduino. The Arduino EEPROM has space for three profiles. To upload a new profile, you will need to overwrite one of the ones already in memory. Then select the profile to replace using the radio buttons, and press Replace Profile. Once the new profile has been uploaded its name should appear next to the selected radio button. Then you can run the profile by pressing Run Profile.

Profiles that have been uploaded to the Arduino can also be run without the GUI. From the main menu on the LCD,  press OK next to the named profile. To select a different profile, hold down OK and when you release you can scroll up or down to select one of the three saved profiles to run. When running a profile, the prompt will flash P followed by a letter indicating the profile step that is currently active.


Commands and Options


All the most useful commands are incorporated in the GUI, but you can also supply commands and queries to the controller and view the responses on a serial terminal. A full list of commands is documented here.

You can log the output to a text file by providing setting outputFileName near the top of the file osPID-FrontEnd.pde.  There are some other configurable options there, too.


Resources


4 comments:

Unknown said...

Do you have any plans to offer an all-in-one PCB for those who do not need the USB osPID interface? (MCU, Maxim interface IC, etc. {maybe one version as a shield for those who do})

Unknown said...

Maybe someone else has and would be willing to let you post the board files and/or let you sell the PCB's?

Tom said...

There's a couple of standalone reflow oven controllers out there already that fit that description. I don't have any plans to adapt the project in this way but I would encourage anybody who wants to have a go to use whatever they can from my Github repo.

angelo said...

Hi Tom and thanks for sharing this rpoject. With current versions of Processing and the front end software, values read from prefs files are not displayed in the text field in the prefs tab. Any workaround for this? Thank you

Post a Comment