• I have an idea to use two Puck.js devices as a rudimentary remote temperature monitoring system.
    The two pucks would be located within about 4 metres of each other. The sensor puck will not be easily accessible once installed but the monitoring puck will obviously need to be visible. Precision is not important in this application but I envisage some form of regular heartbeat to provide reassurance that the sensor puck and the monitoring puck are working and a red flash when the measured temperature is above a set level.

    Has anyone already done anything similar that they would be happy to share?


  • I'm not sure I've seen anything specific, but I guess you have three options:

    • Have the temperature Puck advertise its temperature, and have the second one occasionally wake up and listen
    • Have the receiver Puck connect and request information from the temperature Puck
    • Have the temperature Puck connect and 'push' data to the receiver Puck

    I think either of those solutions works fine, although the first option might be easier to debug and also is probably more power efficient - especially for the sensor puck that you can't get to.

    As an example of the first idea:


    setInterval(function() {
        0x1809 : [Math.round(E.getTemperature())]
    }, 30000);


    var currentTemp = 0;
    function getTemp() {
      NRF.findDevices(function(devices) {
        var found = false;
        for (var i in devices) {
          if (devices[i].name!="Puck.js e782") continue;
          var d = E.toString(devices[i].data);
          // index of 0x1809 in advertised data
          var idx = d.indexOf(String.fromCharCode(0x09,0x18)­);
          if (idx>=0) {
            currentTemp = d.charCodeAt(idx+2);
            found = true;
        if (found)
          digitalPulse(LED2,1,50); // green = good
          digitalPulse(LED1,1,50); // red = bad
      }, 2000 /* receive for 2000ms */);
    // look once a minute for temperature
    setInterval(getTemp, 60000);

    Right now it flashes green for 'got temperature' and red for 'unable to read temperature' - so it doesn't do anything with the temperature value, but it's easy enough to change.

    The receiver won't be super power efficient, as it's listening for 2 seconds every 60 seconds. It should still last quite a while on a battery though.

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

Using a puck.js device to receive and display temperature status obtained from another puck.js

Posted by Avatar for JamesS @JamesS