Private BLE Beacons with nRF52840



  • Thanks to the thread Everything nRF52840 from NeverDie I found the courage to start a project for developing my own Beacons based on the Bluetooth Core Specification 5.2, Volume 6. The idea is also, to use broadcasts for providing sensor data to any interested listener in my home network. For this I defined a PDU with 12 measurement values of 16 bit and some additional management information. The result is a BLE advertising packet with the maximum payload of 31 bytes.

    My development environment is Eclipse/Sloeber (Eclipse C++ with an Arduino Plugin) and an Arduino Nano BLE 33. I do not use the mbed-OS nor the BLE library of the Nano board, but started to program the nRF52840 directly.

    The current hurdle is to receive data with the smartphone. I programmed a BLE-Scanner on Android and tested it with some bought Beacons by displaying the address, the rssi-value and the payload bytes (I hope, I can trust the getBytes-function of the accordingly subclass in ScanResult, because the data of the bought Beacons seem to be encrypted).
    But my Ardunino board is not seen.

    Does someone know, whether the BLE-Scanner of Android detects simple advertizing packets (not scannable and not connectable)?

    My next step will be to program a scanner with the Arduino board to prove, that my advertiser is running.


  • Mod

    For iOS, I use https://apps.apple.com/us/app/bluecap/id931219725
    It does not seem to be available for Android unfortunately but https://play.google.com/store/apps/details?id=uk.co.alt236.btlescan&hl=en&gl=US seems to offer similar functionality.



  • Hello @mfalkvidd ,
    thank you very much for the valuable link to the Android app, which I followed further to the sources on Github. It seems, that the author uses other vocabulary for the features of BLE than those described in the BLE specification (v 5.2), which makes it difficult for me to understand his program at once. The libraries I used are part of the IDE (Android Studio) and offer similar resources.

    I just started to develop a scanner based on my Beacon software for the Arduino Nano BLE 33. As soon as the radio data exchange between two Arduino boards is running, I will care again for the Android app.



  • I'm happy, finally I got it working. Not all, what I wanted, but at least I detected the limits.

    So for those, who are interested in direct programming the nRF52840 on the Arduino Nano BLE 33 (ask me if you have questions about that):

    My Scanner (on the Nano) runs perfect and detects all Advertisers around (a Beacon from EM Microelectronic, the default Advertiser of the Nordic nRF52840 DK and my own private Beacon on the second Nano).

    But ... my Android App does not detect my private Beacon. And now I can see the difference. The EM Beacon does scannable and and connectable advertising (pdu type ADV_IND) and the Nordic does scannable (pdu type SCAN_RSP). My own Beacon does non-connectable and non-scannable advertising (pdu type ADV_NONCONN_IND), which is obviously ignored by the Android BLE library (and I do not know, how to make that working or if it is possible at all).
    I tested several scanner Apps on Android and they behave the same way as my App. So it seems to be a fundamental problem and I will have to wait for an Android expert.


  • Banned

    Does it only work for Arduino nano? I have an Arduino UNO board and I don't know if I can achieve the same function.


  • Hardware Contributor

    @Ivanli said in Private BLE Beacons with nRF52840:

    Does it only work for Arduino nano? I have an Arduino UNO board and I don't know if I can achieve the same function.

    Only on Nano BLE 33 not on classic nano which has no Bluetooth connectivity 😉



  • Update

    Meanwhile I made progress with my project. Together with some colleagues I want to install a real-time measurement system with more than 30 channels (i.e. 30 Nano BLE 33 measuring accel. and gyro.) and one evaluation unit (another Nano BLE 33 combined with other computers). The 6 values (2*x,y,z) of 16 Bit each shall be transmitted with 10 measurements per second.

    Instead of spontaneous sending beacons with new measurement values from the 30 devices (to many collisions, real-time simply not possible) I use a master-slave polling, done by the evaluation unit. And I continue using non-connectable/non-scannable BLE-Beacons, for the request messages and for the response messages.

    Meanwhile, my beacons can be detected by typical BLE scanner APPs on my smartphone (Android 10). I do not know, why that did not work at the beginning. May be I corrected some mistakes incidentally in the last months.

    I am working also on a channel hopping (in case of disturbances by other devices with BT and WLAN) and using more channels for higher measurement speed. But the implementation of that will start later.

    8 hours later

    Now I found a reason for the behavior of the Scan-APPs: My request beacons (without data, only user address of 6 bytes) are detected, but not the response beacons with data.
    I do not need the smartphones now (the speed of about 500 beacons per second is to fast for them), so I am happy with my solution.


Log in to reply
 

Suggested Topics

  • 87
  • 10
  • 6
  • 7
  • 3
  • 2

50
Online

11.4k
Users

11.1k
Topics

112.6k
Posts