• Hi there,

    For a project, I would like to use several Puck.js devices acting as wireless sensors. A computer would serve as the BLE central device, collecting the data.

    So far so good, anyone would advise me to use broadcasting, and it would be fine as long as data quantity to be sent is kept low. But I would like to send as much datapoints as possible, like x,y and z acceleration for each Puck.js every 500ms or more if possible.

    For such a use-case which BLE profile would you advise me to use? I originally thought of HID profile with binary data encoded in base64, but I also need downlink to send command to the Pucks.js.

    If anyone has a clue about which BLE profile would best address my needs, I would love to hear about!
    In the meantime, I wish you all a happy Easter.

  • @Jean-Philippe_Rey

    If your setup works for the uplink, could a parallel - independent - same-setup work for the downlink as well?

    Of course, this means doubling the BLE devices per sensor location and make the pairs talk to each other as well as on the data collecting side a peer for broadcasting the commands?

    It reminds me of the old days - not so long ago - when browser communication was kind of a one-way initiation. Long polling on separate connection and related protocols were the answer to overcome the technical limitations.

  • @Jean-Philippe_Rey

    addendum re protocols - google it. Used it before sockets were available. Roundtrip times were amazing despite the http overhead. Almost real time I could control the (trojan horse modified) firefox browser... or less intrusive, talk to single page app in another browser over the internet via a nio tomcat / getty server in the internet.

    • Bayeux protocol / CometD project
    • BOSH
  • Hi @allObjects, thanks for your inputs.
    I am not sure BLE can transport HTTP yet, but the protocols you are suggesting are inspiring me and I start to think that a custom protocol, based on a custom profile, could be an answer to my problem. At least it could help me challenge the BLE stack to reach the bandwidth limit

  • For such a use-case which BLE profile would you advise me to use? I originally thought of HID profile with binary data encoded in base64, but I also need downlink to send command to the Pucks.js.

    the easiest may be the nordic uart already used for espruino console, you can just print values to console as json data - that's how gadgetbridge connection with phone is done on bangle.js too. x,y,z every 500 (or even 100) ms does not need any kind of bandwidth optimization as currently single BLE packet can hold about 50 bytes of data

    you may be limited in how many concurrent connections the central device can handle, if this is an issue then advertising may be better/easier as there is no connection with that

  • @Jean-Philippe_Rey,

    I was not expecting BLE to do HTTP. It is more about what you got out of it: inspiration by the solution pattern of using for the 'down/command direction' what works for the 'sensor data collection direction'.

  • the easiest may be the nordic uart

    I'd advise this too. It's just super easy, and Espruino handles this more efficiently than a custom BLE service. If you're looking at x/y/z every 500ms bandwidth isn't going to be much of an issue for you at all though :)

  • Thanks everyone for your inputs!

    I'd advise this too. It's just super easy, and Espruino handles this more efficiently than a custom BLE service. If you're looking at x/y/z every 500ms bandwidth isn't going to be much of an issue for you at all though :)

    For one Puck.js it seems definitely to be the best way to go, however I would like to have let's say 5 or more Pucks running simultaneously, and 500ms is a minimum. I did not explain well what I was trying to do: I would like to build a 3d motion sensing platform, a bit like what they use in film-making for motion capture. I am unsure of the precision I will get but it is worth a try.

    At first I was thinking of using a Raspberry Pi as a central device, able to establish several connections simultaneously, but I would also love to try and evaluate the performance of an Espruino device as a central device, if the feature is being added to the firmware at a given time ;-)
    Currently, I think that the EspruinoHub (MQTT) could help me implementing the central device.

  • Ahh, that sounds like a great idea - if you're looking at a bunch of sensors then you may end up limited to using Bluetooth advertising though. Not that it's such a bad option - it's quite nice not needing to pair the devices...

    I think the max connected devices is 6 or 7 on most PCs, and if you have a bluetooth mouse/keyboard/headphones that eats in to that number...

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

I need advice for building a bandwidth-optimized link over BLE

Posted by Avatar for Jean-Philippe_Rey @Jean-Philippe_Rey

Actions