LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Arduino source code application in labview

Hi,

I had some Arduino source code for measuring greenhouse environmental parameters such as temperature-humidity, CO2, solar radiation, etc. I heard these source code could be added using data communication options in Labview. I am searching for the proper way. I found an example of this topic (link attached) but that is in the Korean language and not properly described. Would anyone give me some suggestions and some examples link about this topic, please?

Thanks in advance. 

http://cybermakerspace.com/portfolio-items/use-arduino-uno_due-using-the-labview/?portfolioCats=158

 

0 Kudos
Message 1 of 10
(211 Views)

Hi Milon,

 

usually you use serial communication between Arduino and the connected PC (running your LabVIEW code).

 

So all you need is to implement some serial.write(ln) commands in the Arduino and some VISARead in LabVIEW…

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 2 of 10
(190 Views)

Gerd is right, think of the Arduino as any other instrument with an RS-232 serial interface.

 

In fact this should be easier because YOU have full control of the data format, query commands and responses coming from the Arduino.

 

Here's some hints:

  1. DON'T USE "BYTES AT PORT" in your LabVIEW code
  2. Use the Arduino "Println" command as it appends a CR (or LF I can't remember) at the end for you.
  3. Enable the Termination Character in your VISA Serial Setup and set it to the same character
  4. Set your VISA read to read far more bytes than you expect to receive
  5. Now the VISA read will read until in receives the Termination Character or times out

Also the example you linked to was an Arduino Yun (I think) because it has an Ethernet interface. If you are using an Arduino Uno your board only has a serial interface. So nothing LabVIEW wise in that example really applies to your board.

 

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
Message 3 of 10
(183 Views)

Respected Gerd and RTSLVU,

Thanks for your reply. Sorry, I couldn't express my query properly. In the formula node, we usually write some equations or code. I want to paste the Arduino source code in the LabVIEW. Is there any option like formula node in LabVIEW for this purpose. I have idea about serial communication of Arduino or LabVIEW-Arduino interface. But I don't want to use those ways.

0 Kudos
Message 4 of 10
(159 Views)

Hi Milon,

 

I want to paste the Arduino source code in the LabVIEW.

Use a string constant and paste the code in there…

What should be the result from that Arduino code? Arduino is NOT the same as LabVIEW so what do you want to achieve with some Arduino code in LabVIEW???

 

Is there any option like formula node in LabVIEW for this purpose.

Use a string constant (or even a comment in the block diagram)…

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 5 of 10
(150 Views)

Respected Mr. Gerd,

Sorry for the misunderstanding. During the coding using Arduino options, we usually follow this sequence: init>set pin mode>read/write pin>close. As I have Arduino source code, I don't want to follow this sequence. I want to know, does LabVIEW have any option like 'formula node.vi', where I can paste/write the source code directly and that "vi" will give me the output result? Is it clear?

 

Sorry for my poor English and poor explanation. 

0 Kudos
Message 6 of 10
(146 Views)

Hi Milon,

 

Is it clear?

No, not yet…

 

does LabVIEW have any option like 'formula node.vi', where I can paste/write the source code directly and that "vi" will give me the output result?

What is the expected result?

Do you expect your LabVIEW VI to read/write any pins on your Arduino? If this is the case, then you need to use LINX instead of some "formula node"…

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 7 of 10
(143 Views)

Respected Mr. Gerd,

I have attached two pictures here. 1st one is formula node and the 2nd one is Arduino code. I have pasted the Arduino source code into the formula node, although I know formula node will not work. I want to know, is there any coding process in LabVIEW where I can paste the Arduino source code and get output value according to the Arduino code?

Formula node.JPGArduino source code.JPG

 

0 Kudos
Message 8 of 10
(131 Views)
Highlighted

Hi Milon,

 

I want to know, is there any coding process in LabVIEW where I can paste the Arduino source code and get output value according to the Arduino code?

The short answer is "No!".

 

The longer story is: LabVIEW cannot directly access any Arduino hardware, you need a (kind of) device driver. And I already mentioned that device driver: it's called LINX!

With LINX you can try to replace your Arduino code by LabVIEW code…

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 9 of 10
(127 Views)

No

 

A "Formula Node" is just  that, a node for entering complex mathematical formulas into LabVIEW.

 

It is NOT an "Any text language Node" that can turn text based source code into LabVIEW or simulate that code running on a device.

 

BTW: Here is a link to LINX

Linx allows you to program Arduinos and other microcontrollers with LabVIEW instead of the native Arduino language

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
Message 10 of 10
(113 Views)