Tuesday, November 01, 2011

Hot plate PI controller - Part 3: Arduino and LabVIEW


It's been about three years since I last used the Arduino in any project. The reason for this is that I usually find it equally easy to implement simple things in the AVR microcontroller, rather than spending more money on the arduino. The second reason is that I have usually been working on projects requiring faster throughput time for realtime control of fast acting systems (sound/vibration).

When I now came back to look at the arduino I see that a lot has changed since the last time I used it. The obvious thing being that more modern arduinos and shields for all different kinds of purposes have come to life. The community for Arduino has grown exponentially fast and Arduino is now probably the number one gadget for electronic hobbyists. Software for Arduino has become even more easy to use and make it possible to test arduino code without a physical arduino attached with VirtualBreadboard. National Instruments has recently made it possible to include Arduino in LabVIEW with an additional library, which I will come back to later in the post.

The book "making things talk" learned me a lesson in how to work with microcontroller projects, or any other problem. Rather than trying to attack the complete problem in one chunk I now try to break down the problem in small problems that can be tested one at a time. Some things that you take for granted are usually missed if you try to include the complete set of functionality at once, and even the best debugger/emulator cannot test for every kind of outcome. This is why it is critical to test each problem one at a time.

To test the reading of a sensor, in this project a thermistor, you need a system able to show the input from the sensor to the user. With early versions of the arduino this was best done by using the programming language processing and displaying the input to the computer screen. The only difficulty with this solution was that a fraction of the code you wrote was reusable and you thus needed to write routines each time you had a new kind of problem.

Now LabVIEW, the measurement system that I as a programmer loved to hate, has come up with a complete range of pre built modules to comunicate with the arduino. So you can put all the logics in labVIEW and the input/output can be handled by arduino. This makes everything even more simple. The only problem I see with this solution is that you need a computer with LabVIEW or the labview built application to run the algorithms. I will start working with the labview modules, and later see if I want to move the whole controller and logics to the arduino.

Setting up Arduino with LabVIEW was done in a breeze. The examples and ready made functions for sensors are absolutely amazing.

Full instructions for installing Arduino with LabVIEW can be found here.
National Instruments web page for LabVIEW with Arduino

Here is even a geeky video of what the combo can be used for: