Bluetooth Mesh sensor data

Hello,

I am currently working on a mesh sensor system. I have got one sensor board and one board for connecting in the mesh system.
Now I want to be able to send the sensor data from the board where it is connected to, to the other and than print it in the debugger or console or how you want to call it.

Does anyone have an idea how I can send the data that I get every second and place it in bluetooth mesh packets so it will be sent to the other board. And also how to print it when the other board received it.

Thanks :)

  • Can you maybe explain or show how the friend/LPN feature works?

    My understanding is that there is a connection between a LPN and Friend node. After making the connection there is a poll, this poll will retrieve data from the LPN, and the LPN will recieve data from the friend.

    Now these are the questions I have:

    If I have sensor data that needs to be polled, where do I put this variable so it will get sent to the Friend? Or what function do I use?

    When this data is sent, how can I make the Friend, for example, printf the polled sensor data?

    Does the friend node just save everything the LPN publishes and sends it trough?

    Can the LPN send data trough a whole network or just to the friend node, and the friend node sends it further?

  • Hi,

    Chriis said:
    Can you maybe explain or show how the friend/LPN feature works?

    I would recommend you to have a look at Bluetooh SIG's blogpost about 'friendship' in Bluetooth Mesh seen here: https://www.bluetooth.com/blog/bluetooth-mesh-networking-series-friendship/

    I think this blog explains the relation quite well.

    Chriis said:
    If I have sensor data that needs to be polled, where do I put this variable so it will get sent to the Friend? Or what function do I use?

    In general the part that makes a node a low power node is not that the node is powered of while it is sleeping. It is only the radio that is turned off, making the LPN not being in constant RX such as is typical for a device connected to the power grid. This is why you will have to do polling if you want to receive anything from the friend. If you want to send anything from the LPN, then you use the same API and procedures as you would do in a "regular" Mesh transmission. This is also explained in the spec and in our documentation, but I find that the abstraction layer is broken down pretty good in this independent blogpost on allaboutcircuits.com: https://www.allaboutcircuits.com/technical-articles/bluetooth-mesh-network-nodes-elements-node-features/

    But do note that if you're not subscribed to the channel you send the message on/to from the LPN, then the friend node is not the target for that message. In a Mesh network it is both possible to send messages to other nodes in the network and through nodes that relays messages not intended to that node to other nodes in the network.

    Chriis said:
    When this data is sent, how can I make the Friend, for example, printf the polled sensor data?

    If you had been using nRF Connect SDK, I would've recommended you to have a look at the Mesh chat sample for an illustration for how this is done. However since you're not using that you will have to find out how to do what I described in the previous section, i.e find out how to send messages to a node on a node/group address, and then for the receiving devices find out how to subscribe to said channel/group. After this is done, you should be free to (edit 1: I forgot to add the final 3 words here) print said data.

    Chriis said:
    Does the friend node just save everything the LPN publishes and sends it trough?
    Chriis said:
    Can the LPN send data trough a whole network or just to the friend node, and the friend node sends it further?

    These two questions goes hand in hand so the following should answer both:

    As the previous section mentions, the friend node does not necessarily save or see the messages, it might also just relay the messages. In the Allaboutcircuits blogpost there is an image of 3 LPN connected to a friend. These sensors/thermostats may send the data through the friend node to other nodes in the network that for instance needs this temperature data to control something else.

    Another example where the LPN/Friend relation is more direct, you can consider a wireless battery powered LPN light switch and a light bulb router-device connected to the power grid. In this case it makes very much sense for the Light bulb to be subscribed to the on/off messages sent from the light switch because it needs to know if the switch has been toggled.

    (Edit 2: Added the following sentence) It does also make sense that the switch is an LPN because it itself does not need to always be listening to messages (always be in RX) as polling messages from its friend on a schedule is enough to find out if any network configuration parameters has been changed.

    The same switch may also be controlling multiple light bulbs, so the light bulbs can then be subscribed to a group address where all devices in that group are subscribed to messages coming from that switch with the on/off clients. If the bulbs are located in for instance a street light pattern (a straight line with a long distance between each other), the first friend node that is closest to the switch will both receive and use the change in on/off as well as send the signal further down to other devices subscribed to that group.

    Let me know if this clarifies things for you and feel free to ask more questions if anything is unclear in the explaination

    Kind regards,
    Andreas

  • Thank you for the extensive explanation!


    I think it is all clear for now!

    I really appreciate the help!

  • Happy to be of help! 

    As always, feel free to create new tickets if you have any new issues or questions unrelated to this topic arises while developing and we will do our best to answer them in due time

    Kind regards,
    Andreas

  • Hello Chriis,

    I see your conversation about your project to build a small mesh network. Currently, I also started with the similar kind of project and i want to get more close to understand it well. So I would like to need some information regarding your project which can help me in more comfortable way as i just started with it. So if you are okay with it then can we talk  for a while?

    Thank you in advanced. :)

Related