Bluetooth protocol
Everytime I search something in the opensource community, a quote from Isaac Newton comes into my mind
"We are dwarfs on the shoulders of giants"
It's unbelievable the health of information is available for you to give form to all your ideas!!
I was looking for an Android application that I could use as a starting point. The main requirements were very simple
- Connect via Bluetooth to the AirMobile sensor
- Cache data local visualization
- Push data to the AirVantage cloud through MQTT
I was very lucky because I found an application that also met my idea about the Bluetooth protocol (see my post here) The application Bluetooth protocol is a very simple one-way (from sensor to application) procotol and so I decided to adopt it for the AirMobile sensor.
Here is the protocol specifications:
<Measurement value>;<Sensor package name>;<Sensor name>;<Type of measurement>;<Short type of measurement>;<Unit name>;<Unit symbol/abbreviation>;<T1>;<T2>;<T3>;<T4>;<T5>
- The Sensor package name is the external sensor name (in this case "AirMobile")
- The Sensor name should be different for each sensor.
- Type of measurements is a string that identifies what we are measuring
- Short type of measurement is used (in my case) internally to identify the dataset to update in the AirVantage cloud
- T1..T5 are integer thresholds which guide how values should be displayed -
lower than T1 - extremely low / won't be displayed - between T1 and T2 - low / green
- between T2 and T3 - medium / yellow
- between T3 and T4 - high / orange
- between T4 and T5 - very high / red
- higher than T5 - extremely high / won't be displayed
Just to give an example, the AirMobile sensor will send out strings like this
23.5;AirMobile;TMP36;Temperature;temperature;degrees Celsius;°C;-40;-10;30;40;60 55;AirMobile;HIH4030;Humidity;humidity;percent;%;0;25;50;95;100"); 10;AirMobile;TGS2442;CO ppm;co;ppm;ppm;30;40;100;500;1000 20;AirMobile;MiCS-2710;N02 ppb;no2;ppb;ppb;200;200;500;1000;2000 100;AirMobile;SharpGPY;Dust;dust;ug/m3;ug/m3;0;10;300;490;500