2016 NFC Ring is on Kickstarter

Herp Derp new ring

2+ years of my life is available for you to back (or not). Check it out on Kickstarter..

During this time I got married, ate a lot of curry, um, no other benchmarks really..

On a personal note.. If we raise anything < £200k I still wont see a penny, crazy huh? Don't launch new products, they drain your soul and capital. My entire drain into this product now is about ~£144k.. That's a lot of cash... I have plans to turn it around though! 🙂 The main reason of doing Kickstarter is to validate market demand. If people want it, we will make it and that proves to myself and investors it's a worthwhile venture. The more we make, the more that gets invested, and the cycle of madness continues... Hype Cycle

I’d like it if we could raise more than our initial launch but I doubt that because of the gartner hype cycle.. I’d say we’re nearer to the trough than the peak mostly because V2s are never as exciting as V1s.. We’re definitely nearing the Slope as we’re seeing innovations land elsewhere around our tech that really do improve peoples lives..

Stay frosty people and thanks for backing 🙂

Switching Profiles in Kodi using an NFC Ring

Replace profiles, IP and ring ID with your own values.

Run in a Screen

node whatever.js
var fs = require('fs');
var request = require("request");
var inp = fs.createReadStream("/dev/ttyACM0");
inp.setEncoding('utf8');
var inptext = "";
var XBMCEventClient = require('xbmc-event-client').XBMCEventClient;
var xbmc = new XBMCEventClient('node.js app');
var blob = { "id": 1, "jsonrpc": "2.0", "method": "Profiles.LoadProfile", "params": {"profile":"lydia"}};

var options = {
  method: 'POST',
  uri: 'http://user:pass@127.0.0.1:8080/jsonrpc',
  json: blob
}

xbmc.connect(function(errors, bytes) {
  inp.on('data', function (data) {
    if (errors.length){
      throw errors[0];
    }

    if(data === "."){
      return; // do nothing
    }

    if(data.indexOf("InsertRingUIDHere") !== -1){
      console.log(options.json.params);
      options.json.params.profile = "john";
    }else{
      options.json.params.profile = "lydia";
    }

    request(options, function (error, response, body) {
      console.log("changed to", options.json.params.profile);
      if (!error && response.statusCode == 200) {
        console.log(body.id) // Print the shortened url.
      }
    });

  });
});

Note that I just threw this together as a proof of concept, it needs a bunch of polish! 🙂

Kodi Play/Pause with an NFC Ring and USB NFC Device

In this example I use a keyduino but you can use any Arduino device that has the PN532 or NFC module loaded on. The Arduino has to just push out the ID of the Ring (or tag) via Serial print. This arrives at ttyACM0 and we then parse it and do some xbmc events..

var fs = require('fs');
var inp = fs.createReadStream("/dev/ttyACM0");
inp.setEncoding('utf8');
var inptext = "";
var XBMCEventClient = require('xbmc-event-client').XBMCEventClient;
var xbmc = new XBMCEventClient('node.js app');

xbmc.connect(function(errors, bytes) {
  inp.on('data', function (data) {
    console.log(data);
    // inptext += data;

    if (errors.length){
      throw errors[0];
    }

    if(data.indexOf("yourringUIDhere") !== -1){
      xbmc.notification('Resuming playback', 'Resuming playback');
      xbmc.keyPress('space');
    };

  });
});

ThreeJS is tricky, but awesome.

Over the past few months I have been using ThreeJS to create a 3D model of the NFC Ring.

ThreeJS from Wikipedia:

Three.js is a lightweight cross-browser JavaScript library/API used to create and display animated 3D computer graphics on a Web browser. Three.js scripts may be used in conjunction with the HTML5 canvas element, SVG or WebGL.

The ThreeJS community is actually really helpful, I’m not saying other communities aren’t helpful or useful I just found that the ThreeJS community did a lot more to help get me started.  There are also quite a few demostration videos online that can be used as reference material.

The real power of ThreeJS comes when you mix it with the power of Blender.

Blender from Wikipedia:

Blender is a professional free and open-source 3D computer graphics software product used for creating animated films, visual effects, art, 3D printed models, interactive 3D applications and video games. Blender’s features include 3D modeling, UV unwrapping, texturing, raster graphics editing, rigging and skinning, fluid and smoke simulation, particle simulation, soft body simulation, sculpting, animating, match moving, camera tracking, rendering, video editing and compositing. Alongside the modeling features it also has an integrated game engine.

At first I was completely stuck, the video tutorials were out of date and the documentation far too fuzzy, finally I met someone on IRC who did the type of task I was trying to to accomplish every day as his day job.  Things fell into place quickly, so quickly I thought it would be worthwhile putting together a video showing how easy the process is to model an object and export it as something that can be used in ThreeJS:

Canvas is pretty much a no-go for the work I’m doing, it’s nice to have the fallback options there but Canvas just doesn’t have the features I need to display a ring in all of it’s glory.  With that in mind if a user wants to see the ring and doesn’t have WebGL supported they are shown a message how best to upgrade their browser.

Finally we should note both three.js and blender are open source projects, completely free and depend on community donation and support. They are both evolving under great leadership and they deserve the credit and respect they get.

This is what I was able to accomplish, I’m pretty proud of it.

You can see the source code and access the assets here

Getting started with Explore NFC on Raspberry Pi in 60 seconds (Also Raspbmc)

The docs from NXP are slightly over verboose, here I make the assumption you already have a Pi installed and know a little about SSH and using the Linux Terminal. It’s worth noting I’m doing some of these steps on Raspbmc too so things may differ slightly from your environment. I will try cover both wheezy and Raspbmc

Put module onto Raspberry Pi by y’know, putting it on the Pi.. Reboot..

SSH into your Pi username pi, password raspberry
ssh pi@your-pi-ip-address

Update your Pi and install some deps
SPI was added late 2013 so it might not be available in your Kernel, doing an update is easy, do..
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install ca-certificates git-core cmake
— Make a cup of tea

cd ~ && sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update
sudo chmod +x /usr/bin/rpi-update && sudo rpi-update
sudo ldconfig

Note: If you get a prompt saying you might not need this firmware or it’s the wrong update then just skip this step.

Enable SPI (not required on Raspbmc)
sudo nano /etc/modprobe.d/raspi-blacklist.conf
— Comment out blacklist spi-bcm2708
— Change it to read (note the hash)
# blacklist spi-bcm2708

Enable Pi on Rasmbmc
sudo boblightd
For posterity further information about this fix is on this thread — Note that sudo boblightd toggles SPI pins so running it twice might not work..

Reboot
sudo shutdown -r now
— Make a cup of tea

Grab the demo polling app from my Git Repo of the NXP S/W
cd ~
git clone https://github.com/JohnMcLear/NXP-Raspberry-Pi-Card-Polling-Demo.git
cd NXP-Raspberry-Pi-Card-Polling-Demo
cmake source
make

— Make a cup of tea

Test
sudo ./card_polling

My end goal here is to use my NFC Ring to start/play/pause videos in xbmc using the Pi shield.. Wish me luck..

Q: I get Failed to open bal.
A: You forgot to run card_polling as sudo.. sudo ./card_polling