LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview,arduino y bluetoot

Solved!
Go to solution

Buenas, Estoy intentando realizar comunicacion, labview con bluethoot y arduino , uso un programa que funciona cuando esta conectado mediante el USB,

ya di de alta el arduino en la computadora me da 2 puertos COM. En el Vi.ini le pongo q funcione con bluetoot bluemirf algo asi , 9600 baud rate y intento con ambos COM pero no funciona, el arduino esta con su fuente externa sin cable USB, con el programa LIFA cargado y el diagrama del bluethoot que use es este.

5.png

alguien podria decirme que tengo q hacer o que me falta?

o si alguien me puede pasar un programa que funcione que solo prenda un led o algo para comparar en que ando mal.

0 Kudos
Message 1 of 11
(6,573 Views)

hola, alguien?

0 Kudos
Message 2 of 11
(6,529 Views)

Sin título.png

 

 

0 Kudos
Message 3 of 11
(6,515 Views)

Hola jononos Hablas Ingles?

 

yo entiendo espanhol, mas no lo sei escrebilo.

 

I have the same scheme mounted here. Your schematic seems to be correct but you need to check if the RX TX signals are 3,3V or 5V, or you may damage the bluetooth board.

 

Also which bluetoth model you have? I have a JY-MCU V1.05

 

your code also seems to be OK, but because I'm not using the labview firmware for arduino I don't know if it works correctly with the bluetooth module.

 

In my case, the basic code looks like this.

 bluetooth read.png

 

In the Arduino code I have in the loop() Serial.println(number);

 

Another thing you should check is if the bluetooth device is connected to the PC and which port is it using, You can seed this in Devices and Printers (control panel), select your bluetooth device (if you can spot which one is it) or if you never added it to your computer you should first add a device and then you can check which port is it using.

 

Note that if you have the arduino board powered by your PC the communication may not work through the bluetooth board, because the USB share the same pins for communication. 

 

Also if you have the same (or similar) bluetooth device, as me,  you should see a red led blinking, when it connects to the PC the led stays ON, this only happens actually when (in this case) your labview program is running.

 

I hope this help you, I my help further later if you need

0 Kudos
Message 4 of 11
(6,507 Views)

my bluetooth is the JY-MCU V1.05

i conect it to 5v and ground and rx to tx and tx to rx from bluetooth to arduino.

 

the red led blinks when i conect it and when i start the labview program it stop blinking and stay on like if something conected to it but nothing happens in the labview (note: the program works with usb connection).

 

the arduino is not conected to the computer by USB i use a 5v celphone charger.

and the bluetooth device is conected to the pc.

0 Kudos
Message 5 of 11
(6,500 Views)

Ok, everything seems to be OK

 

maybe the LIFA firmware doesn't allow to correctly communicate through the bluetooth module. 

To be sure it works upload this code to the arduino board.

 

 

void setup()

{

Serial.begin(9600);

Serial.println("1234567890"); 

}

 

int i=0;

void loop() // run over and over

{

  i++;

  Serial.write(i);

}

 

in Labview use the code I've posted before,

 

in the labview you should now see the numbers going up

 

 test and give feedback

 

Now you should see something, also like I said before go to devices and printers select your device a go to properties, select the tab connections and you should see the com port used there.

 

Also for more help read

this:https://decibel.ni.com/content/people/iUlises/blog/2013/08/19/comunicaci%C3%B3n-bluetooh-con-arduino...

this: https://decibel.ni.com/content/thread/15998

this: http://redacacia.me/2013/09/10/remote-viewing-with-ni-labview-digilent-uno32-and-basic-io-shield/

and this: http://hetpro-store.com/index.php?option=com_content&view=article&id=%2023

 

there is a lot of usefull info in those sites, the last ones are in spanish

0 Kudos
Message 6 of 11
(6,492 Views)

OK i tried what u said, i loaded the code u gave me into the arduino and this is what i get from labview, (note: the red led of the bluetooth stop blinking when i run the program and after a while when the error pops the red blinks again.)

Sin título.png

0 Kudos
Message 7 of 11
(6,485 Views)

The problem here is that there is a problem when configuring the serial port.

This could happen for many reasons.

 

What I suggest to do is disable the bluetooth on the PC wait a couple of seconds and enable it again.

 

on you labview code, on the serial port config vi add a baud rate selector and set it to 9600, also try 115200, or other tipic baudrates. If you never changed the baudrate in the bluetooth board the baudate should be 9600.

 

If it don't work at the first time, try a couple more times.

 

The red stop blinking means you have connection, that's good, because you get an error, if you look at the code, there is a close serial port at the end, and so the connection is ended if you get any error.

 

PS: in your code the read buffer string indicator should be connected to the visa read and not to the string constant

 

 

 

0 Kudos
Message 8 of 11
(6,471 Views)

ok got a new question, since i am using com 9 in the vi with 9600 baud and the bluetooth stop blinking i guess they are both right, but i read somewhere else that i have to set the baudrate in the LIFA program too, so somebody could tell me exactly how? with screenshots if possible ty.

0 Kudos
Message 9 of 11
(6,446 Views)
Solution
Accepted by topic author jononos

I did a little research under the LIFA firmware and:

 

If you installed the labview interface for arduino you should find it under C:\Program Files\National Instruments\LabVIEW (your version number)\vi.lib\LabVIEW Interface for Arduino\Firmware\LIFA_Base\LabVIEWInterface

 

On this folder open LabVIEWInterface.h with Arduino IDE

 

find this: 

 

"

#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)

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

"

 

change it to this:

"

#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)

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

"

 

Basically in the code it says that the default baudrate is 115200, if you are not using the Arduino Mega.

You just need to change the code so the default baudrate is set to 9600

 

I hope you can get it there.

 

0 Kudos
Message 10 of 11
(6,439 Views)