Cold Chain Monitoring With Streamr, Ruuvi, And Ethereum

Henri Pihkala
Dec 20, 2017 · 4 min read
A Raspberry Pi 3 single-board computer and Ruuvi sensors

In November, we had the pleasure to demo at Slush, Europe’s biggest startup event. We had a very productive time there, with one of the highlights being our meeting with the brilliant guys from Ruuvi. This Finnish company has developed very impressive Bluetooth sensors called RuuviTags. They measure temperature, air pressure, acceleration and humidity, run on a single battery for 3 years, and three devices cost just €69. What’s even more awesome is that both the software and the hardware are open source — a perfect match for the decentralised trustless technology we’re busy building at Streamr.

Once we got back from Slush, we immediately installed a few RuuviTags for demo purposes around our Zug office. The data is freely available on Streamr for prototyping IoT stuff. Search for these stream names in the Editor to add them to your canvas:

  • RuuviDemo Zug Fridge
  • RuuviDemo Zug Freezer
  • RuuviDemo Zug Room 331
  • RuuviDemo Zug Meeting Room

Using the historical run mode in our Editor, it’s easy to inspect what a few days of data (in this case fridge temperature) looks like:

The Streamr Engine makes it easy to refine the data and connect results to Ethereum smart contracts in real-time. To illustrate this, we implemented a little cold chain insurance example.

Millions of tons of frozen foods are transported around the world everyday. So ensuring that foods remain frozen whilst in transit is really important for the end consumer. No one wants to buy defrosted then refrozen ice cream and restaurants don’t want to be cooking meat infested with bacteria. So in our scenario, a “courier” places a stake in ETH into a smart contract. If the measured temperature exceeds an agreed threshold (in the demo, 10°C), a penalty is subtracted from the stake and sent to the “beneficiary”.

In this simple demo, the Streamr Engine calculates a one-hour rolling average temperature and reports it (once every hour) to the smart contract. This demonstrates how the Streamr Engine can be used to easily build data processing oracles, reporting the calculation results to smart contracts.

We believe this is a really great (though small scale) example of machine-to-machine verification and payment.

Below you can see the live canvas, embedded onto this blog. You can also open it in the Editor.

Of course we didn’t stop there. We figured if we were going so crazy about RuuviTags, then other people must be too. So now, to make it really easy to connect data from the sensors to Streamr, we’ve created a little library called ruuvi-streamr for node.js. It acts as the glue between the Bluetooth tags and Streamr, allowing you to connect the data. All you need to do is give names to your tags. The library will take care of the rest, including creating the streams and producing data to them. This snippet powers the above demo streams using the library:

// Require the library
const RuuviStreamr = require('ruuvi-streamr')

Streamr

Open source infrastructure for real-time data

Streamr

Create, share and consume data streams on an open, scalable P2P protocol with powerful tools for monetization

Henri Pihkala

Written by

Founder, CEO at Streamr. Delivering unstoppable data to unstoppable apps.

Streamr

Create, share and consume data streams on an open, scalable P2P protocol with powerful tools for monetization