Hi there , shure. Glad to try and help.
SO I look at this repo and to me at first glance, it’s basically a BLE central waiting on a connection to a tag with a weight as the data? Close ?
What is this dev ESP-IDF?
anyway from what I know , are these two things and you can try this.
In the radio’s it only works BEST if both sender and receiver are set. or simply the Peripheral and the Central have max power set. You can try the Central only side and may get a tiny improvement YMMV. If it’s a proprietary pc board and layout, BE aware of the antenna area and placement matters.
in your repo file
eW_BLE.cpp , you’ll see this.
#include "eW_BLE.h"
BLEDevice central;
BLEService eWeightService("49cc6a9e-0fa3-493b-b290-e1ac59909dec");
void BLEinit(const char* deviceID, BLECharacteristic charIMU, int bufferSize, BLECharacteristic charWeight, int valueSizeWeight,BLECharacteristic charButton, int valueSizeButton)
{
if (!BLE.begin()) {
Serial.println("starting BLE failed!");
while (1);
}
BLE.setDeviceName(deviceID);
BLE.setLocalName(deviceID);
//byte data[5] = { 0x0e, 0x0e, 0x0e}; //doesnt work from arduino side right now
// BLE.setManufacturerData(data, 3);
BLE.setAdvertisedService(eWeightService); // add the service UUID
eWeightService.addCharacteristic(charIMU); //
eWeightService.addCharacteristic(charWeight);
eWeightService.addCharacteristic(charButton);
According to the To set the BLE transmitter power level to the maximum (8 dBm) on the nRF52840 using the ArduinoBLE library, you can use the setTxPower()
function provided by the ArduinoBLE library. The transmitter power level is set in dBm, and the valid values depend on your specific hardware capabilities.
I have mostly seen it used just after the Device ID call if that matters.
so the edit would be like this below;
if (!BLE.begin()) {
Serial.println("starting BLE failed!");
while (1);
}
BLE.setDeviceName(deviceID);
BLE.setLocalName(deviceID);
// Set the transmitter power level to the maximum (8 dBm)
"color:>BLE.setTxPower(8)"
//byte data[5] = { 0x0e, 0x0e, 0x0e}; //doesnt work from arduino side right now
// BLE.setManufacturerData(data, 3);
BLE.setAdvertisedService(eWeightService); // add the service UUID
In the BLEinit
function,(line 7) I added the line BLE.setTxPower(8);
to set the transmitter power level to 8 dBm. Adjust the value if your hardware supports different power levels.
HTH
GL PJ
P.s.
The default TX power with the softdevice is 0dbm. You can change the TX power using the softdevice function sd_ble_gap_tx_power_set()
.