Bluetooth is a great method for connecting various hardware devices together without wires.  Once connected bluetooth devices

are typically very robust in comparison to inexpensive RF modules like these.  The range makes them a good fit for indoor solutions, such as household robotics.  My objective is to find and step through in detail an extremely reasonable priced solution for inter-machine communication.  Some projects which should be feasible with inexpensive and robust communication are :

  • Smart little robots - robots which are just a single micro-controller, but allowed to tap into the resources and computational power of the home computer
  • Swarms - little inexpensive micro-controller robots which can communicate through or be guided by a centralized computer

 

There might be more inexpensive bluetooth devices on the market but I have found the following hardware to be the best price.

The hardware
 
Programmable Passive Blue Tooth Unit
 
Host - non-programmable (less programmable?)

This is a FDTI cable with wires attached to the host bluetooth unit.

 

The manufacture did not dicern previously from host and passive unit.  At that time they just sold "blue tooth units".  When my order of 6 units came in I just happened to get 5 hosts and 1 passive unit.  Initially, I thought that they were broken.  I started experimenting with them one by one.  I could get none of them to show up on my computer which was running a rocketfish bluetooth dongle.  Until the LAST one I checked (the passive one) displayed as linvor. 

I can connect from either Linux or Windows using my computers rocketfish dongle to the passive bluetooth unit.  With more experimenting I found that the other bt units would connect to the one which was working.  At that time I figured out the units are really designed as pairs. One host and one passive represent a wireless serial line.  The passive displays as linvor, and the host when it starts up tries to connect with the passive unit sending  pin (1234)  and establish a serial connection @ 9600 8N1.

Scouring the web I found a few references on how to program the little bugs.  You send AT commands to them.  I have changed the baud rate and bluetooth name of the passive device so far.  The host module behaved differently than the passive one.  I was hoping to change the host module into a passive unit, but no such luck yet.

I will be ordering more passive units since I find them more useful.  They can accept serial information from the host units as well as a computer's usb dongle.

Windows

hyperterminal

Linux

Use the blue tooth preferences to scan and bind with the linvor device

<<have not found where the pin can be entered on a command line tool - currently it must be initially "paired" by blue tooth gui wizard>>

# scan for devices - find the address of the bluetooth serial - linvor is its factory name
# the computer is my neighbors

[root@trematode bluetooth]# hcitool scan
Scanning ...
    00:26:4A:A1:DB:87    Clayton Cruden’s iMac
    00:11:08:05:07:86    linvor

# browse the linvor device - it does not come back with anything as it is a simple serial

[root@trematode bluetooth]# sdptool browse 00:11:08:05:07:86

# make a connection with the linvor device
# the device must be paired previously so configuration will be used to authenticate with pin 1234

[root@trematode bluetooth]#  rfcomm connect 0 00:11:08:05:07:86 1
Connected /dev/rfcomm0 to 00:11:08:05:07:86 on channel 1
Press CTRL-C for hangup

gtkterm -p /dev/ttyUSB0

HUGE NASTY BUG WITH LONG POINTY TEETH
That's right there is a huge nasty bug in Ubuntu and other Linux systems which have a derivation of the blue-tooth wizard.  This nefarious wizard is "supposed" to help you set up pairing with your device, HOWEVER, it has a bug such that it WILL NOT pair with a simple bluetooth module which has no inputs for password.  On more complicated devices (smartphones) a passcode/pin is entered on the computer and verified on the device, then a passcode/pin is put in on the device and verified with a computer.  

Having a serial bluetooth module with 6 wires hanging off it, makes it a little challenging to enter in a passcode !   

And I still have not found the file or command line which allows pairing through a terminal !

Grrr..  

WORK AROUND THE WIZARD
I got this working on Ubuntu by installing the BlueMan (Bluetooth Manager).  Install it using the package manager.  I searched for the module, entered my 1234 an BataBing !   It worky !!!  Yay !

 

BINGO !

Wow, its great to finally find the missing pieces.  In this case the missing pieces were AT commands which appeared to not work.  But I just found the correct documntation.

Here is the link - http://item.taobao.com/item.htm?spm=11024mpB.1-4A6bR.z-2Pff*r&id=7323491777
Its in Chinese (Simplified Han) - but Google does an excellent job of translating it.
The part was driving me crazy was attempting to change the Baud

Baud
Modify the Bluetooth Baud Rate : send "AT + BAUD1" (must be uppercase), set up after the success of the module will return "OK1200",

BAUD serial number behind the representatives need to set the baud rate, corresponding to the following:
1 ---- 1200bps
2400bps 2 ----
3 ---- 4800bps
9600bps 4 ----
5 ---- 19200bps
6 --- -38400bps
57600bps 7 ----
8 ---- 115200bps
9 ---- 230400bps
460800bps A ----
B ---- 921600bps
C ---- 1382400bps
        set the baud rate to take effect immediately after the success, such as the need Enter the AT command, the baud rate must be transferred to the software and have the same baud rate set to respond to AT commands (such as the default baud rate is 9600bps, with the baud rate set a new baud rate is 1200bps, the need the software is set to 1200bps baud rate to respond to AT commands can be re-) Special Note: Please check before setting the baud rate if the software supports this baud rate, otherwise it will not be able to set the baud rate! ! When using the computer's serial port settings than 115200bps, the general MAX232 chip can not be reliably higher than 115200 baud, so need to use a higher baud rate other support equipment (such as single-chip, or USB to support high baud rate serial, shop for sale) in order to communicate again with the pass-through module

Here's what it says regarding programmable parameters - some of which I found out but trial and error
Bluetooth module parameter set method (module default baud rate 9600bps, device name: linvor, matching password: 1234, if you do not need these parameters by default character set. All parameters of AT command set a good power-down can be saved):

        Send AT commands must be connected before connecting the hardware, the following to the computer via USB to serial module to set the module parameters, for example, due to voltage regulator chips on the floor, access to 5V power supply module, Bluetooth module to the TXD pin is connected to USB to serial port module the RXD pin, RXD pin is connected to USB to serial module TXD pin , and notice that the first not to establish a Bluetooth connection with your computer, or can not be set , and then open the computer's serial port debugging tool, remove the "send a new line" before the hook, Then enter the string input box to send AT commands or press Enter after point.
        If the test communication instructions , send AT, if the connection is correct, the module will return OK, now you can send commands to set parameters
 

References

http://www.wavesen.com/products.asp original manufacturers

12.2 GAP Commands

12.2.1 Discoverability Mode (AT*AGDM)
AT Command Description
AT*AGDM?<CR> Reads the GAP discoverability mode.
AT*AGDM=<discoverability_mode>, <store_in_startup_database><CR> Writes the GAP discoverability mode.
 
AT-Command Set - blu2i - To device 1 send AT+BTP. It will become discoverable and connectable.

TODO :

  • step through connection process (purchase to deployment) - document in detail both from Windows & Linux
  • see if it is possible to write new baud rate of 115K just using simple AT commands
  • see if it is possible to re-write a host into a passive slave using the CMD pin & AT commands