This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to send the voltage value via BLE?

Hi guys,

I am using Zephyr RTOS and trying to enable my device to send the voltage data via BLE. I use two nRF52832 boards, one of them is peripheral for which I use peripheral_ht example from Zephyr documentation, and the second one is central for which I use central_ht example. For now, I can send the temperature values without problems, but my goal is to enable my peripheral device to send the measured voltage to the central board. I need this because I use the external power source for my peripheral board and I want to see if the voltage readings are correctly.

Thanks in advance and I hope that you can help me!

Best regards,

Adnan.

Parents Reply
  • Hi Adnan,

    The Bluetooth Special Interest Group (Bluetooth SIG) has predefined certain services. For example they have defined a service called Heart Rate service. The reason why they have done this is to make it easier for developers to make apps and firmware compatible with the standard Heart Rate service. However, this does not mean that you can't make your own heart rate sensor based on your own ideas and service structures. Sometimes people mistakenly assumes that since Bluetooth SIG has predefined some services they can only make applications abiding by these definitions. This is not the case. It is no problem to make custom services for your custom applications.

    If the predefined service suits your needs, then I recommend using them. If you see that they don’t suit your use-case, and you want to make some modifications, then you should create your own custom service.

    Here is a list over the predefined services/profiles: https://www.bluetooth.com/specifications/gatt/

    The Bluetooth SIG Battery Service defines a Battery Level characteristic where the battery level is presented as a percentage from 0% to 100%. Since you want to send the battery level as voltage instead, it does not suit your use-case, and you should create a custom service instead.

    The LBS(LED Button Service) implements a basic/minimalistic custom service. You might want to take a look at that:

    https://github.com/nrfconnect/sdk-nrf/tree/v1.3.1/samples/bluetooth/peripheral_lbs

    https://github.com/nrfconnect/sdk-nrf/blob/v1.3.1/subsys/bluetooth/services/lbs.c

    Let me know if you need more help setting up your "battery voltage" service.

Children
Related