Cheap bluetooth module for an Arduino
Some time ago I ordered a cheap bluetooth module on ebay for my Arduino. I went for a no-name module, when I say cheap I mean it. (well after all it were only a few dollars cheaper than the branded ones)
Anyway, module arrived and I tried to communicate with an internal command processor, which I expected to be there. Hooked up serial lines to the TX(1) and RX(2) pins on the module, 3.3V VCC(12) and GND(13). Nothing happened, no response to AT commands. I read multiple web pages, all describing how it should be done. I think I tried all possibilities. Many people mention that I should pull high pin 34 or 26 to actually enable the command processor.All this were tried and much more too. Nothing, no response to my attempts.
On the other hand, I could see the module on the bluetooth "ether", both on my primary linux box and on an old XP box, so some sort of life were detected. From the web I have learned that the pin code most likely would one of 0000, 1234 or 12345.
Well, after some time I gave up, and cried my failed attempts on the shoutbox. Birdmun asked why I were so eager on speaking to the command processor, well I thought that changing the pin or something would be necessary. Next day aaronsuper1 gave me yet another link (http://arduino-projects.co.uk/tutorials/connect-arduino-android-phone-bluetooth/ which now redirects to http://www.therobotlab.co.uk/2011/arduinoandandroid/) to people using their androids to control an Arduino. Somehow that link were a little better which helped me!
All my struggle to get the command processor speaking where waste of time. I simply skipped that part. Used the XP to wake up the module and pair my USB-bluetooth dongle with the module. 1234 were the correct pin code in the case of this particular module. When the initial pairing were done I moved back to linux where I'm more comfortable.
Right now I have a test setup consisting of the following chain
- linux system
- terminal program (minicom, putty or something like that)
- usb->rs232 converter, showed up as /dev/ttyUSB2 on my system
- rs232->logic converter (home made, http://letsmakerobots.com/node/29207)
- bluetooth module
- air with radio waves. "the ether"
- bluetooth->usb dongle
- terminal program (connect to /dev/rfcomm4)
- linux (actually the same machine as in step 1)
The linux is an older ubuntu box, 10.4 I think. It should not be that important.
Since the terminal program in step 2 is using a real serial communication link, baud rate is important. I figured out that my module is operating at 38400 bits per second. This finding were made by trial and error, and when that failed, I fired up my good old oscilloscope were the bit rate were easily visible)
To get step 7 and 8 working I had to prepare the bluetooth system on the linux a little:
- Scan the "ether" for bluetooth devices type: hcitool scan. returned a address and a name
- Bind address to a linux device (I picked number 4): sudo rfcomm bind rfcomm4 00:19:5D:24:B7:63
The last one does not make an actual connection between the two bluetooth devices but only prepares them. When a program opens the device file the actual connection gets established.
Now type something and watch it show up in the other window, transmitted via bluetooth.
As seen on the picture, there is a 5'th wire (pin 31) going out from the module. It's a status line, able to drive a LED. If LED is flashing there is no connection. When it is steady on there is a bluetooth connection established.