• I am currently working on a small project with a bangle.js 2 and my goal is to collect data during the day and when I get home I would like that when the bangle detects the espruinoHub it sends the collected data and then, with nodered I send him the confirmation of receipt for the bangle to clear the data.

    I know, I think, advertising, but I have trouble understanding how to connect in uart and exchange data with espruinoHub, nodered and Bangle.js 2

    Would there be someone kind to direct me to the right tutorials and reference or who could give me a sample code to help me orient myself?

    Thank you

  • I guess you probably already spotted it but there is some general info at http://www.espruino.com/BLE+Node-RED

    What I'd suggest is instead of the Bangle detecting EspruinoHub, you work the other way...

    • The Bangle sets its advertising based on whether it has data or not (http://www.espruino.com/BLE+Node-RED#det­ecting-button-presses) - maybe you advertise data only if you have some available, and then if there is data available you advertise some unique number representing that data (the day number?)
    • NodeRed then scans for those advertisements:
      • If the advertisement number is there and is a number that Nodered doesn't have, it downloads it
      • if the advertisment number is there and is a number that Nodered already has then it instead sends a command to delete it.

    Downloading

    For this you want some function on the Bangle that'll send all the data via the UART... So something like http://www.espruino.com/Data+Collection#­simple-example

    Then to download you do something like http://www.espruino.com/BLE+Node-RED#con­trolling-the-puck and then send the command getData()\n

    Then you just listening on /ble/data/c7:f9:36:dd:b0:ca/nus/nus_rx and decoding the packets of data as they come in.

    BUT... honestly decoding the data and keeping track of what you've got could end up being quite hard to do using NodeRed. I'm not really fluent enough with it to know.

    You might actually find it easier going direct with a custom Node.js app and https://www.espruino.com/Interfacing#nod­e-js-javascript

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

Send data to EspruinoHub with bangle.js 2 and send back confirmation to delete old data

Posted by Avatar for user149221 @user149221

Actions