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

Solved!
Go to solution

Hi i am becoming a fan for LabView.. only from few days ,,,,and started doing a project using Arduino.

I would like to take data from temperature sensor(LM35) and show grafically on labview.(Ofcourse serial communication is used).I have gone through examples given in LabView8.5 but i am not able to grasp the thing,, I am able to select resource name(com22) and all but if i click read nothing is displayed.Before running the simulation i am uploading the sketch for transmiting temperature continuousely to analog pin 0 ie. for serial transmission,, can any body help?  

 

0 Kudos
Message 1 of 29
(10,140 Views)

To learn more about LabVIEW, I suggest you try looking at some of these tutorials.

 

Have you been able to communicate with the processor using Terminal EMulator applications, such as HyperTerm or TerraTerm, etc?

That should be your starting point.

 

However, you should also be able to communicate with it using the code snippet that I suggested here:

http://forums.ni.com/t5/LabVIEW/Reading-time-interval-of-serial-port/m-p/1529140

 

You will need to configure the modem appropriately.

 

Have fun!

Message 2 of 29
(10,125 Views)

you will first have to write your temperature data to the serial with the Arduino that is:

 

// you will need to setup pins still

 

void loop()

{

tempData = Serial.read();

 

while (Serial.available() > 0)

     {

          Serial.println(tempData);

          delay(100);

     }

 

}

 

in LabVIEW you read the serial port your Arduino is connected to.

 

and your temperature should show up.

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 3 of 29
(10,118 Views)
Solution
Accepted by topic author Chintha

I have done the exact same thing as a teaching project here at the UofT. I designed a shield that uses an LM35. I added some signal conditioning circuitry and used analog 0. I wrote a sketch to convert the reading to ASCII text and continually send it out the USB port.

 

I have previously posted my LabVIEW code to acquire and display the Arduino data. Have a look at this thread:

http://forums.ni.com/t5/LabVIEW/How-to-read-Serial-Data-from-Arduino-using-labview-VISA/td-p/1497866

 

Cheers!

0 Kudos
Message 4 of 29
(10,111 Views)

This should help:

 

http://forums.ni.com/t5/LabVIEW/Write-to-Arduino/td-p/1176761/page/2

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 5 of 29
(10,114 Views)

CAN ANYBODY GIVE ME  THE VI'S FOR THE FOLLOWING :

http://web.me.com/iklln6/automation/LabVIEW.html

0 Kudos
Message 6 of 29
(10,076 Views)

Hi as i am running u r vi i am getting the folowing error:

Error -1073807360 occurred at Property Node (arg 4) in VISA Configure Serial Port (Instr).vi->SerialArduinoTempSensor.vi

 

I am attatching the vi i have used,i am currently using LabView2010

I am giving the arduino code for reading temperature sensor data serially:

/*
An open-source LM35DZ Temperature Sensor for Arduino. This project will be enhanced on a regular basis
(cc) by Daniel Spillere Andrade , http://www.danielandrade.net
http://creativecommons.org/license/cc-gpl
*/ 

int pin = 0; // analog pin
int tempc = 0,tempData,tempf=0; // temperature variables
int samples[8]; // variables to make a better precision
int maxi = -100,mini = 100; // to start max/min temperature
int i;

void setup()
{
  //Serial.begin(9600); // start serial communication
  Serial.begin(9600); // start serial communication
}

void loop()
{
  
  
for(i = 0;i<=7;i++){ // gets 8 samples of temperature
  
  samples[i] = ( 5.0 * analogRead(pin) * 100.0) / 1024.0;
  tempc = tempc + samples[i];
  delay(1000);

}

tempc = tempc/8.0; // better precision


 
//tempf = (tempc * 9)/ 5 + 32; // converts to fahrenheit

//if(tempc > maxi) {maxi = tempc;} // set max temperature
//if(tempc < mini) {mini = tempc;} // set min temperature

Serial.print(tempc,DEC);
Serial.print(" Celsius ");

//Serial.print(tempf,DEC);
//Serial.print(" fahrenheit -> ");

//Serial.print(maxi,DEC);
//Serial.print(" Max, ");
//Serial.print(mini,DEC);
//Serial.println(" Min");

tempc = 0;

delay(1000); // delay before loop
}

 Please correct me as early as possible

 

 

 

0 Kudos
Message 7 of 29
(10,075 Views)

here is the knowledge bas for that error:

 

http://digital.ni.com/public.nsf/websearch/d2084ec381319cc386256a1d006f1415?OpenDocument

 

and here is a forum post for that error that may help:

 

http://forums.ni.com/t5/LabVIEW/Serial-communication-error-1073807360-What-caused-it/m-p/785591

 

hope this helped

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 8 of 29
(10,064 Views)

Are you using the right VISA resource name? The USB port maps to a com port (I am assuming a windows environment) and I have got messed up by selecting the wrong com port.

 

Also, looking at your Arduino code you will have to adjust the text pattern strings on the block diagram to work with the text that your Arduino is sending. Here is my code for your reference:

 

 

 

/*
 * 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 9 of 29
(10,032 Views)

Error -1073807360 occurred at Property Node (arg 4) in VISA Configure Serial Port (Instr).vi->SerialArduinoTempSensor.vi The same eror is repeating....eventhough i am giving the correct visa resouce name....

 

0 Kudos
Message 10 of 29
(10,005 Views)