Homemade Environment Sensor + Bluetooth little brother. Here are new possibilities

I just make what I called Bluetooth proxy functional up to the point I can talk to a couple devices.

Here is a video what It can do.

The proxy can handle BLE Advertisement and BLE GATT write functionality. My goal is to build the proxy at GATT level so that it can support wider devices. Currently, It work with the following sensors.

The BT proxy as seen on the demo will be my gateway to sensors like Xiaomi.

It will also replace my current bed control. I have an old notebooks that work as Bluetooth proxy 3+ years ago. It is closer to be decommission with much smaller version of it.

There are a few things that I am working on the proxy to get it ready. Especially the read (or perhaps subscription to GATT notify). My goal is to be able to have some generic Bluetooth API so that we can write DTH to communicate with Bluetooth sensor with out the complexity dealing with lower level Bluetooth implementation at the MCU. After that, I will be open to share the module with pioneers.

The module speak Serial ports. So, the older Environment sensor is not the only one that can be used as a tunnel to the hub. But, the Environment sensor has features that would make the Bluetooth module more robust from start such as battery backup. There is always other consideration. I am open to idea. The USB connector is fully functional in this bluetooth module. It will look like serial port to a RPi. This is another way to expose it.

13 Likes

Just an update. A new alternative board is tested. This board use LAN connection to tunnel the Bluetooth BLE data.

It runs Arduino. I have more of these around the house. I am staring to be able to do some tracking using beacons.

5 Likes

A short demo on tracking Bluetooth beacon.

Here is the dasboard look like if it is not clear from the demo.

Tracking a beacon require processing the RSSI value. It is more appropriately called filtering the RSSI reading. Kalman filter is an ideal filter. I cannot implement it just for a demo. I could have used a Java math library implementation. However, hubitat does not include the library.

As an alternative, I use IIR filter. This is not an ideal filter for RSSI data. For the demo, we just have to make it work. I mentioned the filter as it is one of the most important thing to implement. It is probably the most tricky part to get it right. A lot of us give up on Bluetooth tracking because we are not filtering the data. It would be hard to get lock on the beacon location without any filter.

4 Likes

Iman - this is really neat! I can see using this to do room-by-room presence!

3 Likes

Yes, I do not have too much idea on what I am going to do.

It is just a way for me to learn Bluetooth. I want to be more familiar with it and see what is different from Zigbee. I can start to see where they differ.

It seems Bluetooth is built from ground up (at least until 4.x) to be really good at short distance connection. I am surprise that Bluetooth can somewhat be good at resolution of a few feet accuracy.

Compared that to a Zigbee device, I would not have been able to do what I did on the demo with a Zigbee module made to a beacon. Zigbee presence application is more of house to house accuracy rather than room to room.

1 Like

If you produce/sell those BTLE daughter boards for your environmental sensor, then I can definitely see using this to do room-by-room presence!

1 Like

An example of nicer beacon than I am using.

https://www.amazon.com/2V-3-3V-NRF51822-Bluetooth-Wireless-Intelligent/dp/B083116NZB/ref=sr_1_13?crid=HJ6FFY1UVVN7&dchild=1&keywords=nrf51822+beacon&qid=1591385438&sprefix=nrf51822+be%2Caps%2C219&sr=8-13

If you do not mind looking at ebay and aliexpress, there is a cheaper one.

3 Likes

Okay this is awesome..... I think I'm going to have to learn a bit more here... Especially possibly getting my adjustable bed connected like that... That would be super awesome...

Can't believe I missed this! Thanks to @aaiyar for posting the link in another thread. Very interesting. As long as this will work with my Android watch... When can I throw my money at you?! lol

I already use two env sensors from you and they work great.

3 Likes

Iman - I have the same feeling as @bptworld!

2 Likes

I just want to up date you guys on this journey.

Ble gateway is functional. However, BLE data depending on what you are looking at can be very chatty. The advertisement data that you can use as beacon comes in much more than what ZIgbee data is.

I use this on my hub. I do see a bit of sluggishness on the hub. It is not enough to bring down my hub. It could be that I will have to develop much more sophisticated filter so the data would not pass as is to the hub. I have done a primitive filtering such as repetitive packet. I already drop those. It is just we are dealing with much higher volume of data with BLE.

I am not sure any android can be tracked. I got this information second hand. I am told that the mac address for android device is obfuscated. If this is the case, it would be hard to track phone, watch or any android or iphones. The beacon demo use plain Nordic beacon. The mac stays regardless what you do to it.

If @bptworld & @aaiyar can try to look into android and apple use of Bluetooth while I am looking into improving the filters, we should be able to huddle up latter on to see whether smartphone tracking make sense.

The existing smart phone tracking may work in reverse. You can install the modules that I am working on. The module can be a beacon and a gateway at the same time. If you have multiple gateway, now your phone or watch can wake up at certain interval and then determine its location based on how close it is to a gateway/beacon.

Thanks
Iman

3 Likes

Found a very interesting read about beacons and phones/smartwatches.

OK, me too!

1 Like

Just an update. Thanks to a community member @randall.rounds for introducing Tilt Hydrometer to me. It is such a perfect sensor to show case the use of Bluetooth device.

Tilt is a tool for Homemade brewer and wine maker to help monitoring beer or wine fermentation. This is a sensor that is not available in Zigbee or Z-wave. This is why I am quite excited to bring bluetooth to Hubitat. Tilt is one of the easier bluetooth protocol to work with.

As a background, Tilt measure gravity and temperature. I borrowed this sensor so I do not want to get it wet.

But, if you would like to know how it work, you can watch this short video.

Here is my attempt is to bring Tilt to Hubitat. Thanks to @thomas.c.howard for hubigraph. It is part of the action below.

With Hubitat, we can take your brewing and wine making beyond just recording data and graphing. We can add rules to monitor any issue during the fermentation. As you can see on the graph on my testing, there are peaks which should not be expected in the real world use. I suppose someone could have bump to the wine barrel. As a wine maker, you may want to know that. I am guessing that writing a rule machine and send us notification should be easy. Once the data is in Hubitat, your imagination is the limit.

Thanks to @randall.rounds . I will send you a Bluetooth module. You will be the proud owner serial 0001 of the module. This is the first Bluetooth module that I ship out. Please take it easy with it. I will send you DTH and instruction on how to set it up.

I also want to take this opportunity to invite some member here with idea using Bluetooth devices as a try out. I have limited (not a lot of) these modules. If you have interesting idea, I will be happy to work with you to show case those ideas.

Thanks
Iman

2 Likes

Dude you are amazing. Most of the stuff you post is way over my head. But I feel smarter for having read them. :smile:

1 Like

You tease! When will these be available? Put me down for 2 to start.

1 Like

@LosinIt, at this point the module work quite stable with Bluettooth advertising data. A few device such as beacon obviously operate this way. The Tilt is actually another form of beacon (iBeacon/apple beacon). Xiaomi is a hybrid of which broadcast as well has uni-cast connection.

The uni-cast connection still need some work for stabilizing.

This module require DTH written for specific device that you want to bring into Hubitat. Let me know what you have in mind. Perhaps, I can jump start your idea. But, It could potentially harder if you start from nothing.

Thanks
Iman

2 Likes

Well, each of my vehicles has a beacon from State Farm insurance that I'd like to use for presence. What do you need to know about these beacons? I'll try to find it.

Do you use Android? There is an app called nrfConnect. It is from Nordic semiconductor. They are quite reputable. You can scan for the beacon. There should be a raw data. If you can send it to me, I can try and let you know if it is something do able.

2 Likes

Why yes I do! I'll grab the app and report back in the morning. Iman, you rock!

1 Like