• Hi,

    I visited FosDem and I was amazed of the "smartwatch-that-can-run-JavaScript" ! all week now I read a lot about Bangle.js 2 and other Espruino devices, such as Puck.js! I kinda regret that didn't buy one from your stand.

    I also showed Bangle.js 2 to my children and they were amazed too. They asked me if they can "chat" from one watch to another/ can get sensor data from one-another watch and if yes what is the range? Can it be done also with 3 watches? I didn't find any app doing it, they will try to write their own (good way to learn developing), they are interested if it is possible.

    Second question, I saw many interesting posts / videos how to program/ use Puck.js v2, very nice device and I feel bad I didn't watch it closer at FosDem. Can I combine it with bangle.js 2? For example Bangle could vibrate if I press the button on Puck, or I can get the temperature, light etc reading from the sensors on Puck. What could be the battery life of Puck for reading the temperature let's say every 1 minute and transmit it?

    Thank you guys!

    P.S. I have the card "Create your first app at espruino.com/ide" all week long on my desk ;)

  • I have two apps you could take a look at:

    1. Show Nearby: https://banglejs.com/apps/?id=shownearby­
      Also see https://forum.espruino.com/conversations­/378100/

    2. Espruino Control https://banglejs.com/apps/?id=espruinoct­rl
      You can use that to send a command to a Puck, e.g. E.getTemperature() for reading the temperature. The range is about 2m I would say.

  • Hi,
    I wrote a small proof-of-concept app a while ago that uses the textinput and ble_uart modules to implement a minimalist chat app. It is quite hackish as it literally executes JS on a nearby Bangle to print a message (this also highlights one of the security issues with a Bangle with BLE enabled in general). The range is quite limited, 2m doesn't sound too far off...

    function send_text(a) {
      NRF.requestDevice({filters:[{ namePrefix: 'Bangle.js' }], timeout:3000}).then(function(device) {
        return require("ble_uart").connect(device);
        function(uart) {
    uart.write("if(typeof(_oldg)!='undefined­')g=_oldg;g.clear();E.showMessage('"+a+"­');g.flip();Bangle.buzz(300);_oldg=g;g=G­raphics.createArrayBuffer(8,8,1);\n").th­en(()=>{uart.disconnect(); load(); }, (error)=>{E.showAlert(error).then(()=>{l­oad()});});
        function(error) {
  • Just to emphasize: "Long Range Bluetooth" should give much more than 2m and is possible with Bangle2.js (not Puck though as far as I know).

    @user140377: Did you get feedback from people? How far does shownearby work?

  • I did not test long range bt.

  • Ah, sorry. From "I have two apps ..." I got the impression you wrote them, but see now that Gordon did.
    Anyway, I do have two bangles here so will give it a try this evening.
    Since this test app uses GPS it`ll only work outside. Would also be interesting how well it does between adjacent rooms.

  • Sorry, I did not want to make that impression. I'm obviously not a native speaker.
    But I have another suggestion: You can attach a LoRa module to a Puck, have the Bangle communicate with the Puck and use the LoRa for long range communication.

  • Sorry for the delay - I was off last week and didn't get a chance to follow this up.

    But yes, 'show nearby' uses the long range Bluetooth so should work quite well. Long range is a bit strange in it can either be an advertisement (easy) or it gets negotiated for a connection if both devices support it. I'm not 100% sure when it get used and I don't think we can force it onthe Bangle yet.

    ... so the long range advertising would be the best bet. The show nearby app could be modified to (rather than using GPS) advertise a line of text, and then the listening device could scan and display that when it changed - I'd be happy to help with an example if you want, but chat should work fine.

    Puck.js v2 - can I combine it with bangle.js 2?

    Yes, absolutely! using the Puck with Bangle.js is pretty much the same code as if you were talking from a Bangle to a Bangle.

    What could be the battery life of Puck for reading the temperature let's say every 1 minute and transmit it?

    This basically does that already: https://espruino.github.io/EspruinoApps/­?id=bletemperature

    And power usage should be around 25uA on average I think, so the battery should last just under a year. If you reduced the advertising interval you could increase that substantially though.

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

Can I create a "chat" app between two Bangle.js 2 watches? Can I use Bangle.js 2 with Puck.js ?

Posted by Avatar for nas @nas