gustavoaca1997 / bluetooth-server-vent

A Bluetooth Server intended to be used for an Emergency Ventilator (E-Vent).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bluetooth Server for an Emergency Ventilator (E-Vent)

Instalation

OS Dependencies

Warning: The order of the following steps is not guaranteed to be succesful, neither every step is guaranteed to be necessary. TODO: Improve these steps.

sudo apt-get install bluez bluez-utils
sudo apt-get install python-dev
sudo apt-get install libbluetooth-dev

Solve bug starting a SDP server

Follow these steps for successfully starting the bluetooth server.

Python dependencies

See requirements.txt

Usage

Start Bluetooth server with

python server_uuid.py

If you get bluetooth.btcommon.BluetoothError: no advertisable device error, please run the following command to make the device discoverable:

sudo hciconfig hci0 piscan

Then from your Android App scan to find the server and then connect to it. You can now send bytes as messages. The server was implemented to parse JSON messages that are similar to this one:

{
    "RR": 8,
    "TV": 200,
    "I/E": [1, 2]
}

Each field corresponds to one of these parameters:

  • Respiratory Rate (RR) (breaths per minute): between 8 – 40.
  • Tidal Volume (TV) (air volume pushed into lung): between 200 – 800 mL based on patient weight.
  • I/E Ratio (inspiratory/expiration time ratio): recommended to start around 1:2; best if adjustable between range of 1:1 – 1:4*.

You can send an "exit" message to kill the server. Any other kind of message will be ignored or raise "Parsing error".

Tested app

The server was tested with the app Serial Bluetooth Terminal, whose UUID is "00001101-0000-1000-8000-00805F9B34FB", that is why that UUID is written in the script code.

Inspiration

This script is supposed to evolve into a Raspberry Pi program that will be used to implement a ventilator inspired on the MIT E-Vent.

The script was inspired on this example, using the PyBluez library.

The communication between the controller Android app and the server could be based on this open source Android app.

About

A Bluetooth Server intended to be used for an Emergency Ventilator (E-Vent).

License:GNU General Public License v2.0


Languages

Language:Python 66.6%Language:C++ 33.4%