Use WICED Sense from Intel Edison
WICED Sense that there is a device. This is the BLE tag that Broadcom is making. In addition to BLE, the following five MEMS sensors are installed.
- Triaxial gyro
- Accelerometer
- Orientation
- barometer
- Humidity, thermometer
I photographed Intel Edison and WICED Sense on Mac Book Pro 13Inch. I think that you can understand the small size.
You can buy it from here from here. It is one 2450 yen. (But, I have been sold out now) http://www.macnicaonline.com/SHOP/BCM9WICED_SENSE.html
When you buy, plastic for preventing electrification is caught in the battery box inside the main body, so take it first. (I am addicted here w)
Try connecting from a smartphone
Install the app named "WICED Sense" from google play. Because I am using Nexus 5, it is an Android application, but even on iPhone, the application is out.
When launching the application, Bluetooth turns on and Scan starts. So tap when WICED comes out. (Maybe you need to first wakeup the button above first)
- Tap Connect
- Press the button under WICED Sense
The connection is completed as soon as it is short as "bu". Information such as battery capacity and temperature will be displayed on the screen.
It is displayed like this.
Since firmware has been updated, select "Check for software updates" from the menu and update to the latest version. It's noisy "Bububu", but it will be completed in around 30 seconds.
Let's continue from Intel Edison.
Try connecting from Intel Edison
Let's use WICED Sense from Intel Edison.
First of all, log in to Edison and let bluetooth be enabled with the following command. (I will not explain how to log in to Edison here)
rfkill unblock bluetooth
Treat from cylon
cylonjs that there is a node library. This is to control various things such as Aurdino in JavaScript. This corresponds to WICED Sense.
In order to connect to WICED Sense, you need to install the following three node packages in Edison.
- Npm install noble
- Npm install cylon-ble
- Npm install cylon-wiced-sense
Take information
The following code to save on Edison, node get_info.js and run with.
var Cylon = require('cylon');
Cylon.robot({
connection: { name: 'bluetooth', adaptor: 'central', module:
'cylon-ble', uuid: '207377654321'},
devices: [{name: 'battery', driver: 'ble-battery-service'},
{name: 'deviceInfo', driver: 'ble-device-information'},
{name: 'generic', driver: 'ble-generic-access'},
{name: 'wiced', driver: 'wiced-sense'}],
display: function(err, data) {
if (err) {
console.log("Error:", err);
} else {
console.log("Data:", data);
}
},
work: function(my) {
my.generic.getDeviceName(function(err, data){
my.display(err, data);
my.generic.getAppearance(function(err, data){
my.display(err, data);
my.deviceInfo.getManufacturerName(function(err, data){
my.display(err, data);
my.wiced.getData(function(err, data){
my.display(err, data);
});
});
});
});
}
}).start();
With the feeling like the following, data will come out steadily. Connecting at the, you may need to press the up button.
I, [2014-11-14T13:38:26.496Z] INFO -- : Initializing connections.
I, [2014-11-14T13:38:26.511Z] INFO -- : Initializing connection 'bluetooth'.
I, [2014-11-14T13:38:26.780Z] INFO -- : Initializing devices.
I, [2014-11-14T13:38:26.782Z] INFO -- : Initializing device 'battery'.
I, [2014-11-14T13:38:26.788Z] INFO -- : Initializing device 'deviceInfo'.
I, [2014-11-14T13:38:26.790Z] INFO -- : Initializing device 'generic'.
I, [2014-11-14T13:38:26.792Z] INFO -- : Initializing device 'wiced'.
I, [2014-11-14T13:38:26.823Z] INFO -- : Starting connections.
I, [2014-11-14T13:38:26.827Z] INFO -- : Connecting to 'bluetooth'.
I, [2014-11-14T13:38:30.841Z] INFO -- : Starting devices.
I, [2014-11-14T13:38:30.843Z] INFO -- : Starting device 'battery'.
I, [2014-11-14T13:38:30.846Z] INFO -- : Starting device 'deviceInfo'.
I, [2014-11-14T13:38:30.849Z] INFO -- : Starting device 'generic'.
I, [2014-11-14T13:38:30.851Z] INFO -- : Starting device 'wiced'.
I, [2014-11-14T13:38:30.854Z] INFO -- : Working.
Data: WICED Sense Kit
Data: { value: 'Generic Tag', description: 'Generic category' }
Data: Broadcom
Data: { accelerometer: { x: 1, y: -1, z: 82 },
gyroscope: { x: -26, y: -78, z: 203 },
magnetometer: { x: 842, y: -523, z: -2101 } }
Data: { accelerometer: { x: 0, y: -3, z: 83 },
Data: { accelerometer: { x: 0, y: -2, z: 83 },
gyroscope: { x: -24, y: -150, z: 261 },
magnetometer: { x: 850, y: -532, z: -2099 } }
Data: { humidity: 618, pressure: 10155, temperature: 245 }
Let's send this obtained data with MQTT.
I will send it on MQTT
For sending with MQTT, mqttcli is useful. Since binaries already built are distributed in drone.io, we will get the file for linux_386 as follows. (Chmod is required)
curl -O https://drone.io/github.com/shirou/mqttcli/files/artifacts/bin/linux_386/mqttcli
chmod ugo+x mqttcli
And, to ~ / .Mqttcli.Cfg MQTT as a Service: sango we have described the information obtained in.
{
"host": "sango.mqtt.example.jp",
"port": 1883,
"username": "shirou@github",
"password": "BLAHBLAH"
}
After that, if you feed the standard output of the node earlier, you can receive the data from anywhere.
node get_info.js | ./mqttcli pub -t "shirou@github/edison" -s
After that, I will thrust into the DB and send an alert, you can tamper as I like.
Summary
There are BLE tags equipped with various sensors called WICED Sense. I handled this from Intel Edison. Furthermore, I sent the obtained data with MQTT.
Intel Edison is compact, can be placed anywhere, and WIFI is also large. WICED Sense is also small and very handy. Furthermore, by combining MQTT, it became possible to handle sensor information with ease.