I used a few different guides for this, which I'll reference here. I didn't invent anything here, but found I had to use information from one or two guides, so I'll link them here.
Firstly - the dongle I used was one of these.
Then you need to setup the software on the Pi to drive it, for which I would recommend this guide. I would say though that this guide fell foul of actually getting the thing going. It was good for getting the software installed though. My particular combination of dongle and UUID or whatever just didn't quite work, so I then used this guide which is where I realised that I had some extraneous zeros on the end of the hciconfig command.
One *really* useful thing is to have two ssh sessions going, and have hcidump running in one of the windows. It gives you output like this:
< HCI Command: LE Set Advertise Enable (0x08|0x000a) plen 1
> HCI Event: Command Complete (0x0e) plen 4
LE Set Advertise Enable (0x08|0x000a) ncmd 1
status 0x0c
Error: Command Disallowed
You can see from my sample output here that it showed up a problem - when you issue the UUID and so on you should get something like:
< HCI Command: LE Set Advertising Data (0x08|0x0008) plen 32
> HCI Event: Command Complete (0x0e) plen 4
LE Set Advertising Data (0x08|0x0008) ncmd 1
status 0x00
The non-zero status is a bad thing!
The final part is to set up init.d scripts to automatically start the Pi broadcasting when you reboot the Pi, and this can also be found in the second guide - very handy.
I would advise doing a sudo apt-get update and probably upgrading the Pi firmware to the latest version using rpi-update (note that this caused my Pi to go into single user mode, so have that keyboard and HDMI connection handy if you do this).
The last part was to write the app, and that's still in progress, but to test the connection I would recommend the free app by Radius Networks. There's another app referenced in the docs, but it's not free anymore.
If you want to dig Xcode out and start cutting code then that's pretty easy too, and when my little welcome app isn't so hacky I'll share the code.
Note that if you do use the UUID in the second guide above there is already a profile which will detect this in the Radius App, called Apple Locate, so it's the quickest way of checking your BLE is working properly.
Have fun!
No comments:
Post a Comment