I've just received my BlueSMiRF blue-tooth module, and I'm having some problems using it.
When I hook it up with my Arduino, as it is supposed to be: Vcc to 3.3V, GND to GND, TX to pin 1, RX to pin 0, I can not communicate with it from my pc. I run a simple echo app on the Arduino:
My USB dongle fires up, I see the green let on the BlueSMiRF lighting, but nothing is received on my pc, nor on the Arduino, since the RX led does not blink.
The strange thing however, is when I connect the BlueSMiRF in a wrong way, namely TX to pin 0 and RX to pin 1, the Arduino receives data, and responds to it, which I also get on the pc. Although the response is total trash. Here is a sample, when I send all the 256 character (that is in the first column), and store the response of the Arduino (which is in the second column).
As you can see there are some value which match (eg. char 187), but most of them not. Since I'm stuck with this problem, any idea would be appreciated.
I have a Arduino Duemilanove and a BlueSMiRF Silver and I just recently (yesterday) got it to communicate through correctly. Let Bill2009 and I know if that is what you have and I'll gladly detail how I got it going.
It almost sounds like the wiring is reversed and the baud rate is wrong. Does the BlueSmirf default to 115200? Most of the serial devices I have seen usually default to lower rates.
Be careful of the transmit and receive nomenclature. I wish the would they would
an "in" or "out" suffix to the pin names for clarity.
As was mentioned be careful that you do not have two outputs connected together
(the USB and the BlueSmirf).
It's not one of the ones with a built-in USB is it? That would interfere with pins the pins 0 &1.
Yep, it has got USB, but when I use the BT module, I power it from a wall wart adapter, so this should cause the problem, I guess.
How exactly do you have this hooked up and where are you seeing the mismatched values?
I connect the TX pin of the BT to the RX pin of the Arduino, and the RX pin of the BT to the TX of the Arduino.
@redredred
Yes exactly, I have a BlueSMiRF Silver. What baud rate do you use?
@jluciani
According to the data sheet 115200 is the default baud rate, but I think I tried 9600 also with no luck. I see that the SparkFun guys changed the name of the device, but I don't see a point changing the baud rate.
Yep, it has got USB, but when I use the BT module, I power it from a wall wart adapter, so this should cause the problem, I guess.
I am not familiar with your board but it could be a problem. Sometimes the wall adapter power supply is diode or'ed with the +5V on the USB. Whichever device is the higher
voltage will deliver the current.
Do you know if the USB chip (probably an FTDI? ) is powered when the USB
cable is disconnected? If the USB chip is powered you could strange things
on the COM lines.
ok, I hope redred will chime in here because he just went through ths but a) I think the bluesmirf might be set to 9600 baud and b) I'm not sure that using the wallwart power is enough to keep the USB chip from interfering.
9600 baud is easy enough to try and maybe that will solve your problem. Failing that you can do one of two things to avoid the interference:
a) is easy but scary: pop the atmega chip out of the arduino and connect the bluesmirf's tx to the arduino's tx and rx to rx (effectively substituting the bluesmirf for the atmega). Now your PC should be able to talk to the bluesmirf directly over the USB as well as over bluetooth.
b) is trickier but less scary: hook up the bluesmirf's tx and rx to two other pins on the arduino and use the software serial library routines to talk to it.
I hope I'm not just making this more confusing. Good luck. send a pm to redred and get him to chime in.
the bluesmirf seems to work well once it's figured out but the documentation(or lack thereof) is just silly.
You are absolutely right bill2009. I've just tried with 9600 baud rate and it is working.
the documentation(or lack thereof) is just silly.
I second that. As I said earlier the doc which can be downloaded from the product's site states that the default value is 115200 (see pp. 64 of BGB203 BT 2.0 Serial Port Profile Module User's Guide). I guess SparkFun people changed it to 9600.
Anyway thanks for all of your help, I hope now I can do what I wanted.
Sorry to come in late here, I'm glad you got it to work. I thought I'd throw a couple of thoughts.
I used a software serial simulator AFSoftSerial and put the BlueSmirf on pins 2 and 3. That way I could use the USB to get debugging info to the PC while at the same time communicating with the BlueSmirf. This works fine EXCEPT it appears AFSoftSerial doesn't work so well at 57.6Kbaud or above.
So then on the same PC I had 2 terminals open. One connected to my bluetooth serial port. The other to the Arduino's USB. The complete round trip was tested by echoing characters in the Arduino from the 'Smirf to the USB. So, if you get the picture, I could type in one terminal and see it in the other.
Terminal <-USB-> Arduino <-sketch->Bluesmirf<-bluetooth->serial port emulator<->terminal
If you want any more info on this, just ask. There are a few more details that may help.
@redredred
Thanks for this info. I have a question: did you try to reconfigure the module with AT commands? I tried to change the name of the device with
+++
AT+BTLNM="Device"
AT+BTLFLS
AT+BTSRV=1
and now I can not connect to the module /I use hcitool scan on my GNU/Linux box/
Peter,
No, I didn't try to rename the device or anything like that. I don't know enough about bluetooth to risk mucking around with stuff I don't know about. I did fiddle with the baud rate, and that I got to work. I also fiddled with the auto-connect mode (AT+BTAUT=1,1) and that worked fine.
Question, are you able to see how the 'smirf is responding to your commands, or are you sending them blind through the arduino?
But that command "BT+BTLFLS" I think should be "BT+BTFLS". Was that just a typo in your post? Anyway, I swear the first time I issued that command the thing switched to 115200 baud on its own. I can't explain it, and I was able to switch it back to 9600 baud. But it was early in my experimentation and I may have done something else, like reset it to factor settings or something. But a suggestion might be to try to see if the baud rate got switched on you.
Another thing is I think when auto-connect mode is active AND a bluetooth device is connected, then you can't get back into command mode even with the escape sequence. Maybe that is it.
Let me know if any of this works. I spent a good 7 or 8 hours playing with lots of permutations of all of this, as the documentation isn't so helpful in figuring out exactly how to really use this thing.