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 Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

BEGINNER connection : Labview + Xbee

hello, iam a noob in Labview and also Arduino, but i try to learn it step by step, Currently i have a problem on how to creating communication between labview and arduino using Xbee so that in the end of this small project, i able to control one or more servo from the labview. I've tried several tips from discussions in this forum, the last post i was looking at is  https://decibel.ni.com/content/thread/10814, but nothing can seem clearly make me through it. I'm using Arduino Uno, Xbee 1mw and i already got these xbees communicating to each other with xctu. When i try to connect it up, the xbee keeps sending data (lights DIn Dout flashing constantly), but the LED seems not responding to the data i sent.

This is the block diagram,

1me.png

i also have already changed the LabVIEWInterface.h so that the default BAUDRATE only appointed to 9600

If anyone kind to help me, i would appreciate it so much, Thanks! :smileyhappy:

0 Kudos
Message 1 of 23
(24,753 Views)

Is the Arduino showing as registered to a port in the device manager?  Also, the default baudrate for the Uno is not 9600, it is 115200.

0 Kudos
Message 2 of 23
(9,809 Views)

ya, for sure it is already registered, i've tried to change its baudrate, but nothing seems working. Previously, i have successfully connect the arduino and xbee that i can manually control one or more servo with X-CTU. And i also can control one or more servo within a dial in labview but this is when i directly connect the arduino to the computer and without xbee.

When using xbee it appears that i have error 5002, the labview could not initiate the arduino connection or something, but after i start the labview code that i've shown previously, the red led in both xbee explorer and xbee shield is flashing rapidly. Do i miss something? the image below show when i tried rotate a 180 servo with labview using xbee, but nothing seems working..

2me.png

Thanks all

0 Kudos
Message 3 of 23
(9,809 Views)

Are you using the "abort execution" button to stop your program?

0 Kudos
Message 4 of 23
(9,809 Views)

ya, Im using the stop button to stop the program whenever it is not working. is it related to the error i've got? or is it something have to do with the xbee communication in labview? errgh, this has spins my head around for days..

0 Kudos
Message 5 of 23
(9,809 Views)

Generally, with LIFA, you never use the "Abort Execution" button because it can cause this error.  So, always use the "Stop" button in the while loop to stop code that is using LIFA.  If for some reason that won't work, then all you can do is abort but then you have to consider that the Arduino was not closed successfully and that you might have this issue.

Does it ever connect successfully to the Arduino, like when you first start LabVIEW and connect everything?

0 Kudos
Message 6 of 23
(9,809 Views)

yaph, get it, thanks for the info for not using abort execution button that sometimes it leads to unsuccessfully closed arduino. Okay, right from the first time i using xbee in Labview, it never connect successfully to Arduino (its just showing rapidly flashy red led in xbee explorer), but if it is without xbee, everything work just fine, is it something to do with setting up the xbee in LabVIEW? do you have any starting tutorial references related to this?

Thanks

0 Kudos
Message 7 of 23
(9,809 Views)

hola amigo como pudiste ya que no he podido realizar esta conexion podrias subir una imagen con el codigo para verificar los errores que pueda tener en mi VI saludos

0 Kudos
Message 8 of 23
(9,809 Views)

Halo Nathan, i finally get it worked. I did,

1. changed the defaultbaudrate in LabviewInterface.h

so it becomes (remove the if else),

#define DEFAULTBAUDRATE 9600    // Defines The Default Serial Baud Rate (This must match the baud rate specifid in LabVIEW).

2. creating control for connection type pointing to xbee and create constant for baud rate (9600) and creating constant for visa resources

This is the final code i get,

4.png

and that's all, everything from the previous thread i referring was actually right, it was me that is not rigorous and aware of this. Thanks for your help!

0 Kudos
Message 9 of 23
(9,809 Views)

Sometimes the smallest issues are the hardest to "fix". lol  I'm glad you figured it out!

Message 10 of 23
(9,809 Views)