LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read Serial Data from Arduino using labview VISA?

Solved!
Go to solution

Here ya go...

Message 11 of 143
(35,230 Views)

Hi i ave used u r vi and able to set up visa configuration,, and able to read the values (in the cancatenated string portion).Just check the jpeg attached.

I am also attaching arduino sketch .I am not getting the Temperature graph and temperature array values....

Also

        the descrition of the  the vi ie; TempMon2.vi says :

--------------------------------------------------------------------------------------------------------------------------

This program is designed to work with the March 2009 version of the Arduino Temperature program which sends a header, the raw A/D value and the temperature as an integer value.

----------------------------------------------------------------------------------------------------------------------------

 

drog said:

----------------------------------------------------------------------------------

My Arduino continuously sends room temperature readings as part of a text string and I wrote a VI to buffer the text, extract the temp digits, display the value and graph the data.

-----------------------------------------------------------------------------

Just explain what is header ?

how to send temperature reading as part of a text string?

 

I am greatful if u send arduino program?????

(I am struggling to get the result from almost a month)

Thanks

 

 

0 Kudos
Message 12 of 143
(34,544 Views)

Here is my sketch, I should have posted it earlier. - Sorry for the delay.

 

Cheers!

 

/*
 * AnalogInput
 * by DojoDave <http://www.0j0.org>
 * 
 * Modified for Graduate Student Workshop
 * by David Rogerson - Physics Electronics Resource Center, University of Toronto
 *
 * Turns on and off a light emitting diode(LED) connected to digital  
 * pin 10. The amount of time the LED will be on and off depends on
 * the value obtained by analogRead(). In this instance we are using a LM35
 * temperature sensor
 *
 */

int tempPin = 0;   // select the input pin for the analog input
int ledPin = 10;   // select the pin for the LED
float val = 0;     // variable to store the value coming from the sensor
float temp = 0;    // holds the calculated celsius value for display

void setup() {
  pinMode(ledPin, OUTPUT);  // declare the led pin as an OUTPUT
  Serial.begin(9600);
}

void loop() {
  val = analogRead(tempPin);   // read the value from the sensor
  
  digitalWrite(ledPin, HIGH);  // turn the led pin on
  delay(val);                  // stop the program for some time
  digitalWrite(ledPin, LOW);   // turn the led pin off
  delay(val);                  // stop the program for some time
  
  /*
  * Full scale temp (1023) is 40 degrees and bottom scale (0) is 10 degrees
  * Celsius value is then the temp range (30) times the a/d value divided
  * by the full scale a/d value plus 10 degrees (a/d zero value)
  */
  temp = 30 * val / 1023 + 10;  // Convert the reading to Celsius value
  
  Serial.println( "A/D val & Temp in C");  // Print the reading and the Celsius value
  Serial.println( val, 0 );                // Print the a/d val as an integer
  Serial.println( temp, 1 );               // print the celsius value to 1 decimal pt
  Serial.println("");
}

0 Kudos
Message 13 of 143
(34,525 Views)

Hi Smiley Happy

 

I have managed to input a biological muscle signal called EMG into labview through an arduino microcontroller. I have displayed the signal on a waveform chart. Now im interested to do some signal processing on the signal aquired through serial port such as finding the power spectrum.

 

How can I read this aquired data from the serial port into an array?

 

The problem with aquiring data through serial port using this type of VI is that data is streaming point by point. The data can be displayed on a waveform chart but not on a waveform graph.

 

If im not mistaken express VI's such as the Power Spectrum VI can only support calculating spectrum form a signal array.

 

 

Here is the code on the arduino side:

int potPin = 0;    // select the input pin
int val = 0;       // variable to store the value coming from the function generator

void setup()
{
  Serial.begin(9600);   // opens serial port, sets data rate to 9600 bps
}

void loop() {
  val = analogRead(potPin); // read the value from the function generator
  Serial.println(val);
  delay(0.5); //Sampling rate for the signal
}

 

I have also attached the VI. (serial_arduino3)

Download All
0 Kudos
Message 14 of 143
(34,503 Views)

This probably should've been handled in a new thread.

 

Quote: The problem with aquiring data through serial port using this type of VI is that data is streaming point by point.

 

If you want the Arduino to accumulate and/or process the data then I would defer this conversation to an Arduino Forum. Otherwise why not just accumulate the data using a loop and a shift register as in my program (earlier in the thread)? If you are accumulating a finite number of samples then these can be graphed and spectralized when the loop ends. If you are doing continuous acquisition then the data could gathered in discrete time intervals and analyzed and displayed.

0 Kudos
Message 15 of 143
(34,487 Views)

Hi Jazlan,

 

Thank you for using NI products in your project.

Regarding your issue, I agree with drog's advice. You can use a For loop with a specified iteration count. This iteration count would then serve as the size of the signal block that you would be analyzing through the Power Spectrum VI. Like what drog suggested, you can easily implement this by using a shift register and an Insert Into Array VI. After meeting the iteration count, thus now having the specified size of the signal block at hand, the right shift register will output the array. This array can then be passed on to the Power Spectrum VI for analysis. The only drawback that I am seeing in this setup is that you would have a slight delay depending on the array size that you will set through the For loop's iteration terminal. However, the smaller the size that you will specify then the lesser the delay will be between the actual data acquisition and the result of the analysis. But if delay is not important in your application then I see no other problem with this implementation. 

Best Regards,
Gerrald Mateo
Applications Engineer
National Instruments
Message 16 of 143
(34,474 Views)

please chnge the vi compatabile to labview 8.5 version

0 Kudos
Message 17 of 143
(33,938 Views)

Hi All, 

 

My project uses the Read GPS Time, Postion and Velocity example for LabView and I am trying to get it to initialize through an arduino mega 2560 using the LIFA toolkit. However, the example uses VISA and Im having an issue with the cluster size and getting that to communicate with the LIFA functions. I have attached my .llb with the .vi titled the same as the example, for reference but is it even possible to use the Arduino LIFA toolkit for this? I know they have an auto detect function where its input and output are VISA.  Please help!!

 

Regards, 

 

Brittany

0 Kudos
Message 18 of 143
(33,283 Views)

hi

i have constructed a pH meter using a pH stamp and arduino. i want to send the pH readings to Labview for graphical representation. i have installed all the required aruino Labview interface toolkit. I just dont know how to start from there on. Do you guys have any VI close to what i need?

another question is, once i have open LVIFA_Base ....what do i do then?

0 Kudos
Message 19 of 143
(30,633 Views)

Hello!

I'm trying to make the serial comunication between Arduino and Labview working but i have some problems. After certain amount of time bytes to read become too large..When excedes the 4096(max. buffer) i get an error...VISA:  (Hex 0xBFFF006C) An overrun error occurred during transfer. A character was not read from the hardware before the next character arrived.

I've tried many things but i get the same error over and over again...I would be thankful if someone can just briefly look at the VI and tell in which way could be the problem...Thank you very much!

0 Kudos
Message 20 of 143
(30,023 Views)