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: 

Data loss during wireless serial data transmission from arduino to Labview

Hello to all. Smiley Happy

 

I constructed a voltage divider circuit to supply varying voltage to an arduino input pin. I used a labview program based on VISA to read serial data from the arduino, graph the serial data and write the aquired data to an lvm file (serial_arduino3). Initially when I use the arduino USB cable to read serial data, the results are alright (good_reading.jpg).

 

However when try to send the serial data wirelessly using a pair of APC220 tranceivers the data jumps from 0 to some value and back to 0 again (jumping.jpg). What could be the cause of this problem and how can I overcome it?

 

Thanks

 

The code I have used on the arduino side is as follows:

 


int potPin = 0;    // select the input pin for the potentiometer
int val = 0;       // variable to store the value coming from the sensor

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

void loop() {
  val = analogRead(potPin); // read the value from the voltage divider
  Serial.println(val);
  delay(1);
}

 

* The last delay determines the sampling rate. When I put a higher value for delay such as 500 I dont have this problem.

 

*The wireless data transmission properties are:

 

RF frequency: 434MHz

 

Baud rate: 9600

 

ADC of arduino: 10 bit

 

 

 

 

Download All
0 Kudos
Message 1 of 6
(4,046 Views)

Whether you are using wired or radio link should not affect the data.

 

What do you measure at the potPin with an oscilloscope or even a voltmeter while running both ways?  Your graphs show very different voltage magnitudes under the two conditions.

 

Is it possible that rf from the radio link is getting into the measurement circuit and changing the values?  Rectification of rf signals by low level circuits has been a problem since shortly after Marconi began transmitting data via radio waves.

 

Lynn

0 Kudos
Message 2 of 6
(4,035 Views)

thanks sir for ur reply.

 

I set the voltage divider output voltage to be different in both cases. I should have maintained the voltage in both cases to provide a clear comparison.

 

Initially I did also got inaccurate readings from the voltage divider output, however moving the wireless tranceiver antenna about 15cm away from the circuit solved this problem

 

These values alternating towards zero and coming up again only occur when I set the sampling s frequency on the arduino to 1milisecond. When the sampling frequency is set at 0.5 seconds, the voltage values do not 'fall' to zero and come up again.

 

I will try using an xbee tranceiver and observe the output.

 

 

 

0 Kudos
Message 3 of 6
(4,030 Views)

thanks sir for ur reply.

 

I set the voltage divider output voltage to be different in both cases. I should have maintained the voltage in both cases to provide a clear comparison.

 

Initially I did also got inaccurate readings from the voltage divider output, however moving the wireless tranceiver antenna about 15cm away from the circuit solved this problem

 

These values alternating towards zero and coming up again only occur when I set the sampling s frequency on the arduino to 1milisecond. When the sampling frequency is set at 0.5 seconds, the voltage values do not 'fall' to zero and come up again.

 

I will try using an xbee tranceiver and observe the output.

 

 

 

0 Kudos
Message 4 of 6
(4,030 Views)

I'm thinking you might be maxing out your baud rate. 9600 bits per second is not fast enough to acquire at 1KHz.

 

I'm assuming your read from the ADC is actually returning an I16 that is 10 bits data and 6 bits padded with zeros. So at 1 KHz you're producing 16,000 bits of data per second... too much for your baud rate. Depending on how your serial interface handles this... you could be overflowing a serial buffer with too much data... causing the data to fluctuate between valid data and invalid data.

Stephen B
0 Kudos
Message 5 of 6
(3,993 Views)

Hello ,

           I am trying to send command to arduino through labview wirelessly . It works in wired USB. But when i use RF communication (APC 220) http://wiki.openpilot.org/display/Doc/APC220+Transceiver+Telemetry   Through labview it does not works. Its working When i check RF (APC 220) directly in Arduino serial monitor. I am choosing correct COM port and baud rate is 9600. I am using arduino duemilanove board. 

 

                                             Cable(USB)                     RF(APC220)

     

     Arduino serial monitor         works                              works

 

     Labview serial monitor         works                              not works???

 

 

my arduino program is

 

 

void setup() {

Serial.begin(9600); //initialize serial
pinMode(13, OUTPUT); //set pin 13 as output
}

void loop() {
while(Serial.available()){ //is there anything to read?
char getData = Serial.read(); //if yes, read it

if(getData == 'a'){
digitalWrite(13, HIGH);
Serial.print("LED On");
}else if(getData == 'b'){
digitalWrite(13, LOW);
Serial.print("LED Off");
}
}
}

 

I have attached my VI . If some one find solution please help me. Thanks in advance.

0 Kudos
Message 6 of 6
(3,633 Views)