node-red & ble uart

Posted on
  • Hi @Gordon,

    How can Puck's UART service be connected from node-red ?

    I have installed https://www.npmjs.com/package/node-red-c­ontrib-ble-uart and created a sample workflow as suggested, but Puck does not appear. Any thoughts ?

    Thank you!

  • I usually use EspruinoHub to bridge from MQTT.

    However one of the steps to set up Noble (the lib that contrib-blue-uart probably uses) is to run the command:

    sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
    

    Have you done that? It might help? If node doesn't exist you might have to change it to which nodejs

  • Hi @Gordon,

    I would like to call a function on Puck from node-red. Am I on the right way with contrib-blue-uart or that could be done with EspruinoHub too ?

    Thank you!

  • Either way will work. contrib-blue-uart is a less Espruino-specific way that doesn't require a separate service, but EspruinoHub will be able to pick up advertising data and report it back via MQTT.

    Info on using EspruinoHub to send commands to Puck.js here: http://www.espruino.com/Puck.js+Node-RED­

  • Hi @Gordon,

    I have used your advises in the link above to build my flows. But now I need to call a function called "myFunc" on the specific Puck and read the result rather than reading the advertised data. How can I do that ?

    Thank you!

  • Ahh - I'm afraid that functionality isn't built in to EspruinoHub yet.

    You might be able to do a write to /ble/write/_address_/nus/nus_tx followed by a write (contents don't matter) to /ble/read/_address_/nus/nus_rx after a delay, and then listen on /ble/data/_address_/nus/nus_rx but that would only return the last 18 characters or so of response (plus some formatting characters).

    To make it better you could ensure you send "\x10print(your_function())" (that's character code 16 at the start) - which will ensure that the data you receive is only the data your function returned.

    However in this case, you're probably better off using contrib-blue-uart - did you get it working?

    The advice above ("\x10print(your_function())") will still help you though.

  • Hi @Gordon,

    I am using https://www.npmjs.com/package/node-red-c­ontrib-ble-uart
    Here on the sample workflow there is a On/Off input to BLE followed by ToString function dumped on the output.

    I cannot make it scanning even with the advises above. Once done, how can I send the command to the specific Puck with xx:xx:xx:xx:xx:xx address ?

    Thanks!

  • I've just tried node-red-contrib-ble-uart and node-red-contrib-ble, and I can't make either of them work properly (although node-red-contrib-ble actually looks more promising).

    Not sure what to suggest really - you could contact the authors of those modules/post on their GitHub pages? Puck.js is a standard Nordic UART device, so they should definitely be able to work.

  • Hi @Gordon,

    No response from both owners of UART modules for node-red. Now complex is that to appear in EspruinoHub ?

    Thank you!

  • It shouldn't be too hard to add - are you interested in trying to do it yourself?

    I'd:

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

node-red & ble uart

Posted by Avatar for user73560 @user73560

Actions