Bluetooth 4.0 (smart / low energy) presence detection
Posted: Mon May 18, 2015 4:30 pm
After reading the Xtrusion post by 123unlock I got interested in BLE. Now I'm trying to create a presence detection system using a raspberry pi and BLE devices, but results are poor.
As a receiver I tried the LogiLink BT0015 (100 meter range), Conceptronic 1004108 CBT40NANO (100 meter range) and CSR 4.0 (20 meter range). As a transmitter I use a stickNfind.
I created a test script to receive uuid and rssi values for BLE devices I'm interested in:
This works well when the stickNFind is within 5 meter of the raspberry PI, any further and the PI will not detect the stickNfind anymore. There was no improved switching from a 20 meter BLE USB dongle to a 100 meter one. Strangely enough the 20 meter CSR 4.0 USB dongle worked best. Probably the stickNFind is the problem here.
If anyone is doing something similar or is interested in something similar please leave your comments. Thanks
As a receiver I tried the LogiLink BT0015 (100 meter range), Conceptronic 1004108 CBT40NANO (100 meter range) and CSR 4.0 (20 meter range). As a transmitter I use a stickNfind.
I created a test script to receive uuid and rssi values for BLE devices I'm interested in:
Code: Select all
var winston = require('winston');
var logger = new (winston.Logger)({
transports: [
new winston.transports.Console(),
new winston.transports.File({ filename: '/home/pi/bluetooth.log' })
]
});
var noble = require('noble');
noble.startScanning([], true);
var addressesToTrack = ['ec...', 'c0...'];
Array.prototype.contains = function(k, callback) {
var self = this;
return (function check(i) {
if (i >= self.length) {
return callback(false);
}
if (self[i] === k) {
return callback(true);
}
return process.nextTick(check.bind(null, i+1));
}(0));
}
noble.on('discover', function(peripheral) {
addressesToTrack.contains(peripheral.uuid, function(found) {
if (found) {
logger.warn(peripheral.uuid, ' ', peripheral.rssi);
}
});
});
If anyone is doing something similar or is interested in something similar please leave your comments. Thanks
