"Bridge" to the internet?

Posted on
  • Hi Folks

    I know that the puck and Bangle (and others) can be accessed and programmed via BLE on a BLE capable device and that they don't have a WiFi stack. However I'm confused as to how I can "bridge" a connection so that a puck (for example) could report something from a sensor (such as light or temperature) to a website sitting on the public internet.

    Or being able to call a url on the public internet (such as IFTT or Zapier) to trigger other workflows based on the puck's sensor data?

    I get that I can host an Espruino Hub on a raspberry Pi 3 which would give me control in the sense that I have a web server running on my local network - but would I be able to forward/proxy an HTTP request to another domain (again on the public internet) or is there an easier, simpler method to accomplish this?

    Appreciate any help or directions...

    Cheers

  • Sun 2021.10.17

    Hi @user135414

    have you by chance read over this thread?

    Banglejs connect and share information from/to website

  • Hi @Robin

    I had not in fact read that page and those referenced by that page. I have done so now - and will do so again in more detail, however, either I'm still misunderstanding something or I phrased my question poorly.

    I understand that I can host a page or pages on a website on a public url - but I need to access that page from a BT enabled device while I am in range of the puck for this to work.

    I'm trying to understand how I can get or send data to the puck from a url on the public web while I am not within BT range of the puck. i.e. it's truly remote (let's say the puck is at home, I am in the office and I want to know the temperature or light reading from the puck).

    The puck itself cannot connect to my home WiFi for example - so how do I "bridge" the connection so that my puck has internet access?

    Thanks a lot for your speedy response earlier - much appreciated.

    Cheers

  • Hi,

    The puck itself cannot connect to my home WiFi for example - so how do I "bridge" the connection so that my puck has internet access?

    Realistically right now there's EspruinoHub which you mentioned. With that you can either:

    There is however also https://blecon.net/ which does pretty much exactly what you want using an old phone as a bridge. I'm not 100% sure if it's freely available yet, but they do have a good Espruino implementation.

    Finally Robin mentioned Gadgetbridge, and while right now that doesn't support sending data to the internet, as part of the Bangle.js 2 kickstarter I will be adding that functionality, so hopefully by the end of the year you'll just be able to use Gadgetbridge.

    There are other options like using ESPHome or rolling your own, but maybe they're not quite as flexible

  • Hi Gordon

    Thanks to you (and Robin) for the responses. I appreciate all the feedback and the speed of reply.

    I'm looking forward to seeing the updated implementation of GadgetBridge to support sending the request(s) to the internet.

    Will this be limited to only working on the Bangle.js 2 or will the original Bangle.Js also be able to make use of this feature?

    Cheers

    PS: Blecon looks like a great alternative in the meantime, thanks for pointing me in their direction!

  • Will this be limited to only working on the Bangle.js 2

    No - the idea is actually to ensure it works with all bluetooth Espruino devices :)

  • @user135414

    I have the puck in a public room downstairs. Since I cannot access it from the 3rd floor (out of bluetooth range) I have placed an old iPhone in a locked room close to the puck. This phone has access to wifi and internet. When I open my website with the phone, it connects through WebBLE to the puck (just like the electricity meter example). I have added some Javascript (infinite loop) to the website which calls an URL (XMLHttpRequest) once a day passing data from the Puck-object. This works quite well. However, if the connections is lost (for whatever reason), I'll have to walk downstairs, refresh the website to reconnect to the puck. Still have to see how often this will be the case.

  • You might be able to make the website force a reconnect if the connection fails?

  • Yeah, well, but it needs a human input to reconnect. Since I am not near the phone below and there is no way to remotely control an iPhone ... I'll have to walk downstairs.

  • but it needs a human input to reconnec

    You're using the Puck.js library I guess? Maybe that could be improved, because Web Bluetooth itself shouldn't need human input to reconnect (just to choose the device in the first place)

  • Oh, really? Yes I am using this library. That would be quite an improvement! Unfortunately, I don't know how to do this ...

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

"Bridge" to the internet?

Posted by Avatar for user135414 @user135414

Actions