Multiple connections on one BLE beacon - bluetooth-lowenergy

I have a single BLE beacon and I try to connect to it with multiple Android phones in order to get the RSSI, and see who is the closest to it.
But, just after the first phone connect to the beacon (via a BluetoothGatt), the beacon never appears from the scan again in the scan results of the other phones, so they cannot connect to it too.
The only solution I see is to scan without connection and get the RSSI from the scan result, but I don't think that is an elegant solution.
Is there a way to have multiple connection to a single BLE beacon and get the RSSI ?
Thank you

It's up to the BLE device to decide if it supports more than one connection. If it only wants to support one connection, it can be programmed to stop advertising when a connection is established. From a client perspective, there's not much you can do about that. If you can modify the firmware in the beacon, you can add support for multiple connections.
Otherwise there is nothing wrong with using the rssi in the advertising packet (although you can't make use of BLE security (pairing / bonding)).

Related

Is there a way to broadcast UDP packets with ESP8266 without wifi connection?

My question is regarding an ESP8266 board and the ESP-touch technology.
ESP-touch uses the length field of a UDP package to broadcast wifi ID and PW through a device (like a smartphone) to the chip (like in my case ESP 8266).
I want to turn this around, more specifically:
I want the ESP8266 chip to broadcast UDP packets with some sort of identifier-number in the length field of the UDP packet, without beeing connected to any wifi connection. Then these UDP packets are recieved by an app on a smartphone so the identifier-number can be extracted and used on the smartphone.
I am relatively new to this topic and do not know if this can work.
When I try to find any information online they all say that the first step is to connect the chip to a wifi. But I don't want that. The smartphone and the chip don't know each other and are not connected in any way. So I want this type of "broadcasting" so that the smartphone can recieve the package without really beeing connected to the chip.
I guess there must be some way to make it function like I explained above, but I can't find a way how this can work.
I don't need the chip to send UDP packets explicitely, it can be any type of package. I took UDP packet as an example because there is already the ESP-touch technology which is more or less similar.
The important thing is that the package that I send has a field where I can put some identifier-number in (not encrypted), which can then be recieved by another device like a smartphone where this identifier-number is extracted.
For clarification: I don't need to use ESP touch or anything related to that. I only stated this technology as an example. I just want to achieve the behavior stated above and in the picture! :)
This is an example picture how I want it to work:
No, it's not possible to send any packages without being connected to the network. ESP-touch or TI Smart Config or similar technologies utilize Monitor mode. As the name suggests, in this mode one can listen for packages, but can't send them.
ESPNOW provides data flow between ESP devices without connections via router. It is another feature of the Espressive API. There are tutorials for ESP8266 and ESP32...
https://randomnerdtutorials.com/esp-now-esp8266-nodemcu-arduino-ide/ .. https://www.instructables.com/ESP32-With-ESP-Now-Protocol/

Is running HM10 on a soft-serial enable the Low Energy charecteristics ? If so, how can the UUIDs and GATT profiles be tweaked in this case ?

I've been tinkering with the HM-10 board for a few weeks now, trying to push data from phone to module and vice-versa. The ultimate goal was to enable the BLE mode and tweak with the characteristics and GATT profiles. I'm pretty new to this domain so can anyone help me out ?
And is there any way we can interface the HM-10 with the hardware rx-tx channel instead of soft-serial ?
Your question is still not very clear, but i think you mean sending AT-commands over BLE-radio.
To make this possible you have to change the MODE using serial connection.
In standard mode the device can only be configured over the serial connection (pins RXD and TXD) using AT commands.
AT+MODE0: It only accepts AT-commands over the serial connection (RXD/TXD)
until a central device connects to the module.
AT+MODE1: Same as MODE0, once a connection is established,
AT-commands can be sent over BLE and manipulate some PIO pins on
the device.
AT+MODE2: Same as MODE0, once a connection is established,
AT-commands can be sent over BLE.
To test it just send a string to hm-10 as "AT\r\n" and it will respond with OK.
Update:
You cannot change the services and characteristics with AT-commands.
There are a lot of other things you can change,like advertising, setup a beacon and change a lot of settings.
For a full list of AT commands and more see the official data sheet:
http://www.jnhuamao.cn/bluetooth41_en.zip

How to spoof individual BLE packets

I'm doing a security analysis project on an IoT device that uses an unencrypted BLE connection (with ATT protocol) and I want to spoof an individual BLE packet with the source address of an already connected device. Is there some tool or API that would allow me to do this easily? I've already tried gatttool and spooftooph but they seem to be connection based and don't allow you to send out single packets with modified fields (as far as I could tell).
You will need some hardware where you can access the radio peripheral directly. What you basically need to do is to find or write a ble sniffer firmware, with the modification that it at a given moment sends a packet on the connection it is currently listening to. But note that the signal strength must be stronger than the original device's signal so it doesn't interfere.
The only open source project I'm aware of is Ubertooth. You will also be able to do this with an nRF52 but then you need to write your own sniffer firmware since Nordic Semiconductor's is closed source.
I can't comment on Emils reply yet, < 50 rep:
Nordic Semis nRF Sniffer v2 needs only the nRF52DK and wireshark to work as a general BLE sniffer. At 40$ it's not that expensive. I know for a fact they will release a new dongle soon that will sell for ~10-15 bucks if you can wait a a month or two.

Can a peripheral can be connected to multiple centrals?

From this book it says
A peripheral can be connected to multiple centrals.
can any BLE module do this? More specifically can bluegiga 112 do it? If not what are the BLE modules that can work as a peripheral connected to multiple devices?
The same book also states
Once the connection is established, the peripheral stops advertising and the two devices can begin exchanging data in both directions
so if the peripheral stops advertising how will it accept more connections as mentioned above? How will other scanners detect this peripheral?
Tim Tisdall is correct. That solution works for specification 4.1, but not for 4.0. As you mentioned above, you cannot establish a connection with a device that is not discoverable, and since it stops advertising upon connection establishment, it is impossible to have a peripheral connected to multiple centrals.
Any peripheral BLE device can "broadcast" it's attributes/characteristic values in GATT profile. So, any central device interested in the value can potentially "connect" to the BLE peripheral to get that broadcast message. So, that's what i believe is a use case for "A peripheral can be connected to multiple centrals."
I don't think the peripheral stops advertising it's presence just because it's connected to a certain central device. Any device can still see it's presence when it does a scan.

Programming a BLE Beacon to connect with server

I am developing a solution where, Fixed BLE beacon detects a moving BLE device and sends the relevant data to the server using wifi/ethernet/etc. All the examples I have found have BLE beacons talking to the mobile phone which in my case isnt true. AFIK an embedded systems engineer can configure the fixed beacon to send data to server. BUT is there any ready to use solution that lets the beacon connect to backend? Thanks.
You mention having a "[f]ixed BLE beacon [detect] a moving BLE device". Understand that this is very different from the way an Apple-style BLE iBeacon works, which is a transmit only device. (I mention this because the question is tagged with ibeacon.)
What you are describing is probably better described as either a beacon scanner or a BLE scanner. My company has a Raspberry Pi-based product that can scan for beacons and take programmatic action based on detections. We have a blog post about how to make a beacon turn on a lamp using this device, but you could just as easily make it contact a server when a BLE device is detected.

Resources