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

I have a seeed nrf52840 sense and a tuya bluetooth temperature sensor (this one: https://nl.aliexpress.com/item/1005006117643965.html). The idea is I want the seeed to read the temperature, humidity and battery status of the sensor.

I’m using the latest arduino IDE and installed the bluetooth library (BLE) as zip from it’s github, to ensure I have the latest version.

So far so good. However, whatever I try, i cannot find the sensor, as in it’s address, and so forth.

I installed nrfConnect on my phone, and this found the sensor without issues. From this, I learned the sensor address.

However, this address cannot be found by the nrf52840. It does find almost every bluetooth device in my surrounding, but not my sensor.

The code is very simple.

  #include ArduinoBLE.h

  String wanted = "dc:23:50:25:01:a8";

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

void loop() {
  BLE.scanForAddress(wanted, false);

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

This produces no result. I have also removed the wanted address and did a normal ble.scan(). This produces a lot of addresses, but not the wanted one.

On my phone I noticed due to the way it is setup irl, the sensor had a lot lower rssi than other devices. So I wrote code to just find the closest devices. This works, however it does NOT find the tuya sensor.

Anyone has any Idea what I’m doing wrong?

Hi there,

So you can see it with Nrf_connect for Mobile then You should be able to see it with the Xiao. What code are you using? The basic BLE scanner should yield the MAC address advertising once the device it turned on.
it may time out so, be aware. If it’s a peripheral it’s services should be subscribable for the NOTIFY it sends every 30 Seconds or unless the temps change over a certain Delta (from the product description page)

Which BSP & LIB’s are you using on Xiao mbed or non. ?
Arduino BLE or Blufruit?

HTH
GL :slight_smile: PJ :v:

What’s the end goal here?
use the code tags above " </> " paste it in there. we can get you going :+1:

I answered all your questions in my opening post, except the mbed part.

I still have no clou what the mbed stuff is and how I can see or not see if Ihave a mbed version or not. I have tried both.

The MAC address of everything is showing up, except this sensor.

The code is in my post, as well what BLE I’m using (Arduino).

As far as the code tags… what’s wrong here? I see my code just fine?

Hi there,

So , my bad , code looks good, Tags AOK :+1: :grin:
Ok , Arduino BLE , Check…
Look at the compiler output , first 3 lines you 'll see at the end which BSP it is using to compile with.
Can you load this example and run it?

HTH
GL :slight_smile: PJ :v:

Output:

Runs fine, as it’s basically the same code. Produces the same addresses, but not the address of te device I’m looking for.

Hi there,

Ok, So can you turn on the verbose output in the settings for the compiler output, You will see more useful info that way…
What mobile phone are you using?

It may NOT be a BLE device but a Legacy 4.0 device?
Let’s find out which BSP your using?

GL :slight_smile: PJ :v:

FQBN: esp32:esp32:XIAO_ESP32S3:PSRAM=opi
Using board 'XIAO_ESP32S3' from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14
Using core 'esp32' from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14

this is an ESP output example (first 3 lines) , we are looking for your Nrf52840 FQBN :v: the end of the second line(scroll) tells you the version.:+1:

FQBN: Seeeduino:mbed:xiaonRF52840Sense Using board 'xiaonRF52840Sense' from platform in folder: C:\Users\Boss\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.3 Using core 'arduino' from platform in folder: C:\Users\Boss\AppData\Local\Arduino15\packages\Seeeduino\hardware\mbed\2.9.3

The phone is a Samsung A34.

Hi there,

Awesome,

So you are using the mbed Board Support Package version 2.9.3.
and the Sammy is AOK… :v:
Appears you do have what should work? The Tuya could be classic BT in which case you can try the NON-mbed BSP’s like 1.1.1 and the BlueFruit (bluetooth) LIB , open the basic scan example and see if it shows it’s colors. Can you show how it looks (what service it advertises) Picture from the nrf_connect mobile app?
If it shows up there, You should be able to read the characteristics and services, sub and get the Notify if the temp or Humidity changes, if not only a update(notification) ever 30 seconds I think the data sheet or sales page said.
Just for grins :grin: maybe switch to the 2.9.0 BSP. and do a quick test again. before trying the NON-mbed stuff.
HTH
GL :slight_smile: PJ :v:

I’m a big fan of the Nrf_connect for Desktops & the $9 nordic BLE dongle. Makes testing this stuff a breeze :+1:

Switched to ‘FQBN: Seeeduino:nrf52:xiaonRF52840Sense’, compiled the scan example from the bluefruit libraries. It shows the same results, the same addresses and not the address i’m looking for.

The device type is LE only, advertising type legacy.
LE General discoverable BR/EDR not supported

Hi there,

Well can’t say you didn’t put in Work…
So None of nRF52 devices support Bluetooth Classic (BR/EDR), so this may be the case (advertising is legacy)…

HTH
GL :slight_smile: PJ :v:

There may be a standalone BT-Clasic to Uart module that would perform the same with some Xiao code. as a thought :crossed_fingers:

Ok… now. honestly. I appreciate you trying to help, really I do. But it looks like you just answer to be the one answering.

You said my attitude was wrong. I’m sure that’s true.

But look at what happened here. You didn’t read my opening post, all your questions you asked, were answered in the opening post.

So i came here with a well documented question, basically ‘it does not work’.

Then you started asking questions had already answered, let me do some other stuff, to come up with the answer ‘it does not work’.

Hi there,

So you are welcome for sure, I missed something here? You posted a question, I asked a question, You provided the answer as best you could. I asked you to try some things to troubleshoot your issue. This revealed the answer pretty clearly IMO. (and the compiler showed us that) They are not compatible. The Tuya device is a classic BT device. None of the Nordic devices can hear. I offered and alternative (BT dongle) suggestion.
Not much more juice to squeeze from this one , so if there’s a question in this rhetorical reply ???
I’m here that’s why I answered, I don’t work for Seeed Studio but Paying it forward for there great products and the excellent support I received when I needed it.

HTH
GL :slight_smile: PJ :v:

I dunno what you mean by attitude? Seems all cordial to me , but hay I’m older and like animals and technology more than people. :grin:

The device is a bluetooth LE device, as described in the opening post.

Everything you asked, was already anwered in the opening post, except the type of mobile phone,which was an irrelevant question.

You know, if you don’t know the answer to something, you don’t HAVE to answer.

I have dissasembled the temperature sensor. It uses a PHY62222 chip.

" The PHY6222 is a low-power, high-integration Bluetooth Low Energy (BLE) chip from Phyplus Technologies."

So the device IS a BLE device and should be supported.

It is programmable so maybe I’d have to write a different firmware for that.

Hi there,

Now, I will say , maybe irrelevant to you… but in your own words its your mobile that was able to see the adverts, My answers and Questions were not just to pass the time… you don’t have to take the advice or tell me what I should or shouldn’t do. What you say to me outside the tech is what’s irrelevant ,WHO the F’ are YOU! anyway.

Beside it’s advertising in Classic mode… So good luck with that.

You seem like a CLOWN just starting trouble. I doubt you could write any code for anything …

GL :slight_smile: PJ :v:

You seem like someone who does not know to solve issues, but wants attention and therefor feels the need to answer even questions he knows jack shit about.

It’s not advertising in classic mode. Where did you get that nonsense from. Probably from not reading correctly.

LOL, What’s a matter I have more solutions than YOU… SO :v:
:face_with_hand_over_mouth:

GL :slight_smile: PJ :fu:

:grin: Now I get it , Your the dude from the round display thread…that doesn’t work… LOL
Yea, OK… :+1:

The round display works now, no thanks to you.

Did you also see the: device type: LE only above it?

Curious that you only started looking at my opening post, when you got some critisism.