From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arduino + Labview with Weather Shield

Hello,

 

I've used Labview for some time but am new to Arduino. My objective is pretty straightforward: I have an Arduino Uno and a Weather Shield for it. I have successfully connected the weather shied to the arduino using these instructions: (https://learn.sparkfun.com/tutorials/weather-shield-hookup-guide/weather-shield-overview), I have uploaded the provided firmware sketch and I can read data in the Arduino IDE serial monitor as shown in the directions.

 

What I'm not sure how to do is get this data into Labview so that I can work with it in my VIs. I'm only trying to get temperature, humidity and pressure, at least at first. I've seen some examples of reading temperature and other data into Labview from Arduinos that includes using serial communications, but since I've uploaded the firmware to the Arduino I was hoping (perhaps unreasonably) that I could just call the myHumidity.readHumidity() function and get humidity data back, for example. Is there a way to do that with the Labview Interface for Arduino or do I need to go in a different direction?

 

I thought it was worthwhile to ask before I forged ahead. Any guidance is helpful. Thanks!

0 Kudos
Message 1 of 10
(3,272 Views)

You have to be in communication with the Arduino.  There's no way around that.  The easiest way is to just use the serial port.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 10
(3,265 Views)

Thanks for the direction. Do you have any place you can point me then that will help me figure out how I get temp, humidity and pressure from the Arduino via serial communication? I've looked at some examples (such as for the thermistor read), but those don't seem to help me much in terms of getting data from a shield and into Labview. Are there any examples you know of that might  be closer to what I'm trying to do? Thanks for your help!

0 Kudos
Message 3 of 10
(3,243 Views)
You've said that you can already read the data with the IDE. Reading with LabVIEW should be the same. From the directions, the parsing looks easy.
0 Kudos
Message 4 of 10
(3,225 Views)

Thanks for responding, Dennis. So what functions would I use in Labview to send commands and receive the data from the Arduino? Do I need to use the LIFA tookit or just standard Labview functions? I'm sure I can handle the parsing, I'm just not clear on exactly how I make Labview and the Arduino communicate. Any guidance is appreciated. Thanks!

0 Kudos
Message 5 of 10
(3,213 Views)
Since you have a custom sketch, I'm not sure the LIFA toolkit will do you any good. I would first try using a program such as hyperterminal to see if the data can be read with that. I did not read everything from the directions to see if the data is just being constantly streamed over the serial port. If it is, you just configure the VISA Configure Serial Port to use the termination character mentioned and have a VISA Read inside a loop.
0 Kudos
Message 6 of 10
(3,202 Views)

Thanks, Dennis, that did work for me to read the data at the serial port.

 

I'd like to configure it a bit further so that I can send it a command to the Arduino and then get the data back, but I'm not entirely sure the right way to do that. Can I send a command using a serial write function that uses my own Arduino sketch code sent to the Arduino, which then would respond with the data I want? That would allow me to read the data at a time interval I specify or based on events, etc. rather than just at a set time interval, which is how the Arduino sketch I started with does it (once every second).

 

I'm going to work on that and see if I get good result, but let me know if you think that's a sensible approach. Thanks!

0 Kudos
Message 7 of 10
(3,160 Views)
You can certainly modify the sketch to respond only when a command is received. The modification of the c code is not something I feel all that confident with. You would probably have better luck on an arduino forum.

Sparkfun is just a few minutes from me. I'll have to try and see if they have tours. Their stuff looks pretty cool.
0 Kudos
Message 8 of 10
(3,156 Views)

(Dear) Dennis:

 

 

 

You may get hooked (or maybe even switch jobs). They do have tours (from their website):

 

Tours

If you ever find yourself in Boulder and want a tour - we love visitors! SparkFun scheduled tours run Fridays at 3 PM, and please call ahead 24 hours in advance so we know you’re coming!

 

 

-AK2DM

 

EDIT : P.S. I was joking about the Dear...

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
Message 9 of 10
(3,145 Views)
Thanks! I hadn't noticed that before.
0 Kudos
Message 10 of 10
(3,132 Views)