I have a BLE beacon that have some sensors embedded. This beacon should read every minutes all the sensors value and update the characteristics. These characteristics have theirs notifications enabled.
In the other side my phone should read these characteristics, analyze them and notify the user if something wrong.
The beacon has his own embedded RTC (real time clock) that trigger an interruption to inform the beacon that minute has passed and he should start reading sensors data and update characteristics values.
This beacon work on battery and I'm worried a lot about the power efficiency. The most things that i'm worried about is the antenna transmission and reception which consume a lot of power compared to the rest of the system.
So I'm looking for a method to save power. My idea is to limit the antenna transmission and let the antenna in inactive mode and only active it once per minute when the beacon should read the sensors value and update the characteristic value.
Is that possible to do that without loosing connection between the beacon and my phone. And how the phone know exactly when he should listen to the updated characteristic values.
For example if the beacon and the phone are working fine and exchanging data every minutes , in case I move away with my phone for example for 30 minutes and I come back did the connection reestablish automatically ??
in the actual situation when I move away from the beacon from my phone for 5 seconds or more I lose connection in both side.
Is there any communication method that save my beacon power consumption ?
My BLE beacon chip is the nrf51822.
All your suggestions/idea are welcomed.
Consider not creating a connection and instead make nrf51822 send the sensor data in ADVERTISE packets once every minute.
Related
I am trying to evaluate the suitability of some different wireless interfaces for our project on 2xRaspberry Pi 4 and currently I’m evaluating Bluetooth Low Energy. Therefore I have written an Central and Peripheral device application with the Qt framework (5.15). In my case the latency time between messages is important, because of some security aspects. The message size of each command is around 80-100 Bytes. In one of my tests I have sent 80 Bytes commands every 80ms. Ideally the messages should be received on the other device in 80ms interval as well. For the LAN (TCP) interface this test works well.
For Bluetooth Low Energy I observed that messages, which are sent from Peripheral to Central work quite good and I measured no big delay. Different results I got for the Central to Peripheral direction. Here, I have received the messages in the interval of 100ms to 150ms really exactly. It seems that there couldn’t be a very big magic behind it, so is there any plausible explanation for this? I tested it with a Python script as well and I observed the same results. So it seems that the Qt implementation shouldn’t be the problem.
During research I found out, that the connection interval may influence this, but in Qt the QLowEnergyConnectionParameterRequest (QLowEnergyConnectionParameters Class | Qt Bluetooth 5.15.4) doesn’t work for me. Is there any command, where I can set the connection interval for test purposes at the command line on Linux?
Kind regards,
BenFR
It is possible that your code is slower from central to peripheral because WRITE is used instead of WRITE WITHOUT RESPONSE. The difference is that WRITE waits for an acknowledgement, therefore slowing the communication down, while WRITE WITHOUT RESPONSE is very much like how notifications/indications work in that there's no ACK at the ATT layer. You can change this by changing the write mode of your application and ensuring that the peripheral's characteristic supports WriteNoResponse.
Regarding changing the connection interval, the change needs to be accepted from the remote side in order for it to take effect. In other words, if you are requesting the connection parameter change from the peripheral, then the central needs to have code to receive this connection parameter change request and accept it.
Have a look at the links below for more information:-
How does BLE parameter negotiation work
Understand BLE connection intervals and events
The different types of BLE write
You can set the interval of Bluetooth Low Energy advertisement (20ms is the shortest).
Is there a way to advert one time only?
I tried stopping advertisement just after starting the advertisement but sometimes two advertisements are done.
I'm using bleno node.js library.
No there is no such thing even in the HCI protocol. You can maybe set a large advertising interval, start and then stop within this time.
I have a small BLE beacon which is configured to send iBeacon packets every 1000ms.
In my usecase i want to detect the signal on multiple recievers every time it is sent. However the detection is not reliable no matter which receiving device and software i use (phone, computer, raspberry). The signal is sometimes detected after 2 seconds, another time 5, 6 or whatever. It seems like there is no pattern behind it.
Also it seems that sometimes the signal is received on one receiver but not on the others while definetly being in range! Also the area i am testing in is not "problematic".
What could be the problem?
Not 100% of beacon packets transmitted are ever received. There are a number of reasons for this, including radio noise, packet collisions and channel hopping. That said, the typical detection rate in a quiet radio environment is around 90 percent.
If you are seeing a much lower rate than this on multiple receivers I would check the transmitter. First, use one of.your devices to transmit a software beacon (Android and iOS have free apps like Locate Beacon that do this.) If you get a higher detection rate with a different device transmitting, the issue may be your transmitter.
A few possible issues with it:
Bad antenna sending out a very weak signal. (Measure the received RSSI when you do get a detection and verify it is over -60 dBm)
Weak transmitter power setting. See if you can configure this higher.
Advertising on wrong channels
Advertising is stopped before packet can go out. Try to leave the advertiser on for at least 2x the transmission rate to ensure at least on packet gets out.
I assume you use a large enough scan window for your scan interval so your receiver radio is actually turned on most of the time.
You could try to send advertising packets of the type ADV_NONCONN_IND (non-connectable and no scan response packet). That way if the receiver radio scans with 100% duty it should see the packet.
Otherwise if you use normal ADV_IND packets, then at least Android always waits for the SCAN_RSP packet before it sends anything to the scanning app. But if the are multiple scanners nearby, your peripheral can only respond to a single scanner's SCAN_REQ for each advertising packet. To avoid collisions of SCAN_REQ packets in the air, Bluetooth controllers also back off if they don't get a SCAN_RSP in return. If you use a BLE sniffer you can see all three kinds of packets and what happens when you have multiple scanners nearby.
Read the BLE Link Layer part of the Bluetooth Core specification for more details.
The BLE IPSP (Internet Protocol Support Profile) specification requires that "nodes" support the GAP Peripheral role, while "routers" support the GAP Central role. This means that end-nodes will beacon and routers will respond to those beacons.
This seems like the opposite of WiFi, where routers beacon and end-nodes respond to those beacons. What's the rationale behind swapping that role for BLE IPSP? It seems like it would be more battery efficient to have the end-node listen for beacons instead of transmitting beacons.
Scanning is way more power demanding than advertising. When advertising, you only have to turn on the radio a few hundred microseconds to send the packet, and then go back to sleep. Scanning requires the radio to be turned on the same fraction of time as you want probability a packet should be captured.
You are however correct that the logic seems to be a bit opposite to how wifi setup works. I guess that's because peripherals usually don't have a display and user interface to select which router to join.
I am programming Nordic devices as BLE peripherals. My smartphone acts as BLE central. I would like to transmit data from my smartphone to all the devices one after the other.
Is it possible to compute the time that the smartphone requires to jump from one connection to the other?
Knowing the BLE throughput and the time needed to jump from one connection to the next one, I could compute the time that the whole process would take. Nothe that I do not want to connect all the devices at the same time but one after the other.
Best regards