01-28-2013 05:24 PM
Hello,
I have a question regarding the Labview Arduino interface with a Bluetooth module. I have an arduino uno and a JY-MCU Bluetooth hookup. The task I want to implement is simply turn on and off a LED without being connected to my computer via a wire(USB connection). I have checked my program with the wire connection and it runs fine. When I switch my com port to match my Bluetooth module and switch from USB/Serial to BlueSmirf (Bluetooth) I get an error. When I initially plug in my JY-MCU device a RED light blinks constantly. However when I run my program the light goes solid, meaning a connection has been established. However the TX and RX LED's on my Arduino do not light up. I have the TX from the JY-MCU going to the RX on the Arduino and vice versa for the RX on the JY-MCU. The steps I have taken are upload the program to Arduino via USB check to make sure it works. Switch to Bluetooth switching com and connection type. Reset Arduino and run. The program waits about 20 seconds (im guessing trying to make a connection) and then I get the error, "Error 5002 occurred at Init.vi. Unable to establish connection with Arduino." Again when I run with the USB conncetion the TX and RX LED's on the arduiono are blinking rapidly, where as in this case they do not blink at all. My question is what do you think the issue could be that I am unable to control the device via bluetooth.
Additional details.
I have Labview 2011
Arduino version 1.0.3
And I am trying to control the program via LIFA Labview add on.
Attached is a picture of my program.
Thanks,
Bill
01-29-2013 03:48 AM
Hello,
Did you check that the baudrates are the same in the 3 places : lifa.pde, init.vi and JY-MCU module? (the module baudrate has to be configured with AT commands using an FTDI adapter).
The default daudrate value for the JY-MCU module is 9600 (at least for the one I purchased on ebay).
Attached a file with the baudrate adjustement explanation.
edit :BTW, it works here even if I stick to default value (serial/USB), for the connection type in the .init vi.
01-30-2013 11:19 AM
Thanks it worked!!! I thought I could just go into device manager an aleter the baud settings there, you can not. For others who may be having the same problem I used the following code to alter the baud rate on the JY-MCU module.
NOTE: This is not my code!
// @from http://club.dx.com/forums/Forums.dx/threadid.1166641
// @see http://arduino.cc/en/Reference/SoftwareSerial
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
void setup()
{
Serial.begin(9600);
Serial.println("Goodnight moon!");
//mySerial.begin(115200);
mySerial.begin(9600);
delay(1000);
mySerial.print("AT");
delay(1000);
mySerial.print("AT+VERSION");
delay(1000);
mySerial.print("AT+PIN1342"); // Set pin to 1342
delay(1000);
mySerial.print("AT+NAMEFresaBT"); // Set the name to FresaBT
delay(1000);
//mySerial.print("AT+BAUD8"); // Set baudrate to 115200
mySerial.print("AT+BAUD4"); // Set baudrate to 9600
delay(1000);
}
void loop() // run over and over
{
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}
01-30-2013 11:49 AM
Glad that you finally got it up and running !
Antoine
11-27-2013 04:04 PM
Hello Bill!
I have the same problem. You uploaded exactly that code you pasted here when it worked? I mean there are some //... code parts. I would like to have 115200 baud rate.
//mySerial.begin(115200);
mySerial.begin(9600);
//mySerial.print("AT+BAUD8"); // Set baudrate to 115200
mySerial.print("AT+BAUD4"); // Set baudrate to 9600
Or I have to change the "//" signs for the next lines because I need 115200?!
Thanks.
Peter
02-05-2015 01:37 PM
Hi,
I am also trying to interface arduino with labiew through BT but no luck, I am getting 5002 error in LV. I've even set the baud rate to 9600 in LIFA and LV plus my BT module (JY_MCU HC06) has baude rate 9600 as well.
Can someone please help ?
Thanks a lot