PDA

View Full Version : Bluetooth problem [URGENT]



ashwin1224
03-16-2012, 04:17 PM
Hi all,

I have made an arduino based robot, which can (has to) be controlled via bluetooth from and android phone. I bought a bluetooth module from rhydolabs.com. I wrote an android program that has four buttons, which send 105,106,107 and 108 via bluetooth. I also wrote a sketch on arduino which accepts this data and sends the appropriate commands to the motor driver. However, I cannot get signals from the module to the arduino. I have connected the RX and TX pins of the module to the RX and TX of arduino. I am 100% sure that the android app is sending info, because I also created another application, which just accepts commands over bluetooth and displays what it received. I tested my robot controller app with this and it showed the exact commands.

But I cant seem to send the data to the bluetooth module. I am able to discover it and pair with it, it even responds (the SPP LED stops blinking after pairing). But when I send the signal I dont get any response on the arduino. The arduino code also has a function to print what ever it recieved on the serial, I used the serial monitor but I could not get any input.


Please help, what has gone wrong?
Can the bluetooth module be faulty or can it get damaged due to static as the weather has been quite dry these days?

NEED URGENT HELP

vikas
03-17-2012, 09:41 AM
Yes it can get damaged but such things rarely happen.

Which module are you using ? Also have you tried paring with you computer and then using a simple terminal to check recv and transmit , confirm this to establish that it working as expected.

ashwin1224
03-17-2012, 11:33 AM
I am using this module: http://www.rhydolabz.com/index.php?main_page=product_info&products_id=479

I have not yet tried connecting it directly to a PC and using a terminal for TX and RX. However, I can pair it to a MAC, connect it as a serial port, then use the arduino serial monitor to connect it to the BT chip. After opening the serial monitor, the chip connects (the SPP LED stops blinking after pairing). However, if I pass commands from here,nothing happens.

Can you please tell me what do I need to do to check it using just a terminal? just a link pointing to the direction will do.

vikas
03-17-2012, 09:53 PM
Well use any normal BT module on PC And use it to connect to it , The BT on PC Will create communication ports .

Short the RX and TX of BT module and then send data from PC , it should be echoed back . If not there is a problem in the module.

If you have a logic analyzer , osciloscope hook up the tx pins and see if there is any activity on the BT module when data is being sent.


PS the RX of Module will go to TX of Arduino and TX will go to RX.

ashwin1224
03-18-2012, 10:04 AM
Hey thanx,

The first thing I did was to put the RX of module into TX [Now I feel so dumb not to think of it earlier :p ]
However, there is no response after I used the phone app . Then I did what you said, I connected using bluetooth and shorted RX and TX. Wen I sent data, it was looped back. But if I gave the programming commands of the module, even they were looped back. "LLL" is the code to enter Command mode of the bluetooth and it is supposed to send and OK if it enters. Right now if I give LLL, it just says LLL. How can I program it?

Even if I send the 'i','j','k','l' [The codes to command the robot], There is no response from the arduino. If I dont use the BT and send commands over USB serial, it works.
Now what?

I think I can use the arduino to send These commands to the BT. But so far I only know how to receive commands, not how to send them.
The Code I wrote accepts serial data, and print ["I recieved:"incomingbyte]. How can I send the incomming data to the module?

lolman_returns
03-19-2012, 04:25 AM
Hey thanx,
...
I think I can use the arduino to send These commands to the BT. But so far I only know how to receive commands, not how to send them.
The Code I wrote accepts serial data, and print ["I recieved:"incomingbyte]. How can I send the incomming data to the module?


I don't understand, you can use Serial.read but can't use serial.write command?

ashwin1224
03-19-2012, 03:44 PM
@lolman: LOL man [ ;) ], I meant I can give serial inputs using USB, by starting a serial stream on the USB port. When I use serial.write with usb port, serial.write will write on the USB serial monitor right?

How can I send serial.read from usb and serial.write on bluetooth. At the same time I need to somehow view what the BT returns i.e. serial.read from the BT port.

makes sense now?

EDIT: I need to send "LLL" etc commands to BT in order to change its BAUD to suit android.

lolman_returns
03-20-2012, 03:51 AM
It's times like these when you wish you had an arduino mega with multiple serial ports.
How about using softserial library (do a search on google) to emulate another serial port off of any two pins on the arduino.
Then you can leave the USB connection with the pc on, recieve command from the usb, store it in a variable and send it to the BT module using the emulated port and then you can subsequently store the BT module's response on the emulated serial port in a variable and send it to the PC for display?