10-21-2019 01:53 PM
Hi,
I'm attempting a basic control project to irrigate a plant based on soil moisture readings using a moisture sensor, to Arduino to Labview Software and start stop a water pump to irrigate the plant based on moisture readings. That's the plan anyways..
So far will use an Arduino Uno, open to change Arduino if an alternative works better, I need to source an Arduino compatible moisture sensor, water pump, cables, tubing. I will use Labview 2019 witth LIN and Arduino compatible compiler installed. I have a limited eperience of Labview but not so familiar with Arduino hardware or using Labview with Arduino. For now I've been referring to Programming Arduino with Labview by Schwartz and Manickum plus some ccollege notes and managed to get Arduino LED blinking using Labview VI.
I have a few questions: If I find Arduino code to run parts of my project is there a templaate that allows me to create VIs to run the program using Labview instead of the code? Will the hardware configuration be same running in Arduino code as using Labview?
Any other advice would be greatly appreciated.
Thanks
Solved! Go to Solution.
10-21-2019 09:34 PM
Hi GreennRed,
As I understand it there are two main ways to use an Arduino with LabVIEW.
If you choose the first option, then there should be examples together with the toolkit of your choice. These will show probably only fairly simple code, but you can rearrange the LabVIEW code as you need to perform more complicated tasks. If you can get a sensor that provides an analog output to the Arduino, this is definitely possible.
If you choose the latter option, you can use the VISA Serial examples to show communication on the LabVIEW side, and places like the Arduino Tutorials page or references to help. There are also Arduino forums with probably a lot of examples available.
10-22-2019 01:45 PM
Hi cbutcher,
Thanks for your reply.
I have the LINX toolkit, Arduino Compatible Compiler for Labview and Labview Interface for Arduino installed from the VI Package Manager.
There are a lot of good Arduino examples similar to what I would like to do and if I can get that far with Arduino code then moving sensor to Arduino and constructing a VI for inputs should be achievable for me. That will be a very good start.The book I have is also a good starting point.
If it's OK with you can I please leave this thread open in case anyone else replies and also I will surely have more queries in the net few months?
Cheers
10-22-2019 01:59 PM
This guide might help you
https://microcontrollerslab.com/program-arduino-labview-example/
10-22-2019 02:38 PM
Nice one.
Thanks Bilal.
10-22-2019 03:48 PM - edited 10-22-2019 04:08 PM
Well first off there a a couple of ways to use an Arduino with LabVIEW
If you chose method 2 here's a couple pointers...
An Arduino should install a virtual serial port when it is first plugged into your computer
You use that serial port and NI-VISA to communicate with the Arduino just like any other device on a serial port
You have full control over the serial protocol, query and response format since you will be writing the Arduno code
Get your Arduino code to work with the Arduino Serial Monitor, then work on the LabVIEW to talk to it
Send data using the Arduino PrintLn function as it appends a LF to the end of the data. You can use that LF as a Termination Character in your VISA Reads
Separate data by comas (data1,data2,data3) then you can use "Spreadsheet string to array" with the Delimiter set to a comma to parse the data from the string right into a numeric array.
10-23-2019 12:58 PM
Thanks RTLSVU.
Some good info there. I hope to experiment a bit with both methods to see which one suits me best.