This tutorial demonstrates how to connect two BLE sensor devices, and chart accelerometer data to a single iOS or Android smartphone. We’re extending the accelerometer example to serve two peripheral devices, an older TI SimpleLink CC2541 and a newer Simplelink CC2650, also from Texas Instruments. All the code you’ll need is found below, and released under an open (Apache v2) license. A device with
support for Bluetooth 4.0 and Android 4.3+ or iOS 7+ is required.
There is no defined upper limit…
Of the number of devices you can connect in theory, there is no upper limit. It’s more about the data throughput from each device multiplied with the number of peripheral devices. So with say typically 300 kbit up to a theoretical megabit per second or so to go around, it’s a finite number. This tutorial focuses on just two devices, picking up three data streams (x, y and z accelerometer values) gives us six notification streams.
Download the Evothings Studio
You can skip to next section if you already have Evothings Studio and are familiar with how to fire it up.
Follow these steps:
- Download and install Evothings Workbench on your computer. Generate an anonymous Cloud Key, found further down on the download page, and paste it into the Workbench software.
- Download Evothings Viewer app from an appstore (iOS,Android)
- Open Evothings Workbench and click on the GET KEY button
- Open Evothings Viewer app, provide your connect key and tap CONNECT
- Once the connection is successful, go to “Examples” tab and click the “Run” button for the “Hello World” example or some other example you find interesting, to test the toolchain.
You should see your example app loaded into the Evothings Viewer; that is how the whole development suite works together, whatever changes you will make in your app code, the Evothings Workbench will reload the app in Evothings Viewer, allowing you to preview your changes in real time!
Step 2: Running the example app
Download the dual sensor tag example [ble-ti-sensortag-dual-demo.zip], unzip it and drag-drop the index.html file into the Workbench window. The example shows up on top of the list of apps. Now press RUN and see the app load on the mobile device. Activate the sensor tags and tap the Connect buttons in the app. If everything works ok, the tags are discovered and accelerometer data is plotted to the canvases. Shake your SensorTags to see the plots change.
On Android, there are sometimes problems with that BLE stops working when
switching between apps or doing multiple reloads. In this case restart
the Evothings Viewer app. Additionally, you can use the Evothings
Workbench Console to see any error messages that may help in your