When I first started working with the Bluno, I found the documentation didn’t really give me a clear idea how to talk to the Bluno.
DFRobot does provide example iOS and Android projects. However, as I was making my app with the Unity game engine. I could not use that directly.
So, I ended up going through the example Android and iOS project examples provided by DFRobot to “reverse engineer” information about the Bluno’s pass-though serial service/characteristic.
This post is a write up what I figure out (back when I first started working with the Bluno). This information should be useful for anyone who wants to connect to the Bluno by means other than a standard iOS/Android app.
(I’m writing this to answer Pablo’s question: http://www.cevinius.com/2015/09/19/detailed-mobbob-build-instructions/#comment-987. Let me know if this helps. I connecting using Bluetooth LE.)
At the time, I was brand new to Bluetooth comms and didn’t even really know how Bluetooth LE differed from regular Bluetooth.
The examples provided by DFRobot were based about using Bluetooth LE “GATT”.
After studying the supplied Android/iOS code, reading up on GATT, and some trial/error, I figured out how to use the Bluno’s GATT Services/Characteristics for doing serial communication.
The service and characteristic to use for serial comms is:
Service UUID : 0000dfb0-0000-1000-8000-00805f9b34fb
Characteristic UUID : 0000dfb1-0000-1000-8000-00805f9b34fb
Note, the above UUID were reported back by Android when I queried the Bluno. When I queried it from iOS, the Service/Characteristic were identified by:
Service : DFB0
Characteristic : DFB1
So how do you use these to communicate with the Bluno?
- Connect to the Bluno. I scan for devices that offer the above Service, and connect to that. (The device offering this particular service will be a Bluno!)
After connecting to the Bluno, the app needs to subscribe to notifications on the above Characteristic. This subscription is needed to receive data back from the Bluno.
- To send data to the Bluno, write the data to the above Characteristic
- When data is received from the Bluno, the App will receive a notification via the Characteristic subscription that we did on connection.
On the Bluno Side:
- To send data to the App, write it to Serial (e.g. Serial.write() )
- To receive data from the App, check for it on Serial (e.g. Serial.available(), Serial.read() )
That should be the main pieces of information you need to start talking to the Bluno!
For my app, I bought an asset from the Unity Asset Store (for about $10) which wrapped the iOS and Android Bluetooth GATT APIs into a platform independent API. I then used this library for doing communications between the Unity app and Bluno. (This enables me to deploy the Unity app to both iOS and Android.)