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

How to send the sensor data from on to another nRF52832 board using the BLE communication?

Hi guys,

I am working on my project and until now I enabled the device to measure the voltage and get the sensor data from the temperature sensor which I need now to send to another nRF52832 board using the BLE communication. The main goal of my project is sending the sensor data after my device achieves the required voltage level. For that, I need to use BLE as the low power technology, but I am still trying to figure out how to do that and how to find the good example which can be the base of my code. I will appreciate any type of help, advice or some example that you can send me and give me the guidelines how to solve this.

Thank you very much in advance and kind regards!!

  • Hello,

    The main goal of my project is sending the sensor data after my device achieves the required voltage level. For that, I need to use BLE as the low power technology, but I am still trying to figure out how to do that and how to find the good example which can be the base of my code.

    If you are looking for an example to use as base, that could provide this functionality right off the bat, you could take a look at the Nordic UART example from the SDK. In this example, both devices forward whatever they receive over UART to the other device through their BLE link. You may then modify the example to instead forward the measurements from your sensor, which would provide the functionality that you describe. This would use the BLE Nordic UART service, which just transmits byte-for-byte what it is provided.

    However, if you would like to implement your own BLE service and characteristic I highly recommend completing the BLE Services tutorial and BLE Characteristics tutorial, these shows you how to create your own custom services and characteristics, which is highly useful when developing with BLE as the communications and functionality will be suited for your specific application.

    Please do not hesitate to ask if you should encounter any other issues or questions, or if anything still should be unclear!

    Best regards,
    Karl

  • First of all, thanks a lot for this very quick answer. I will try with this UART example first, and then see if I need to implement my own BLE service and characteristic. Also, I have one very important question because I forgot to write that I use Zephyr RTOS. Based on that, can I use this example together with Zephyr? In case that is not possible, do you have any other example that is compatible and useful together with Zephyr RTOS?

    Again, thanks in advance and I will appreciate any type of help.

    Best regards,

    Adnan!

  • Hello Adnan,

    Sorry for my late reply.

    Aduka_27 said:
    I will try with this UART example first, and then see if I need to implement my own BLE service and characteristic.

    That sounds like a great plan! Just let me know if you should encounter any issues or questions along the way.

    Aduka_27 said:
    Also, I have one very important question because I forgot to write that I use Zephyr RTOS. Based on that, can I use this example together with Zephyr? In case that is not possible, do you have any other example that is compatible and useful together with Zephyr RTOS?

    Ah, yes, this is an important detail. I did not catch this from your original ticket.
    The Nordic UART example is also available for the Zephyr RTOS - however, please also know that all our Zephyr RTOS based examples and modules are included in the nRF Connect SDK, which is different from the nRF5 SDK I linked you in my previous post.
    Are you already working with nRF Connect SDK?

    Aduka_27 said:
    Again, thanks in advance and I will appreciate any type of help.

    It is not problem at all Adnan, I am happy to help!

    Best regards,
    Karl

  • First of all, thank you again for these answers and guidelines. I did not work with nRF Connect SDK before, I only downloaded the newest version of nRF5 SDK 17.0.0. but lot of those examples are not compatible with Zephyr environment. I took a look on this example that you sent me, but there are a lot of code that I could not understand with my level of knowledge. Also, I saw that I can upload Central UART  sample on the first device, and Peripheral UART sample on the second device if I want to establish the communication between them. Also, for now I only used Minicom and I don't have any experience with Putty. Can you maybe suggest me what is the best tools that I have to use and also do you have any literature where I can find at least the description of some functions in the code? I have a good theoretical base related to the BLE, but I think that I will need to introduce myself a little more in the code and to understand some functions.

    Thanks again in advance and kind regards,

    Adnan.

  • Hello Adnan,

    Aduka_27 said:
    First of all, thank you again for these answers and guidelines.

    It is truly no problem at all, as I said I am happy to help! :) 

    Aduka_27 said:
    I did not work with nRF Connect SDK before, I only downloaded the newest version of nRF5 SDK 17.0.0. but lot of those examples are not compatible with Zephyr environment.

    Yes, when working with Zephyr RTOS then the nRF Connect SDK is what you are looking for.

    Aduka_27 said:
    I took a look on this example that you sent me, but there are a lot of code that I could not understand with my level of knowledge.

    Please do not hesitate to ask if you should have any questions!

    Aduka_27 said:
    Also, I saw that I can upload Central UART  sample on the first device, and Peripheral UART sample on the second device if I want to establish the communication between them.

    This is correct. The example illustrates how a BLE connection could be established between two devices, and have them transfer the information they receive over UART to each other over the BLE link - any information received on BLE is then outputted to UART, so that it can be seen on a serial monitor.

    Aduka_27 said:
    Also, for now I only used Minicom and I don't have any experience with Putty. Can you maybe suggest me what is the best tools

    PuTTY is a good choice for a serial monitor, if that is what you are asking.
    To setup and get started with the nRF Connect SDK I highly recommend following the Getting Started with nRF Connect SDK guide - it takes you through the necessary installation of required tools and downloads as well.

    Aduka_27 said:
    do you have any literature where I can find at least the description of some functions in the code? I have a good theoretical base related to the BLE, but I think that I will need to introduce myself a little more in the code and to understand some functions.

    That is great! a good theoretical understanding of BLE will be greatly beneficial when familiarizing with the nRF Connect SDK.
    Is there a particular function's documentation you are looking for?
    The API reference for all the drivers can be found in the SDK documentation, such as for the Nordic UART Service ( NUS ), but perhaps this is not what you are looking for?

    Best regards,
    Karl

Related