LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial read datas from labview to another arduino wirelessly

Hi! I am doing my project hope anyone can help me with this.

I am reading data (Pitch, Roll, and Yaw) from MPU6050 from arduino and it is integrated with LabVIEW to make some modification. The datas are read in LabVIEW and now, I want to transmit the newdata(Pitch, Roll, and Yaw) wirelessly using nrf24l01+. As I go through this project, I am now stucked on how will I read again the newdata and transmit it to receiver(it only reads 0 which is seen in the serial monitor). I will then use this newdata to control my servomotor. 

 

Thank you!

 

I'm putting my arduino code here since I was not able to attach it. 

Transmitter (TX)

#include <SPI.h>
#include <nRF24L01.h>
#include <printf.h>
#include <RF24.h>
#include <RF24_config.h>
const int CE = 9;
const int CSN = 10;
RF24 radio (CE , CSN );
const uint64_t canal[2]= {0xE8E8F0F0E1LL,0xE8E8F0F0E2LL};

int data;

void setup() {
radio.begin();            
radio.setRetries(5,10);  
radio.openWritingPipe(canal[0]);  
radio.openReadingPipe(1,canal[1]);
radio.setPALevel(RF24_PA_MAX);
}

void loop() {
  // TRANSMIT
  radio.stopListening();
  if (Serial.available()){
  data= Serial.parseInt();


  }

  radio.write(&data,sizeof(data));

}


RECEIVER (RX)

#include <SPI.h>
#include <nRF24L01.h>
#include <printf.h>
#include <RF24.h>
#include <RF24_config.h>
const int CE = 9;
const int CSN = 10;
RF24 radio (CE , CSN );
const uint64_t canal[2]= {0xE8E8F0F0E1LL,0xE8E8F0F0E2LL};


int data;

void setup() {
Serial.begin(9600);
radio.begin();            
radio.setRetries(5,10);  
radio.openWritingPipe(canal[1]);  
radio.openReadingPipe(1,canal[0]);
radio.setPALevel(RF24_PA_MAX);
}

void loop() {
//RECEPTOR
radio.startListening();
if (radio.available())
  radio.read(&data,sizeof(data));
  Serial.println(data);
 
  delay(50);


}

 

 

arduino codearduino codeLabview viLabview vi

0 Kudos
Message 1 of 7
(1,204 Views)

Wireless is irrelevant in this case, it's just serial communications. But I recommend you get it working without the wireless modules first.

 

Most serial communication issues can be solved by watching this video: VIWeek 2020/Proper way to communicate over serial

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 7
(1,159 Views)

Good day! I have already done that thing and it was all fine. In our case, we have 3 MPU6050 with arduino each and will get the Total Pitch, Yaw, and Roll through LabVIEW and manipulate the datas that we need and will serve as our controller. But now that we have done it, we want to transmit the Total Pitch, Yaw, and Roll wirelessly using NRF24l01 to control the servos. If you have any idea how to do it, I would gladly appreciate if you share it. Thank you so much!
 attached here my main program from this project.

PART 1 of our viPART 1 of our viPART 2 of our viPART 2 of our vi

0 Kudos
Message 3 of 7
(1,142 Views)

First of all, you must understand that "data" is already the plural of "datum"  - unless you mean:

billko_2-1679672777978.jpegbillko_4-1679672823275.jpeg

 

 

Then yes, it's "Datas".  😄

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 4 of 7
(1,138 Views)

@angel097 wrote:

Good day! I have already done that thing and it was all fine. In our case, we have 3 MPU6050 with arduino each and will get the Total Pitch, Yaw, and Roll through LabVIEW and manipulate the datas that we need and will serve as our controller. But now that we have done it, we want to transmit the Total Pitch, Yaw, and Roll wirelessly using NRF24l01 to control the servos. If you have any idea how to do it, I would gladly appreciate if you share it. Thank you so much!
 attached here my main program from this project.



Are you saying that everything works fine when you remove the wireless modules and connect the Arduinos with wires?

========================
=== Engineer Ambiguously ===
========================
Message 5 of 7
(1,120 Views)

Yes, it was all well and working but my problem is, how will I make this become a wireless transmission between two different PC/laptop using the nrf24l01+ module.

attach here the diagram for better visualization

 

flow diagramflow diagram

0 Kudos
Message 6 of 7
(1,109 Views)

@angel097 wrote:

Yes, it was all well and working but my problem is, how will I make this become a wireless transmission between two different PC/laptop using the nrf24l01+ module.

attach here the diagram for better visualization

 

 


So this is not a LabVIEW issue at all then... 

 

I have never used that nrf module. But in my experience using Arduinos and Bluetooth modules, the modules have to be configured before they will work. Once they are properly configured they become transparent and wireless serial communication is no different than wired serial communication from a programming perspective.

 

I suggest you ask this question on an Arduino based forum where chances are more people have experience with that specific module....

========================
=== Engineer Ambiguously ===
========================
Message 7 of 7
(1,097 Views)