This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Using BLE to automate gate opener

Our homeowners association has a gate which opens when a transmitter in the car is pushed. I would like to add a BLE device to the gate which would trigger the gate to open when it detects a vehicle it knows about. I imagine it consisting of two parts:

  1. A beacon placed in the car. This is easy to do with the SDK.
  2. A receiver of the beacon hooked to the gate electronics to trigger a relay to open the gate.

Are there existing applications that can be easily modified to support this scenario? Creating a beacon is easy enough but I wonder about support for receiving beacons using the SDK. Is this possible? Pointers to relevant documentation would be appreciated.

A related question would it possible to detect the built-in car bluetooth instead of a beacon or is the car bluetooth incompatible with BLE?

  • In addition, while "just" receiving beacons sounds super simple: "just" establishing a connection from the gate to the car to exchange some data isn't that much harder to implement.

  • I cannot resist and must give few more comments:

    1. Indeed there are standards for this, it's called Hash based OTP (HOTP) and Time based OTP (TOTP), google for RFC 4226 and 6238. There are good security schemes standardized under IEEE or NIST or other bodies for basically everything today and you should use only these unless you are professional with 10+ years of experience and pretty deep understanding of mathematical disciplines behind the cryptography (that's my opinion of course, you are free to invent whatever 32-bit scheme you want).
    2. Why you would do it this way when there already exist commercial products which are doing it more or less correct meaning BLE based bi-directional protocol end-to-end secure with symmetric or asymmetric keys stored in mobile phone and/or key fob? I'm now speaking about companies like Kewo/UniKey, ASSA ABLOY subsidiaries like Yale and HID Global...
  • Oh one more: the TOTP is pretty problematic to use for off-line systems. Unless your gate and keys will be connected to internet and synchronize the time several times a day with precise world clock it will be out of sync very soon (or you will spend more time on HW and FW calibration of RTC based time-keeping then you would spend on any other part of your DIY system;)

  • These are all great comments regarding security but back to the original question of receiving adverts I've heard two suggestions - 1. use a central and sniff on advertisements and 2. use a central and connect. I was hoping to avoid connecting just to keep things simple. Which of the examples would be most relevant to either option?

  • Well if you want to use Nordic stack (Soft Device) and you just want to listen to advertisements (and act based on captured packets) then simply start scanning and then wait for BLE_GAP_EVT_ADV_REPORT. For such naive system you would probably store some list of MAC addresses and expected payload and you will get both information from event data to compare (note that if you will use phones then MAC address is not the best thing because many devices - e.g. all iOS things - try to implement anonymity). That's all. If you really need whole FW project example where this simple construction is used then do fulltext search of BLE_GAP_EVT_ADV_REPORT string on all *.c files under \examples\ folder of given SDK version and you have bunch of examples in a second.

Related