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

Want to communicate between two devices using customised commands

Hi

I have 2 customised board with nrf52832, I wanted to communicate between 2 devices. Like to send commands like turn on/off LED from my one board to on/off LED on my second board. If I press button on one device it should be notified at other device etc.

Which BLE functionality I should refer for this ? Do I need to create any separate GATT service for this?

Thanks,

KRA

  • Hello KRA,

    You might be looking for the BLE Blinky central and peripheral examples from the SDK - they implement exactly the functionality you describe.
    In essence, the central connects to a device that is advertising with a given name, and which has the LED button service ( lbs ). After establishing connection between the two devices and clicking a button, the LED on both boards will light up.
    The examples will probably not work on your custom boards - since they are made for the nRF52 Development Kit - but the general approach used in the code will be identical for your nRF52832 SoC.

    Best regards,
    Karl

  • Hi Karl,

    I have gone through these examples from sdk. That will serve my purpose in few cases. But in few commands I wanted to read data like string from other device. 

    Which functionality is suitable for communicating these kind of data between two devices??

    Thanks,

    KRA

  • Hello KRA,

    KRA said:
    I have gone through these examples from sdk. That will serve my purpose in few cases.

    I am glad to hear that you found the examples useful!

    KRA said:

    But in few commands I wanted to read data like string from other device. 

    Which functionality is suitable for communicating these kind of data between two devices??

    For sending a string between devices, I would recommend seeing the BLE Nordic UART central and peripheral examples.
    They emulate UART communication over BLE - i.e if something is written on the COM port of device 1, it will transfer it to device 2 over BLE, and device 2 will write the contents out on its own COM port - and visa versa.
    You may of course instead do something else with the received UART commands - such as toggling a LED - that is up to you. I will suggest that the easiest way to implement this would be to merge the relevant BLE Blinky example functionality you are already familiar with into the BLE Nordic UART examples.

    Using the Nordic UART service you may send strings / data between your devices, with minimal work required to get it up and running.

    Best regards,
    Karl

  • Thank you Karl. it seems like UART will work for me.

    I can use UART communication even if I don't want to use COM port on central side right?

    I am not sure if I can do this or not but in my application I dont want to use COM port for sending string/ data to my peripheral device.

    Thanks,

    KRA

  • Hello KRA,

    KRA said:
    Thank you Karl. it seems like UART will work for me.

    Great! I am happy to hear that you found the examples useful.

    KRA said:

    I can use UART communication even if I don't want to use COM port on central side right?

    I am not sure if I can do this or not but in my application I dont want to use COM port for sending string/ data to my peripheral device.

    You may replace the input source of the central with any source that you would like, that is fine.
    The important part for you is to see how the data inputted to the COM port is processed and sent to the peripheral - then you may do the exact same procedure with any other data, as long as it is compliant with the Nordic UART service.

    Best regards,
    Karl

Related