05-12-2011 06:35 AM
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?
Solved! Go to Solution.
05-12-2011 07:01 AM
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!
05-12-2011 07:41 AM
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.
05-12-2011 08:17 AM
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!
05-12-2011 08:23 AM
This should help:
http://forums.ni.com/t5/LabVIEW/Write-to-Arduino/td-p/1176761/page/2
05-14-2011 06:36 AM
CAN ANYBODY GIVE ME THE VI'S FOR THE FOLLOWING :
05-14-2011 06:58 AM
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
05-14-2011 09:14 AM
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
05-16-2011 08:42 AM
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(""); }
05-17-2011 11:33 PM
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....