Skip to content

An IoT-based indoor positioning system with BLE and data transferring with a server by MQTT protocol

Notifications You must be signed in to change notification settings

armanbarghi/Hand-Hygiene-Tracking-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hand-Hygiene-Tracking-System

About

In this project, we are going to use ESP as a BLE beacon and BLE stations, which beacons are monitored by stations through Bluetooth Low Energy. The stations send the data to the server through the MQTT protocol, so that the server collects the information as a database and sends the necessary commands through this protocol. We use Mosquitto as the broker of MQTT.

Libraries for esp32

  1. esp32 by Espressif Systems (Installation guide)
  2. NimBLE-Arduino
  3. PubSubClient

Documentation

To install Mosquitto Broker:

sudo apt install -y mosquitto mosquitto-clients

To make Mosquitto broker automatically start with the boot:

sudo systemctl enable mosquitto.service

Test the installation:

mosquitto -v

With just the MQTT code, the sketch uses 52% of program storage space, and using ble scanner example from the original library will use 78% of program storage space. So, we can't use ble and wifi at the same time. As an alternative solution we use another library from here that only uses 42% of program storage space.

If the connection to the MQTT server is refused, check the configuration file:

cat /etc/mosquitto/conf.d/standard.conf

It has to be something like this:

listener 1883
protocol mqtt
allow_anonymous true

Then restart the mosquitto.service:

sudo systemctl restart mosquitto.service

Installation

Step 1. Create a virtual environment.

python3 -m venv myvenv

Step 2. Activate the virtual environment (you can activate venv just by reopening the terminal instead of following commands).

# For Linux
source myvenv/bin/activate
# For Windows
./myvenv/Scripts/activate

Step 3. After activating your virtual environment, install the ipykernel for Jupyter Notebook.

pip3 install ipykernel

Step 4. (Optional) You can create a new kernel by the following command or just skip this step and select 'myvenv' kernel in step 6.

python3 -m ipykernel install --user --name=myproject

Step 5. Open a jupyter-notebook in VS Code by holding 'Ctrl+Shift+P' and selecting 'Create: New Jupyter Notebook'.

Step 6. Select your kernel

  • The one you created in Step 4.
  • Or just use this one: Python Environments -> myvenv (Python)

Step 7. Install all the required libraries specified in the 'requirements.txt' file.

pip3 install -r requirements.txt

About

An IoT-based indoor positioning system with BLE and data transferring with a server by MQTT protocol

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published