IoT – Smart Gateway with Intel Edison & TI Sensortag – Part 1

A dear colleague of mine provided me with a Texas Instruments Sensortag

Unfortunately this present was connected with the request to get it running with my Intel Edison and the Smart Gateway.

This blog will be part one of my endeavor.

Update the Intel Edison

My Intel Edison still runs the old firmware, so the first thing I would like to do is to bring it to the newest software/firmware level.

So after downloading and unzipping the most current version ( V3.0 in this case ), I started

./flashall.sh

which is part of the firmware package from Intel.

Please follow the instructions from the flash utility!

/Users/psteiner/Downloads/iot-devkit-prof-dev-image-edison-20160315
==> ./flashall.sh
Using U-Boot target: edison-blankcdc
Now waiting for dfu device 8087:0a99
Please plug and reboot the board
Flashing IFWI
Download [=========================] 100% 4194304 bytes
Download [=========================] 100% 4194304 bytes
Flashing U-Boot
Download [=========================] 100% 237568 bytes
Flashing U-Boot Environment
Download [=========================] 100% 65536 bytes
Flashing U-Boot Environment Backup
Download [=========================] 100% 65536 bytes
Rebooting to apply partition changes
Now waiting for dfu device 8087:0a99
Flashing boot partition (kernel)
Download [=========================] 100% 6127616 bytes
Flashing rootfs, (it can take up to 5 minutes... Please be patient)
Download [=========================] 100% 1302792192 bytes
Rebooting
U-boot & Kernel System Flash Success...
Your board needs to reboot to complete the flashing procedure, please do not unplug it for 2 minutes.

With the new firmware up and ready, we will have to login to our Edison and reconfigure. If you are unsure how to connect to the console of your Edison, please ask your friend Google about it.

I am always a fan of using the newest version of whatever I work with.

root@edison:~# opkg update; opkg upgrade

Enable Bluetooth on the Intel Edison

With the Firmware and software packages on the Edison now being all “up-to-date”, let’s start by activitating bluetooth and connecting to our TI Sensortag.

Login to your Edison and perform the following steps to activate bluetooth.

root@sensortag:~# rfkill unblock bluetooth
root@sensortag:~# hciconfig hci0 up

With bluetooth activated, we can try to connect to our SensorTag. Don’t forget to turn it on! 😉

root@sensortag:~# bluetoothctl
[NEW] Controller 98:4F:EE:06:08:7E sensortag [default]
[bluetooth]# scan on
Discovery started
[CHG] Controller 98:4F:EE:06:08:7E Discovering: yes
[NEW] Device C8:69:CD:4F:1D:A3 C8-69-CD-4F-1D-A3
[NEW] Device B0:B4:48:C8:6D:02 B0-B4-48-C8-6D-02
[CHG] Device B0:B4:48:C8:6D:02 Name: CC2650 SensorTag
[CHG] Device B0:B4:48:C8:6D:02 Alias: CC2650 SensorTag
[bluetooth]# scan off
[CHG] Device 7A:02:30:86:C8:DC RSSI is nil
[CHG] Device B0:B4:48:C8:6D:02 RSSI is nil
[CHG] Device C8:69:CD:4F:1D:A3 RSSI is nil
Discovery stopped
[CHG] Controller 98:4F:EE:06:08:7E Discovering: no

In the scan you can see that our SensorTag has been identified and you can and should note down the MAC-Address.

Reading data via node.js

Before we add Node-Red to the setup, let’s first try to read some data via “plain” node.js

For this we will use some code created by another colleague of mine.

root@sensortag:~# cd
root@sensortag:~# git clone https://github.com/burrsutter/ti_sensortag_node.git
root@sensortag:~# cd ti_sensortag_node/
root@sensortag:~/ti_sensortag_node# node temp_humidity.js
discovered device with UUID: b0b448c86d02
connected
discovered services and characteristics
notifyHumidity
 temperature = 20.9 °C
 humidity = 31.7 %
 temperature = 20.9 °C
 humidity = 31.7 %
 temperature = 20.9 °C
 humidity = 31.7 %

Well, seems to work we can continue.

Installing Node-Red

For the installation of Node-Red, please take a look at my earlier blog.

With Node-Red installed, we can add the nodes to interact with out SensorTag. For this you will have to connect to the console of your Intel Edison again and perform the following steps

root@sensortag:~# cd
root@sensortag:~# npm install node-red-node-sensortag
root@sensortag:~# reboot

Please note, that up to this stage of my writing, I have not automated the activation of Bluetooth on the Edison, so after every power-up, you will have to perform the following steps.

root@sensortag:~# rfkill unblock bluetooth
root@sensortag:~# hciconfig hci0 up

Hopefully at some point in time, I will find the time to solve that as well!

After the reboot, we can login to Node-Red via the Browser-UI of Node-Red. Use the IP-Address of your Edison and Port 1880.

In the “Advanced” section of the Node-Red nodes, you will find our newly installed “SensorTag” Node.

sensorTag

Drag in onto the canvas and double-click it to change it’s properties.

Depending on what data you want to read, select the corresponding checkbox.

sensorTag

Now add the “Debug” Node and connect the two Nodes.

sensorTag

After deploying the flow, there should be a comment right below the “sensorTag” Node showing it’s status. It should start with “discovering” and result in “connected”.

sensorTagIf it does not, that you probably forgot to activate your SensorTag or the Bluetooth functionality on the Edison.

After a short while, the data coming from the SensorTag should be logged in the Debug panel of Node-Red.

sensorTag

As you can see, the Node reports the selected data in JSON format, so later processing should not be an issue.

For how to integrate this data into my Smart Gateway, please stay tuned!

, , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: