Avatar for user71302

user71302

Member since Dec 2016 • Last active Apr 2018
  • 1 conversations
  • 5 comments

Most recent activity

  • nfc

    in Puck.js, Pixl.js and MDBT42
    Avatar for user71302

    Seems the PuckJS with NFC should be best suited to a task with some form of dynamic message content that could contain some of the on-board sensor data or a time stamp. Also a good use case would be to setup some encrypted secure communications via BLE or wi-fi. Also firmware or software updates could be transfered through NFC. It would be most useful if you could do two way communications but read only is somewhat limited for a vast majority of use cases.

    I can't think of a use case for a dynamic changing URI but would think URI with additional NDEF records with certificate or auth key would make more interesting use case. This would require ability to craft multiple NDEF records which tags allow, especially the larger tags with more bytes of memory. It is very limiting if all you can do with the PuckJS is a simple ultralight tag with a URI record. For the static URI use case it would be much better to purchase an ultralight tag which are very inexpensive and consume no power as they are powered by the reading device and provide read/write functionality.

    For any kind of security use case you would need to make sure the tag had unique serial #ID/MAC that was not programmable, then you could form an NDEF record that could be encoded and validated as belonging to a specific device making for high security application. That is the advantage of NFC over BLE as it is considered more secure because of limited range (Near Field) and could be used for payment transactions. Also nice for providing secure access to specific devices.

    My domain of interest is in Electric Vehicle charging and how to control access to EV charging. Also of interest is vehicle information from OBDII CAN bus for fleet, vehicle VIN, and EV State Of Charge (SOC) information. All possible use cases for the PuckJS as it is a low power consumption device, small footprint and relatively inexpensive.

    If anyone is doing anything with OBDII I would be interested in a post on this topic as the PuckJS might make a good device to remote the CAN Bus info to a mobile device through BLE or NFC for some secure payment, vehicle to EV charger, or access control type applications.

    John

  • nfc

    in Puck.js, Pixl.js and MDBT42
    Avatar for user71302

    Since the nRF52 is read only tag how can I format NDEF records for different TNF types other than URI.

  • nfc

    in Puck.js, Pixl.js and MDBT42
    Avatar for user71302

    Does anyone have working code example of how to read an NDEF record from a NFC Tag. I havent been able to scan for cards or read a NFC record from a card.

    NRF.on('NFCon', function() { ... });

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user71302

    Thanks. I knew it was probably because of my code as I'm new to JavaScript and only able to access my Puck.js with my Android Phone. Tough writing code on a small phone screen. Was very surprised that my Mac didn't have BLE and my iPad either. Still trying to get operational on my a Linux BBB but saw other were using on PIE so should be possible.

    Thanks for sharing your code and showing me other ways to accomplish the display of temperature. I also wanted to be able to handle three digits and possible use the amber led. I want to expand this project to monitor and set alarm thresholds but for now the display is a great start to learn JavaScript and Puck.js.

    Again Thanks,

    John

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user71302

    I'm sure there are better ways to do this but I wanted to visually show the temperature on the Puck.js.
    I setup to flash lights for temperature digits. First digit flash Red LED number of times to indicate Ten's, and flash Green LED number of time to represent temperature units digit.

    Why does the following code fail after running for a period of time?
    Lights go crazy and doesn't represent temperature

    var on = false;
    var index = 0;
    var iterate = 0;
    
    var tempF = Math.round(E.getTemperature() * 9 / 5 + 32);
    var digits = tempF.toString().split('');
    iterate = parseInt(digits[index]) * 2;  // multiply by 2 for on and off LED state
    
    // toggle LED's on and off.  repetitions - twice the number of times you want to flash
    // first flashes Red LED, then flashes Green LED.
    // Red indicates Tens and Green indicates Units for Temperature Deg F
    // Count flashes indicates the Temperature.
    // Example:  7 Red Flashes and 2 Green Flashes indicates 72 Deg F
    var flashLEDs = function setIntervalX(callback, delay, repetitions) {
        var x = 0;
        var intervalID = setInterval(function () {
            on = !on;
            if(index === 0) {
             LED1.write(on);
            } else {
             LED2.write(on);
            }
            callback();
            // terminate when repetitions reached
           if (++x === repetitions) {
               LED1.write(false);
               LED2.write(false);
               clearInterval(intervalID);
               index++;
               // start up Green Units LED, iterate repetition per index of 1 from temperature digits
               if(index === 1) {
                  iterate = parseInt(digits[index]) * 2;
                  index = 999;  // make so doesn't process any additional digits
                  // TODO process n digits of temperature
                  setTimeout(showTemp, 60000);  // every minute
                  flashLEDs( function() {
                  }, 400, iterate);
               }
           }
        }, delay);
    };
    
    // showTemp gets called every minute
    var showTemp = function() {
    	index = 0;
    	tempF = Math.round(E.getTemperature() * 9/5 + 32);
    	digits = tempF.toString().split('');
    	iterate = parseInt(digits[index]) * 2;
    	flashLEDs( function() {
    	}, 400 iterate);
    }
    
    setTimeout(showTemp, 1000);  // start up after 1 second
    
Actions