Follow the steps in this guide to join the Internet of Things using NodeJS, Bluetooth and 10 powerful sensors. You will need the BeagleBone Black IoT Solution Kit Buy KitBuy Kit See All Parts

What Exactly are we Using Here?

You may have seen this guide in parts, however I like everything in one place, on one page and appropriately up to date. Or as much up to date as I can possibly do, technology moves so fast!


IMG_20160413_233704.jpgTexas Instruments (TI) have this interesting little board called a Sensor Tag and the version I have is a CC2650 running the default firmware. To update the firmware, you need the right cable to plug into it. This cute little board comes with a plastic enclosure, that then can be contained within a rubber sleeve. I imagine you could have a number of these devices placed around though with them being Bluetooth you're going to have to be in an open area or have thin walls, it is 2.4Ghz after all.


What's ridiculous (in a good way) about the Sensor Tag is that it comes with 10 sensors on board, and it can sync with any Bluetooth device, including your phone, you can even expand it to add more sensors to it. I'm not sure why you'd want to add more sensors to it, because it already has these:


  • "10 sensors including support for light, digital microphone, magnetic sensor, humidity, pressure, accelerometer, gyroscope, magnetometer, object temperature, and ambient temperature"


Elementary, my Dear IoT


Those clever people at International Business Systems (IBM) have been developing a way to make sense of data, lots and lots of data, in various different ways. It may be an artificial intelligence, or it may just be intelligent ways of looking at data. I'm not entirely sure, it helps to watch a video and make sense of it all.



Since all things Internet will be creating a lot of data, it makes sense that Watson is thrown at IoT. You will need to sign up for an IBM Bluemix account to be able to work through attaching your IoT sensor(s) to it. Fortunately, there is a free tier of Watson IoT for us to play with, however this can scale up to cover thousands of devices with some amount of data traffic and storage. It is a little weird, even if you select Free you're put into the Free Trial, just see it as a nice 'try before you proceed' affair.


You need not be Sherlock to join Watson

In a few easy steps you can sign up for then IBM Bluemix account before we look at the hardware you'll need to get started with IBM - Explore IoT



{gallery} Joining IBM Watson


Step One: Visit the IBM Explore IoT site and click Sign Up


Step Two: Fill out your details on IBM Bluemix


Step Three: Confirm Sign Up with your E-Mail


Step Four: You'll be put onto a premium trial first, but this falls back to a free account.


Step Five: At the login prompt, your IBM ID is your e-mail


In case you missed it in the image gallery overlay, your IBM ID is your e-mail address.


What do I Need to Get Started?

Set yourself up with IBM and the BeagleBone Black with the Texas Instruments SensorTag. Follow the steps in this guide to join the Internet of Things using NodeJS, Bluetooth and 10 powerful sensors.

BeagleBone Black IoT Solution Kit Buy KitBuy Kit

The kit consist of the following 5 items:

BeagleBone BlackBeagleBone Black

TI Sensor Tag CC2650TI Sensor Tag CC2650

Bluetooth 4 USB AdapterBluetooth 4 USB Adapter

8GB microSD Card8GB microSD Card

Ethernet cableEthernet cable with a connection to the internet.

*You need a way to write to a microSD Card from a laptop or desktop computer.


With this hardware I'm making the assumption that you're going to plug the Beaglebone Black into a wired network. Yes, I know that it is possible to setup a 'soft network' using the USB cable that comes with the BeagleBone Black and connecting it to your computer. However, I discovered that the driver bundled with even the latest Debian image does not work with Windows 10 64bit, you're advised to compile the driver yourself. If you don't have a way to view the desktop on the BeagleBone Black (it does require a mini HDMI to something sensible cable) then you won't be able to setup WiFi either. So I suggest plugging in an Ethernet cable to a switch, whether that's a home gateway or on the same network as a computer that's running a DHCP server. If you're not connected to the internet via this connection, you'll have to scour the packages and offline files for yourself.


Setting up the BeagleBone Black

20160414_154133.jpgLet's get set up with a reasonably up to date version of Debian Linux. Angstrom hasn't been the default stable for the BeagleBone Black for a while now and thankfully we can use the armhf architecture from Debian. You can download the latest Debian 8.3 Jessie image. If you're using Linux then the setup of the microSD card is straight forward, you can use unxz as a command (or you can even use simply 'xz -d', search your distribution's repository if you don't have either) to extract the downloaded image file, and then use dd to write the image file to the microSD card using something like this:


sudo dd if=./BBB*.img of=/dev/sdX


Be wary using BBB*.img as the filename if you have more than one image file in the folder you're running this command in. The command is ran from a terminal window, and /dev/sdX is an example name of your SDCard device reader where the microSD card is plugged into. If you're not sure which one it is, then you're going to have a fun dance with "ls /dev/" and dmesg commands as you plug/unplug your SDCard into the computer and correlate the names as to which device is your SDCard.


On Microsoft Windows, you can use win32DiskImager, insert your SDCard into your reader, select the appropriate drive letter and the .IMG file, after extracting it with something like 7-Zip and write it to the card. However, I encountered a problem when using win32DiskImager and writing the Debian image, it wouldn't do more than 2gByte of data sometimes and I had to resort to using Linux. Now, it may have been a faulty microSD card, or it could have been Windows to blame. Just be wary that if you're not able to write properly to your SDCard that you may need to try a different operating system, or your card is broken.


Once you have your microSD card setup, you can insert it into your BeagleBone Black and connect power to it. Either by powering it with the USB cable or a wall wart rated at 5V, perhaps above 1Amp. Ensure your BeagleBone Black is connected to the wired network.


Accessing the BeagleBone Black on the Network

There are many different ways you can find out what the IP address is of the BeagleBone Black if you haven't connected it to your computer using the USB port, ranging from a network scan using nMap (don't run that on corporate networks, your network administrator won't be happy) to looking up the DHCP allocation table on your network router. The method you use will be entirely dependent on your network setup and how you've chosen to connect to it, and unfortunately we won't be covering that here, but by all means ask in the comments below.


You'll want to login to the BeagleBone Black via SSH, using either PuTTy on Windows, or just ssh on Linux. You can login as root as by default there is no password set and root is permitted over ssh, alternatively the username and password is:


User: debian

Pass: temppwd


Once you're connected to your BeagleBone Black then it's time to ensure that your distribution is fully up to date. To keep track of any potential problems, separately you should run:


sudo apt-get update

sudo apt-get upgrade

sudo apt-get dist-upgrade

sudo apt-get autoremove

sudo apt-get clean


This will update your operating system, and you should run through this set of commands at least twice in case any packages are held back. A command I run when I'm being quick, dirty and lazy is:


sudo apt-get update; sudo apt-get upgrade -y; sudo apt-get dist-upgrade -y; sudo apt-get autoremove -y; sudo apt-get clean -y


Which goes through them autonomously, use at your own discretion. Yes, those are semi-colons between commands.


Configuring the BeagleBone Black and the Sensor Tag to Access IBM Watson

What we're going to do now involves using the repository software called 'git'. From here we're going to get hold of software from github, and then modify it because it's out of date. I did consider forking the repository and having this fixed in an element14 repo, but I think it serves as a good example to introduce you to the code and also using git.


The software basically downloads and installs bluetooth and also sets up nodejs which is a set of Javascript libraries.


Make sure you're connected to the internet and we'll download the git repository, effectively cloning it from github and then change to that directory. First you should navigate to your home directory, and we're assuming here that you logged into the BeagleBone Black as the root user:


cd ~/

git clone

cd iot-beaglebone/samples/nodejs


There is a setup script which should take care of everything for you. If you logged in as root, you do not need sudo:


sudo ./


Take note of any error messages that you see, this bundled up setup script which installs the packages of bluez and libbluetooth-dev. It also performs an 'npm install'.


Fixing the Code

There is a Javascript file which we have to alter ourselves, This is not hosted in github, but is likely pulled through when npm is run, so it is not necessarily straightforward to have been able to apply a preliminary fix.


We need to replace a file after successful running of the script, the file is attached to this blog post, you can download the file by using wget:




This will download the file to the current folder you are in, you then have to move the file to replace "iot_beaglebone/samples/nodejs/node_modules/sensortag/lib/cc2650.js". We should be able to do this in one command, like so:


wget  -O ~/iot_beaglebone/samples/nodejs/node_modules/sensortag/lib/cc2650.js


This is to fix an API change in the node/javascript calls. The -O parameter here may not strictly be correct,


Using the IoT Cloud


Now to associate the Sensor Tag with the BeagleBone Black and use it with the IBM Watson service:


cd ~/iot_beaglebone/samples/nodejs

node iot_sensortag.js


Registering your Device


Now you'll want to register your devices in the IBM Watson IoT Platform, there is also a Quickstart where you can check what information the device(s) are sending.