NRF52840 sense and bluetooth: tuya sensor refuses to show up?!

and about having solutions; you have compiled some examples. Pretty sure you made nothing yourself. I, ont he other hand, did.

Oh… by the way…

Hi there,

LOL…
You know you copied my example… LOL
Go for it …Get it working I’m sure YOU can. :+1:

:clown_face:

I copied nothing from you. And it’s not your example. It’s an example someone else wrote.

Pls stop thinking you’re the best invention since sliced bread. You’re not.

Pls if you don’t see the problem, or do not know the answer, then don’t answer.

1 Like

Hi there,

Ok. LOL sure thing… :v:

I’m pretty sure I am… :rofl:

:clown_face:

Tell me you are useless and unemployed without saying so…

Ah… i see.

Hi there,

I couldn’t resist…

US20230314907A1

:wave:

To demonstrate how useless you are… I checked. And as the nordic docs say, legacy is pretty normal and has 4 modes. Nordic. You know, the maker of the chip in the XIAO NRF52840 that I use.

Also, most if not all devices in nrfConnect say to be of scanning type legacy, but ARE visible to the XIAO.

In other words: you are hungup on something not relevant. Again.

Great… another topic where you didn’t help somoene. Good for you! You like having lots of topics, eh?

1 Like

Just leaving this here, to show what nonsense you are speaking…

Well I found one thing wrong in my code (there’s probably more). I called the BLE.scan() function within the main loop.

This means every time the scan function gets called, even when it is already scanning.

I moved it to the init loop, and now I get more devices. Still not the device I’m looking for tho.

Fun fact: the XIAO itself sais: advertising: legacy in nrfconnect

@zikken - I checked your code ā€œas isā€ and it didn’t work.
Apart from the #include ArduinoBLE.h (probably a typo?) and the quotes around the peripheral.address() in the Serial.println, I find that the address filter should be set up first.

So…

void setup() {
  Serial.begin(115200);
  while (!Serial)
    ;

  // Init BLE
  BLE.begin();
  // Set up address filter
  BLE.scanForAddress(wanted, false);
}

void loop() {
  BLEDevice peripheral = BLE.available();
  if (peripheral) {
    Serial.println(peripheral.address());
  }
}

I don’t have the same (Tuya) device as you but if this doesn’t work I can create a BLE device here that uses ā€œlegacyā€ advertising.

Edit> I think the quotes around peripheral.address() may have been on purpose? If so, please ignore remark above :slight_smile:

Another Edit> I had an extra BLE.scan() which wasn’t required so removed it above.

1 Like

The code was a bit of a mashup as I’ve been exerimenting a lot. Your remarks are correct. The quotes was not on purpose, also not used in IRL code.

Basically what you have was about my first try. Which didn’t work and led me down the rabbit hole of finding the address and trying to connect to it.

@zikken - Thanks for the reply.

I will try to create a device that uses legacy advertising and similar Flags and UUIDs to the device you have.

Unfortunately, I’m not sure what other issue it could be…

@zikken - I have created a device that only uses legacy advertising and it works with your code.

If possible, from your NRF Connect mobile app, can you enable some settings and send me the resulting data?

There is an ā€œexportā€ button just below the settings.

I would, but nrfconnect on android doesn’t seem to have those options…

@zikken - With further investigation there are two possible issues I can think of…

  1. Scan responses are being filtered at the device (but would than mean NRF Connect would miss the advertisements as well?)
  2. The device is in basic operating mode (ie sleeps for 10s) then wakes and advertises.

Have a look here - this may be an option?

will take a look.

I was leaning towards the first, was already looking into underlying code.

The second is also true… it advertises every 8125 ms.

Regarding nrF Connect for Android… There is a drop down menu to the top right with a ā€œShow Logā€ menu item.

Then at the bottom left of the screen is a drop down with a ā€œVerboseā€ option. There’s also ā€œcopy, share and saveā€ buttons.
You should be able to use those settings and buttons.

1 Like

You are right!

That yielded this:

nRF Connect, 2025-05-15 
TyOS (DC:23:50:25:01:A8) 
I 11:46:34.091 [Server] Server started 
V 11:46:34.094 Heart Rate (0x180D) 
- Heart Rate Measurement [N] (0x2A37) 
   Client Characteristic Configuration (0x2902) 
- Body Sensor Location [R] (0x2A38) 
- Heart Rate Control Point [W] (0x2A39) 
Unknown Service (0000aaa0-0000-1000-8000-aabbccddeeff) 
- Unknown Characteristic [N R] (0000aaa1-0000-1000-8000-aabbccddeeff) 
   Client Characteristic Configuration (0x2902) 
   Unknown Descriptor (0000aab0-0000-1000-8000-aabbccddeeff) 
   Characteristic User Description (0x2901) 
   Characteristic Presentation Format (0x2904) 
- Unknown Characteristic [I W WNR] (0000aaa2-0000-1000-8000-aabbccddeeff) 
   Client Characteristic Configuration (0x2902) 
User Data (0x181C) 
- First Name [R W] (0x2A8A) 
- Last Name [R W] (0x2A90) 
- Gender [R W] (0x2A8C) 
V 11:46:34.275 Connecting to DC:23:50:25:01:A8... 
D 11:46:34.275 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M) 
D 11:46:43.837 [Server callback] Connection state changed with status: 0 and new state: CONNECTED (2) 
I 11:46:43.837 [Server] Device with address DC:23:50:25:01:A8 connected 
I 11:46:43.843 [Server] MTU changed to 247 
D 11:46:43.861 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2) 
I 11:46:43.861 Connected to DC:23:50:25:01:A8 
V 11:46:43.875 Discovering services... 
D 11:46:43.875 gatt.discoverServices() 
D 11:46:44.185 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED 
I 11:46:44.331 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms) 
D 11:46:44.719 [Callback] Services discovered with status: 0 
I 11:46:44.719 Services discovered 
V 11:46:44.724 Generic Access (0x1800) 
- Device Name [R] (0x2A00) 
- Appearance [R] (0x2A01) 
- Peripheral Preferred Connection Parameters [R] (0x2A04) 
Generic Attribute (0x1801) 
- Service Changed [I] (0x2A05) 
   Client Characteristic Configuration (0x2902) 
Unknown Service (0000fd50-0000-1000-8000-00805f9b34fb) 
- Unknown Characteristic [W WNR] (00000001-0000-1001-8001-00805f9b07d0) 
- Unknown Characteristic [N] (00000002-0000-1001-8001-00805f9b07d0) 
   Client Characteristic Configuration (0x2902) 
D 11:46:44.724 gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true) 
D 11:46:44.727 gatt.setCharacteristicNotification(00000002-0000-1001-8001-00805f9b07d0, true) 
I 11:46:45.252 Connection parameters updated (interval: 48.75ms, latency: 0, timeout: 5000ms) 
1 Like