I am running a boron 404x to control a stepper motor. I have an app on my phone that
connects to the boron and sends a button press command to move the motor via bluetooth. It all works fine on my iphone. I see the bluetooth device id and connect. I am also using a few bluetooth scanners for confirmations. When I run the same custom app, or any of the scanners like lightblue, on my android phone, I do not see the device id for my boron show up. It does not show in settings pairing, or in any scanner app, or my own app. I am waiting on another android phone to see if it still occurs on that, but there is nothing in my code that seems to be an issue, and when I try other microcontrollers (a feather, esp32, nrf52840) with bluetooth, they all show up on my android phone. It seems to be only the boron (I have 4 and they all fail to show up in BT.) Is it possible it is phone-specific? I have covered most of the obvious things like checking the code, the payload, the power levels, UUID's, different cables, batteries, etc. Until I get another android, can anyone suggest a possible solution? Thanks.
Sorry if I put this in the wrong area.
Hey safetyarms,
Welcome to the community!
Could you share the Bluetooth code you are running on the device and how its advertising?
Where are you looking in Android to see if this device is being advertised? Are you using a BLE Scanner app or using Settings?
We use BLE with Android and iOS alike and often, so its probably something small that is missing here to unblock you.
Thanks!
Nick
Thanks for the response. I am scanning with all the options, settings on android, lightblue, ble scanner, bluefruit, and my own simple app. None of my android phones will show the bluetooth signal from the boron. They will show other microcontrollers with bluetooth. Here is the relevant code:
BleCharacteristic forwardCharacteristic("forwardCharacteristic",
BleCharacteristicProperty::READ | BleCharacteristicProperty::WRITE | BleCharacteristicProperty::NOTIFY,
"[UUID]",
"[UUID]");
BleCharacteristic backwardCharacteristic("backwardCharacteristic",
BleCharacteristicProperty::READ | BleCharacteristicProperty::WRITE | BleCharacteristicProperty::NOTIFY,
"[UUID]",
"[UUID]");
// Add a new BLE Characteristic for error feedback
BleCharacteristic errorCharacteristic("errorCharacteristic",
BleCharacteristicProperty::READ | BleCharacteristicProperty::NOTIFY,
"[UUID]",
"[UUID]");
BLE.addCharacteristic(forwardCharacteristic);
BLE.addCharacteristic(backwardCharacteristic);
BLE.addCharacteristic(errorCharacteristic);
// Create the advertising data
BleAdvertisingData advData;
// Append the UUIDs of both characteristics to the advertising data
advData.appendServiceUUID(forwardCharacteristic.UUID());
advData.appendServiceUUID(backwardCharacteristic.UUID());
advData.appendServiceUUID(errorCharacteristic.UUID());
// Advertise the BLE peripheral with the advertising data
BLE.advertise(&advData);
This code works on my iphones though, just not on my android.
Thanks Safetyarms,
Could you confirm which Device OS version you are using?
Also, would you mind running this firmware example and seeing if the device pops up in Android as well?
I'll replicate it here later today once I get that info and will circle back!
Thanks,
NIck.
Hi, thanks for that. I flashed that code and can see the signal from aabbccdd on all my android phones now. Forgive me, for this is all new to me. How would I use this to update my own code so the android connects? Also, do you know why I can see the bluetooth signal from the 404x on my Iphone SE (from lightblue, ble scanner, etc), but not on my Iphone 8, 9 or 10? Clearly I am not setting things up properly, but its confusing why it fully works on one Iphone but not the rest. Thanks again.
I seem to be lost. I have 2 boron 404x boards and I flashed one with your code for ble provisioning and it worked as far as I can now see all the board on lightblue show for every phone I have, Android and Iphone. Then I changed the broadcast name in the code and re flashed, but the board went silent. I lost the status LED, and cannot access the board in any way, and I tried everything. Buttons do nothing, new cables, different power sources, nothing works. It just blinks the power LED. So I got my second Boron and uploaded my original code which works perfectly on my Iphone SE. This code running on the second board fails to show up in the bluetooth signal list at all. I am at a loss. These are the same two boards running the same code. One works fine, bluetooth and all, and the other works but not the bluetooth code. It just never shows up on my peripherals scan in Lightblue. I am running the latest OS on the boards and everything should be identical. I could really use some guidance. Here is my excerpted ble code:
const unsigned long ADVERTISING_PERIOD = 30000; // e.g., 30 seconds
unsigned long lastAdvertiseTime = 0;
const char* myServiceUuid = "UUID";
BleService myService(myServiceUuid);
BleCharacteristic forwardCharacteristic("forwardCharacteristic",
BleCharacteristicProperty::READ | BleCharacteristicProperty::WRITE | BleCharacteristicProperty::NOTIFY,
"UUID",
"UUID");
BleCharacteristic backwardCharacteristic("backwardCharacteristic",
BleCharacteristicProperty::READ | BleCharacteristicProperty::WRITE | BleCharacteristicProperty::NOTIFY,
"UUID",
"UUID");
BleCharacteristic errorCharacteristic("errorCharacteristic",
BleCharacteristicProperty::READ | BleCharacteristicProperty::NOTIFY,
"UUID",
"UUID");
BLE.on();
// Add the characteristics to the BLE peripheral
// Add the characteristics to the service
BLE.addCharacteristic(forwardCharacteristic);
BLE.addCharacteristic(backwardCharacteristic);
BLE.addCharacteristic(errorCharacteristic);
// Create the advertising data and append the service UUID
BleAdvertisingData advData;
// advData.appendLocalName("SASGripUnit"); // Include the device name in the advertising data
advData.appendServiceUUID(myServiceUuid);
advData.appendServiceUUID(forwardCharacteristic.UUID());
advData.appendServiceUUID(backwardCharacteristic.UUID());
// Adjust the advertising parameters for better discoverability
BleAdvertisingParams advParams;
advParams.interval = 100;
BLE.setDeviceName("SASGrip4");
BLE.setAdvertisingParameters(&advParams);
// Set device name and start advertising
BLE.advertise(&advData);
I made some progress. I think I had too many parameters because when I removed the error characteristic and appended the name, I got a connection across all my test phones. I solved my problem thanks. Now I just need to figure out how to bring my dead boron back to life. Thanks for the help.
Hi Rafael, I invite you to try this Device restore tool:
Best
Yes, unfortunately it does not connect via serial. When I plug in both usb to my pc and a lipo battery it still shows dead. No response from cli and therefore none from the device restore. Don't know what to do at this point. Charge light is the only thing working.
The only option for recovery if the device does not boot is a CMSIS/DAP debugger, either the Particle debugger or a clone. Or, for nRF52 devices including the Boron, a Segger J/LINK.
That's not guaranteed to solve the problem as a hardware issue could also be the reason the device does not boot, however.