# Very simple bluetooth requirement

I have a very, very simple requirement for a bluetooth module/Arduino solution. I want to periodically scan for and report the device ID for any bluetooth devices present. Actual logic regarding further identification of devices would occur downstream. I believe that even SDP is overkill for this application.

In very simple terms, I want to use this information to inform my home automation solution whether or not certain individuals are home.

I'm quite comfortable with Arduino development and interfacing with hardware; have done extensive work with XBee and other RF devices, but have little practical experience with bluetooth development.

My question is this: is this as trivial an implementation as I'm assuming it will be? Should most bluetooth modules available be capable of supporting this requirement? Does anyone have suggestions regarding a specific module which would be a good fit? I'm looking for the lowest-cost solution possible, as most available bluetooth modules seem to be massive overkill for this problem.

Yes, this is as easy as you think it is!

Most integrated Bluetooth modules (modules that have a built-in stack, rather than HCI only which require you to use an external stack) will allow you to scan (inquire) for devices. I've been playing with several recently, the Bluegiga modules such as the WT12 have a particularly nice and easy to use serial interface. For those modules it's pretty much just a case of connecting to a UART, sending the inquire command down to the module and reading back the responses (a line per device found which includes the MAC address and device name).

Most of the modules I've seen have similar commands and interfacing. Expect to pay $20-40 for a module of this type. • Welcome to our site! In the future please do not use signatures. Take a look at our FAQ to learn more. – Kellenjb Jul 7 '11 at 13:24 • So I picked up a new WT12-A-AI module on ebay for about$6 along with one of Jeff Rowberg's UART breakout boards (inmojo.com/store/jeff-rowberg/item/…). However, the module is already mounted on a breakout board. It has a very fine pitch 12-pin connector on the back as well as two rows of four holes. The datasheet does not mention this breakout. Does anyone happen to know how I can find more information regarding pinout or details about this connector? – buzzdata Jul 12 '11 at 0:11
• Unless you can find a datasheet/pinout for the breakout that your module is mounted on you'll probably have to work it out with a meter on continuity. The WT12 datasheet shows the pinout of the module, most of the pins you can ignore, you want the serial and power pins (as per Jeff's breakout). – Al Bennett Jul 19 '11 at 9:07

What is your interface? If you're using a UART, you will need to use HCI standard of the Bluetooth spec to communicate with a chip. It is not clear if this is for mass production intended or simple hobby project. In MP you can get Bluetooth modules well below 4$. Chips are usually around 0.75-1$ range however this number will go up due to RF front end and antenna. You need to submit your stuff to FCC/TELEC etc. for different markets, so for small quantities look for modules with approval.

As per software, there is no really good open source Bluetooth stack out there. The Linux one is big and ugly for what you are doing. There is an open source project to implement a Bluetooth stack on iPhone and I have seen people port that to ARM type processors, so that is where I would start. It is called BTStack (http://code.google.com/p/btstack/). It is really basic but probably would make your project go. Commercial stacks start from 20K NRE + royalty in the tens of cents.

• Welcome to our site! In the future please do not use signatures. Take a look at our FAQ to learn more. – Kellenjb Jul 7 '11 at 13:24
• @Frank - Where or what is MP? – Kevin Vermeer Jul 7 '11 at 16:43
• @kevin vermeer mp is mass production I believe. And thanks for the edits, I have just been on my phone. – Kellenjb Jul 7 '11 at 21:00
• Excellent, thank you all for the responses. This is for a hobby project and will be using Arduino (or a raw AVR) as the uC. UART, SPI, and i2c are all acceptable solutions. I do like the idea of a simple UART solution. – buzzdata Jul 8 '11 at 0:15
• Kevin, MP=Mass Production usually indicates you make the thing in the 10's of thousands. – Frank Jul 8 '11 at 10:26

So I've just started looking at the same problem (occupant detection for Home Automation). I'm starting from the perspective of a thermostat rather than a whole-house system, but the problem here is the same.

One thing I ran into pretty quickly with the WN-41 chip is that the high-level interface (command set) doesn't provide enough visibility to detect a bluetooth device unless it's in "discover me" modem. (Cellphones are usually NOT in "discover me" mode because it uses a lot of power).

As such, it's not really an option and the only thing besides the high level command set on the WN-41 is the HCI interface.

I haven't been able to find an adequate HCI library as yet, though I've found a couple of partial and/or related implementations that might work with some adaptation. I've ordered a couple of BlueGiga breakouts (one from Jeff Rowberg which I've clicked "I want one", but they're not in stock just yet) and one from WES (www.goews.com) which is currently selling the WT12 for \$50.

Unfortunately, their WT12 board doesn't export the RTS/CTS pins on the small header, so you have to either go without flow control (seems like a bad idea) or you have to load up the full 11/12 pin headers on the opposing side of the board to pull out 6 pins worth of connections.

Further, Bluegiga's SPI interface is useless for anything other than mucking with the firmware on the Bluegiga because they don't support it as an interface for iWrap or HCI and they don't obey the SPI spec for what pins do when the CS pin is IDLE.

So I think Jeff's board is the best solution I've found so far, but, I still need to actually get ahold of it and see if it will recognize proximity of my iPhone without putting the phone in discovery mode.

If you found a better solution, please let me know.