Skip to content

1 Setup and Run

0Alic edited this page May 30, 2018 · 5 revisions

Setup

Beacons (or tags)

In case you are using the RadBeacon dots, you can configure them with the proper application. Our beacons have the following settings:

  • Measured Power: -66
  • Advertising rate: 5 / sec
  • Transmit Power -3 dBm

Stations

Give a unique identifier to each station: write the id in the field "id" of station.json.

(Brief note: we use the following pattern: 03ffHH where H is an hexadecimal character. Be aware, if you change the pattern you will need to change the bot properly since it defines a regex which matches that pattern for the purpouses of adding/removing a station.)

Connect all your stations to your home network. Connect the server as well and write into all the station's json file (station.json) the IP address of the server in the "broker_ip" field ("broker" because the server hosts the MQTT broker).

Server

Into server.json write the IP as well in the fields "server-ip" and "broker-ip". Still in server.json write into the field "positions" the map <stationId, roomName> of your stations (or add them therafter with the bot). The server connects to a remote database as well: if you don't need it just comment the proper line in the python file of the server (TODO linkare il file); otherwise write in the json file your credentials.

Run

(Brief note: at the moment the station.json file shows the MAC addresses of our test devices. For a quick check, you could write there the MAC addresses of your own devices, or you can add them with the bot thereafter. The user's map <MAC, name> should be added in server.json as well in the field "devices". Let's suppose for a moment you have valid entries in the json file.)

Command to run the stations:

sudo python station.py station.json

Command to run the server:

python server.py server.json

Turn your BLE devices on, run the script analyzer .py on the server and sniffer .py on each station. The stations will filter and send to the server only the RSSi of the devices present in their json file (the sent message is written in the stdout as well for debug). The server will collect the RSSi, build a map and periodically perform the triangulation: the result of the triangulation is printed on the stdout.

NOTE: check with hcitools command if the stations can see their bluetooth module/dongle; in case the stations can't, then run the following commands:

sudo ls cat sl quello che fa sempre luca

Interact with the system

It is possible to interact with the system by mean of a telegram bot. First create your bot at the BotFather (as described here), get a token for your bot and write it in a json file (we have our, for example). Run somewhere (also in the same device of the server if possible) the bot like this:

python helpbot.py *file_with_your_token.json*

The bot should describe you how to interact with it in order to modify your localization system (for example, add a new user, add a new room, get the user's locations etc).

If you don't want to add by hand users in the json files of both staton and server, you can do it with the bot (we expect the real user doing in this way 🌞).