Skip to main content
Associate III
May 18, 2024
Solved

Simple BLE advertising application

  • May 18, 2024
  • 4 replies
  • 2574 views

Hi there :waving_hand:

I am quite new to the topic of developing BLE hardware.

My goal of the current project is quite simple:

I have a custom board featuring stm32wb55ceu6 and a ambient temperature/humidity sensor.

All hooked up including the RF part with an impedance matching network to 50 ohms and an antenna for 2.4 GHz (BLE).

Now I would like to read the sensor using i2c and get the values for temp and humidity every let's say 10 minutes.

After getting the values I would like to just send out a ble advertisement containing the sensor data in bthome format (so that my home assistant can just read it).

There should be nothing else involved. The board is just sending out once every 10 minutes and after sending it goes back to sleep.

My question: can you maybe provide me a startingpoint where I can find information about BLE advertisement, etc.? 

I saw that there is a stm32wpan module but I am not sure if this is total overkill for this simple use case.

I am a bit lost with this :(

I was inspired by the following project: https://github.com/rbaron/b-parasite/blob/main/code%2Fnrf-connect%2Fsamples%2Fble%2Fsrc%2Fble.c

And would like to build sth. Similar just with an stm32wb55.

 

Thank you 

This topic has been closed for replies.
Best answer by Joe_

Hi, there,
To begin with, here is an introductory page on the STM32WB and its environment:
Connectivity:STM32CubeWB_BLE 

From this page, you'll be able to find examples of projects similar to your use case. For example, the "BLE_Sensor" and "BLE_HealthThermometer" projects.

Best regards, 
Joé

4 replies

Joe_Best answer
ST Technical Moderator
May 20, 2024

Hi, there,
To begin with, here is an introductory page on the STM32WB and its environment:
Connectivity:STM32CubeWB_BLE 

From this page, you'll be able to find examples of projects similar to your use case. For example, the "BLE_Sensor" and "BLE_HealthThermometer" projects.

Best regards, 
Joé

ExeuAuthor
Associate III
May 20, 2024

Hey Joe,

thanks for the answer. I was just checking out the example of the BLE_Sensor.

Am i right that advertising is happening in "app_ble.c" of this "WPAN" stack?

Found this here:

 

 ret = aci_gap_set_discoverable(ADV_IND,
 Min_Inter,
 Max_Inter,
 CFG_BLE_ADDRESS_TYPE,
 NO_WHITE_LIST_USE, /* use white list */
 sizeof(a_LocalName),
 (uint8_t*) &a_LocalName,
 BleApplicationContext.BleApplicationContext_legacy.advtServUUIDlen,
 BleApplicationContext.BleApplicationContext_legacy.advtServUUID,
 0,
 0);

 

And then:

ret = aci_gap_update_adv_data(sizeof(a_ManufData), (uint8_t*) a_ManufData);

So i guess ManufData is containing the "raw" data which should be advertised?

I wanted to avoid using this whole GAP/GATT thingy. It seems to much for this usecase..

As an alternative i was seeing that there is an HCI - Interface which may is a shortcut to just do some advertising?

HCI_LE_SET_ADVERTISING_ENABLE()

Would this also work somehow?

ST Technical Moderator
May 21, 2024

If you don't need to set up a connection, you can look at the BLE_Beacon example to make an ADV only.
BLE_Beacon 

Yes, if you don't want to use GAP commands as in the examples, you can use HCI commands.

Here's where you can find out more about these commands:
STM32WB_BLE_Wireless_Interface.html 

BR, Joé