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.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Multi Channel USB Data Acquisition

Solved!
Go to solution

I am using the following VI for arduino HC-06 bluettoth data acquisition. I would like to acquire multicahnnel data 

 

Could you suggest me how to acquire multichannel data from USB? To do this, in what way  i have to program the arduino?

0 Kudos
Message 1 of 9
(5,679 Views)

You should change the program in the Arduino, to send more than one channel.

This is just reading all data from the Arduino, no clue is given how the Arduino has been programmed.

greetings from the Netherlands
0 Kudos
Message 2 of 9
(5,668 Views)

Dear Albert,

 

Thank you for your reply,

The arduino code is pretty simple

 

void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(57600);
}

// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0);
// print out the value you read:
Serial.println(voltage);
}

0 Kudos
Message 3 of 9
(5,647 Views)
Your code is only reading one channel so you need to modify that first of all. The send both channels with a single println with the channels separated by a comma or something similar. When you read, the channels can be separated in a variety of ways - Scan From String, Spreadsheet String to Array, etc.
0 Kudos
Message 4 of 9
(5,641 Views)

Dear Mr. Dennis

 

You are right, that code is for single channel only.

for multi channel transmission, i am using the attached code...

The problem is,

all 4 channel data, i can read properly in arduino serial montor.

In labview, i am able to read 2 channel only.

there is  some problem in acquiring data through labview, could you kindly suggest somthing which will work?

 

 

 

Download All
0 Kudos
Message 5 of 9
(5,602 Views)
I can't view the VI now as I am posting by phone. Can you attach an image?

Why all of the separate print commands in your arduino code? Why not just println with all 4 results?
0 Kudos
Message 6 of 9
(5,593 Views)

I tried arduino in suggested way. but it was throwing an error.

that's why i programmed it so.

 

Images are attched herewith for your perusal.

Download All
0 Kudos
Message 7 of 9
(5,576 Views)
Solution
Accepted by topic author Haristhota
Your property node does nothing since you are not writing anything.

Why are you setting the number of bytes to read to 8? You are sending more than that. You should be able to just set it to some high number, like 1000. Why are you using a dbl for that control?
Message 8 of 9
(5,565 Views)

Thank you very much for your suggestions. its working.

But if i give input to channel 2 or 3 or 4, they are not responding. only channel 1 is responding irrespective of input pin. what could be the reason for this?

 

earlier, i was acquiring single channel data at 57600 baudrate, i was getting pure sine wave signal upto 90Hz, after that it was started distorting.

Now, it started distoring above 20Hz, i think i need to increase the baudrate to 230400 to get 4 channel undistorted signal upto 100Hz,

but arduino supports upto 115200 only, what shall i do??

Download All
0 Kudos
Message 9 of 9
(5,533 Views)