In my previous post I wrote that I wanted to use LabVIEW in combination with an additional Arduino library and the Arduino device to work as a controller. LabVIEW has library for both fuzzy and PID controllers.
I have been testing the LabVIEW PID library in combination with the Arduino library while waiting for my thermistors to arrive. My first test was to use a potmeter as an input for a PID controller setpoint and use a simulated plant to test the PID functionality. I tested the PID relay autotuner, which is a tuner that uses on/off signals to test the plant response. I have previously used relay autotuners successfully to set PID controllers with microcontrollers. The autotuner function in the LabVIEW PID library seems to be more sensitive to having a working PID controller before trying to excite the plant with on/off signals. My experience with the library is that this results in a poorly tuned controller. My plan is to use the step response for the plant to set the controller or make a relay based controller from scratch from my previous knowledge of the problem.
A few days back I finally got my 10k thermistors from eBay. The 10kohm value seems to be rather flexible with the LabVIEW Arduino library, and I cannot really understand why. I thought that the equation used, the Steinhart-Hart thermistor equation, needs three parameters A, B and C set that is allready fixed in the Arduino thermistor read function.
I hooked up the thermistor as shown in the library included thermistor example and one servo as shown in the servo example. Pretty simple:
Next I mixed the two examples together so that the temperature from the thermistor would set the output for the servo. I multiply the temperature with 1.8 so that when I have 100 degrees C input I get a 180 degrees rotation of the servo. I also tested with different delays in the loop to remove some of the "spastic" behaviour you can get when the realtime signal is used.
I experienced a bit with moving the thermistor over a candle to check the system. Below is a video of the system in action:
Here is the output in LabVIEW with and without delay:
I am quite happy with setting this system up so quickly and with both input and output working as planned on the first run.
One thing I experience is that when I stop the LabVIEW program and restart it i get erratic behaviour of the servo. Perhaps because of the PWM output from the Arduino being out of sync with the servo. I need to pull out the USB plug from the computer a couple of times in order to make it work again. This all might have to do with me having an old Arduino or that I got black smoke coming out of it the last time I used it.
Coming up I will be soldering a wire to the thermistor, put it in boiling water and see if I get a reading of 100 degrees celcius. Otherwise I need to get better parameters for the thermistor function.