BLE AdvertisementData returns empty []

Hi All!
Ive got a problem with getting advertisementData to return data. (without connecting)

Sitrap: Seeed nr52840 sending advertisements. Reading them with another module shows the manufacturer data okay. Also okay on ble scanner app.

When I change the uuid in MIT to a wrong number the Advertisement data returns null. That is fine.
With the correct uuid the AdvertismentData returns . (two square brackets)
So, it looks that the numbering is all okay, there is just no data !
arduino code:

test_ino.txt (1.2 KB)

this is the test app:

using BLE Extension Version: 20230728
Any suggestions on how to solve this is very much appreciated, I've googled for hours on end, but no result on that.

That clock timer might be inappropriate, given the huge number of BLE event blocks you did not have.

thanks for your reply. Clock is on 4 seconds interval.
If I make it too fast it gives an error because it was not found yet.

Same result when not using the clock, but the Device found block, again no data in array

I'm including your .ino in a form our BLE experts can read more easily:

#include <bluefruit.h>
#include <Adafruit_FlashTransport.h>
Adafruit_FlashTransport_QSPI flashTransport;

BLEService lbs("0000FFE1-0000-1000-8000-00805F9B34FB");
BLEService VService("FFE1"); // create service

char user_data[8] = {0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38};

void setup()
  Bluefruit.begin(1, 0);

  Bluefruit.Advertising.clearData();// Advertising packet
  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE );
  Bluefruit.Advertising.addManufacturerData(user_data, 6);
  Bluefruit.Advertising.addData(BLE_GAP_AD_TYPE_SERVICE_DATA , user_data2,2);

  Bluefruit.Advertising.setInterval(1000, 5000);    // in unit of 0.625 ms
  Bluefruit.Advertising.setFastTimeout(2);      // number of seconds in fast mode
  Bluefruit.Advertising.start(0);                // 0 = Don't stop advertising after n seconds  

void loop()


If I remember my ASCII right, your data is just '12345678':

char user_data[8] = {0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38};

Your use of the BLE Advertisements to send data is out of the ordinary compared to samples on this board.

Bluefruit.Advertising.addManufacturerData(user_data, 6);
  Bluefruit.Advertising.addData(BLE_GAP_AD_TYPE_SERVICE_DATA , user_data2,2);

While we wait for real BLE experts to chime in, here's my knowledge base:

Ah, thank you for the effort, I didnt know to use,ino. makes sense.
yeah my data is just 12345678, as test. I see that on my ble scanner app also.

The 2 byte addData function, I added that to send the short service.
When I do not add it I get a null from AdvertisementData. so I think i do need that as well.

oh, and ignore the startAdv(),I cleaned the code up for clarity ,but forgot to take that out...

(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.

Here it is:
Advertise_test.aia (278.2 KB)

Hello Chris

  1. Getting down to basics, what is your Project actually designed to do?

  2. Where does the Sketch come from? I see you have not used the Seeed BLE Library (for the Arduino IDE) but instead you are using Bluefruit from AdaFruit.

We don't often see two BLE services run on one board. I recognise the GATT LED Button Service LBS, but what is "VService" "FFE1"?

If you have no genuine manufacturer data, do not advertise it.

oh I am prototyping, and was interested to get the manufacturer data into my app, without the need to connect
Also it needs to be very low power. I succeeded by using the bluefruit and the nrf52840.
So for now , as a test, it is just FFE1.

I just cant understand why the AdvertisementData is returning an empty array.

Does someone maybe have a working example for me? I keep trying all kind of different hw and sw solutions, but no success. Stuck now.
Dont really want to go back to flutter... :frowning:

You haven't explained what the goal of Project is, nor why 'FFE1' exits, which is likely to be part of the issue.

So you tried the library intended for your microcontroller and found it to be too slow?

Well, BLEService VService("FFE1") is an invalid service - I can't find it in the 2024 GATT list. You could generate your own custom UUID here:

ProfessorCad: Tips & Tricks Create/Validate BLE UUIDs


BLEService VService("F36C8650-671D-46FE-8462-7321DA6AAFFA");

There is also a typo here:

As far as I am aware, the AdaFruit library doesn't use type char array for data, it uses type uint8_t (byte) unsigned chars (integers), but you may have discovered a different method, which is why I asked where the Sketch came from.

Try the custom UUID and correction of the typo.

1 Like

Without knowing the goal, how can we?

That isn't the correct UUID. I hadn't looked at your App Inventor code, good effort but unfortunately there is a lot wrong and the snag is there is a lot missing too. How did you get any kind of a result? I think what you have posted is not all of your code.

Post the App Inventor file (.aia)

Export to PC from Projects List

Here is a simple Project to try. It does not list available devices because you have the name of the device of interest, "Viax". It also does not ask for BLE permissions, which you will need if later you connect to the device. I have nothing to test the code with here!

We find it best to test Bluetooth Apps as an APK rather than use the Companion.

BLE_Advertise.aia (198.9 KB)

Hi Chris,
The goal for now is to is to let MIT show me the manufacturer data from the AdvertismentData block. Any data... Let say a 1 from a button service.
nothing fancy just something simple stupid.

this is the full aia, at this point:
Advertise_test (3).aia (278.4 KB)

data2 is null after scan.

ble scanner now shows the xiao sending:
0x01 0x06
0x0A 0x00
0xFF 0x082234353637
0x09 0x56696178

So decided started again, with a led example from arduino

LED1.ino (2.7 KB)
and the aia:
Advertise_test (5).aia (278.3 KB)
Label1 shows the correct uuid, so device is found
I would think I could use the uuid global for AdvertisementData. But then I get:
So I use the preset value.
But data2 is still : null

BLE scanner shows the manufacturer name and the data and the name and service. Obviously because mit finds it also.

edit :runtime error was solved using Select List Item List 1 after global uuid. But still null on data2

Ah, you are ahead of me. Actually your original Sketch "test.ino" has a better chance of working, with the tweaks I mentioned.

LED1.ino does not have a BLEService UUID for advertising.

EDIT: - though if you fix the UUID issues, LED1.ino will be more familiar to the Power Users. Adafruit have their own way of doing things, so if using their libs, best to be using their hardware too.

Ah okay, i thought that would be the setAdvertisedService function?