Android Tutorial BLE nRF Connect pre-BLE2 problem solving

It is surprising how often the basics get missed, when embroiled in heat of battle of programmer vs hardware, operating system, complex apis and libraries, etc.

I have found that whenever my BLE2 programs don't work, it's always nice to know that everything else in the chain *is* working, and that there is a fighting chance of victory. ?
 
Last edited:

emexes

Expert
Licensed User
First traps first. Bluetooth is on, right? The setting likes to hide: on the phone I'm using right now, the Bluetooth On/Off switch is at Settings, Connected devices, Connection preferences, Bluetooth.

 

emexes

Expert
Licensed User
Next, turn Location on too. No, I don't know why it's so entwined with Bluetooth. On the phone I'm using right now, the Use location On/Off switch is at Settings, Location.

 

emexes

Expert
Licensed User
Next, use nRF Connect app to make sure that your BLE device is operational (flat battery? sleep mode? needs a button press to connect? connection window timeout?) and your phone is able to connect and communicate with it.

If you don't already have the nRF Connect app, then go to Play Store and download and install it.

 
Last edited:

emexes

Expert
Licensed User
Run the app and click the SCAN button in the top-right corner. Within 5-30 seconds, it should list active BLE devices in the room with you (and perhaps further).




Click on the entries to get more information about a device; sometimes this helps in working out which device is which. If your phone is not tied down by a cable, then one nice feature is that the signal strength is updated with each ping from the device, and if you walk away from the device then the signal strength (eg here -71dBm) will decrease (go more negative). I often also use this to locate other people's lost temporarily misplaced iTagged keys.

 
Last edited:

emexes

Expert
Licensed User
Once you've worked out which device you're trying to connect to with your B4X app, connect to that device by clicking its black CONNECT button

After a few seconds, you should get a list of services (same as when connecting via BLE2 library). At this point, we can be reasonably certain that everything outside of your B4X app is working, and thus whatever the problem exists inside that, it's probably your doing.

If it's any consolation, we've all been there, some of us more times than we'd care to admit to. ?

 
Last edited:

emexes

Expert
Licensed User
Now, I know this next bit looks like we're overcooking the process, but at the same time it can be useful to get to know your BLE device better ? maybe even take it out for a test-drive of its basic features.

Click on the services to see what characteristics (data fields, sensor readings, actuator settings) they give you access to :
(yes, I agree that "Generic Access" could have been more-helpfully named)



Inputs (sensor readings) are usually READ, outputs (motors, buzzers, LED indicators, etc) are usually WRITE but often with readback too.

Click on the download arrow to read an input, eg here we have read that "Device Name" has the value "iTAG"

 

Attachments

  • 1672140454646.png
    435 bytes · Views: 197

emexes

Expert
Licensed User
If the device has outputs (WRITEable characteristics) then you can try those too. Although perhaps not anything that says "begin self-destruct sequence" or similar.

Eg iTags have a beeper and flashing LED that can be remotely activated:



which is useful for confirming that the phone-BLE-device link is operating as it should, plus - bonus - again also great for finding other people's iTagged misplaced keys.

Double-bonus : no more boredom in populated public places, setting off random strangers' iTags.
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…