Beacon position tracking

449 views
Skip to first unread message

Mauricio Miotto

unread,
Feb 2, 2017, 8:27:31 AM2/2/17
to Node-RED
Hi

I am not sure anyone have an idea, or perhaps the code ready and can share it, but I have an idea of developing a sample application to track a beacon position related to a raspberry pi.

The beacon would connect to the pi via bluetooth (or any other easier way), the pi would read the beacon signal strength (and if possible location - to the right or to the left), and display it in a web page with some sort of radar-like layout (the semi-circles on the page), showing the approximate position of the beacon on this radar form. The approximate beacon position would be defined by it's connection strength to the pi, and if possible, how much to the left / right it is related to the pi.

Does any one have it ready, or have a starting point idea? I am able to connect the pi to the beacon and read data from it, I am not sure which data should I be looking at.
I am also not sure how to show it on the web page.

Any help is appreciated.

Thank you.

Sebastian Barwe

unread,
Feb 2, 2017, 9:33:36 AM2/2/17
to Node-RED
Beacons normally work connectionless by just advertising.
So basically you just need to scan for BLE devices.
But the RSSI is directionless so you won't get information about left and right - you would need at least two raspberries then.

The advertising frame follows a convention like iBeacon or Estimote - so you need to decode this as well to estimate the distance.

regarding distance calculation see this SO thread http://stackoverflow.com/questions/20416218/understanding-ibeacon-distancing

Mauricio Miotto

unread,
Feb 2, 2017, 2:28:22 PM2/2/17
to Node-RED
I was able to install node-red-contrib-bleacon, but could not get any output from the scan-beacon node. I sent a ON message to it, it started to scan but printed nothing.

Any ideas?

Thank you.

Sebastian Barwe

unread,
Feb 2, 2017, 3:07:23 PM2/2/17
to Node-RED
what beacon are you using?

Gayatri Deshmukh

unread,
Jun 19, 2017, 10:26:54 AM6/19/17
to Node-RED
Hi ,

Can you please send me the node.js code to have more idea on this.

Walter

unread,
Jun 19, 2017, 11:37:36 AM6/19/17
to Node-RED
Hi,

i use the below python script to scan for beacons. The mac and rssi values of the beacons are published via mqtt. 
Here, i use it with the cheap orange pi boards.

A very interesting topic is the determination of the beacon position. I will try it with the neuralnet node (or tensorflow - sadly, no node until now), but 
currently i dont have enough scanners in the house. The map could be realized with the worldmap node...



#!/usr/bin/env python
import subprocess, time, os, sys
import time
import paho.mqtt.client as mqtt

client = mqtt.Client()
client.connect("<Your MQTT Server>", 1883, 60)

cmdstr = "btmon"
cmdstr2 = "hcitool lescan"
cmd = cmdstr.split(" ")
cmd2 = cmdstr2.split(" ")
last_rssi = 0

p = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
p2 = subprocess.Popen(cmd2,stdout=subprocess.PIPE,stderr=subprocess.PIPE)

for line in iter(p.stdout.readline, b''):
    g = 0
    if("Address:" in line.rstrip()):
    adar = line.rstrip().split()
adr = adar[1]
    if("RSSI:" in line.rstrip()):
        a =  line.rstrip()
        rssi = int(a.split("RSSI: ")[1].split("dBm")[0])
if abs(last_rssi - rssi) < 3:
continue
last_rssi = rssi

#        print adr + "-" + str(last_rssi)
    client.publish("beacon/kgga/" + adr, last_rssi) 


Reply all
Reply to author
Forward
0 new messages