UPDATE: Get excited, because PubNub and Tessel are hosting a Hack Day on October 25.
How does PubNub make Tessel awesome?
It’s easy to program your Tessel to communicate over the internet, but you can make Tessel even more powerful using PubNub’s global Data Stream network. Using PubNub, Tessels can instantly publish data that they’re collecting on a global scale — for example:
- The current temperature or humidity from the climate module
- Changes in orientation detected by the accelerometer module
- The data from your contactless key-cards through their RFID module
Here’s a super-simple PubNub/Tessel integration:
In this super-simple example, an LED on your Tessel will toggle on or off whenever a message is received on the channel “tessel-light“. To test this, you can send a message by using the PubNub Developer Console. Simply change the channel name in the Developer Console from my_channel to tessel_light, and click Send (the red button in the message box.)
How do I get this code on my Tessel?
Tessel has an amazingly simple code deployment system, which they have documented in their quick-start tutorial. Briefly, plug your tessel into your computer’s USB port and issue these commands:
brew install node
npm install -g tessel
tessel wifi -n [network name] -p [password]
- Download the example PubNub gist file: pubnub-tessel.js
tessel run pubnub-tessel.js
At this point, your Tessel should be up and running and connected to your WiFi network. To confirm, you can execute the Tessel blinking lights demo or the PubNub blinking lights demo above.
Publishing to the Internet of Things using Tessel and PubNub
In the above example, we’ve seen how Tessel can consume a PubNub data stream and react to it by blinking an LED. We can also get our Tessel to publish information about its environment, which can be aggregated and acted upon by other devices (including other Tessels!)
Let’s look at an example which detects loud sounds in its vicinity using the ambient module, and notifies the world about them:
If you snap your fingers within a few feet of the Tessel’s ambient module, you’ll be able to see a message sent out over the tessel-light channel notifying you that a sound event has occurred. We could use another channel name for these events, but we chose tessel-light because it works well with our prior LED demo. In fact, if you run this example on one Tessel and the prior LED example on another Tessel, you’ll see the LEDs on the later tessel blink whenever the first Tessel senses an audio event!
This is the power of PubNub with Tessel: you can easily build a large number of smart, connected devices and have them communicate seamlessly with each other, whether it is two devices communicating together, or hundreds of millions of devices. PubNub allows your Tessels to communicate with each other and the Internet of Things at scale, without having to worry about resource bottlenecks.
Update: We also have a PubNub-Tessel examples GitHub repo.