In this article, I’m going to show you how to receive data from serial port, plot them in a chart and send to Pachube.
Pachube define itself “a realtime data infrastructure platform for the Internet of Things, managing millions of datapoints per day from thousands of individuals around the world”. In fact, it’s a website that allow users to send their data, have them plotted on a chart and receive data from other users; it mentions “Internet of Thinks” because often data are sent by devices directly connected to Internet (for example a Geiger counter based on Arduino, here’s the chart with collected data).
The program I’m going to show you has two main goals:
- it receives data from a serial port (for example from an Arduino) and show them on a line chart;
- it updates, with the same data, a datastream in a Pachube feed.
The program name (“AnalogDemo“) is because at the beginning it was designed to receive data read from an Arduino analog port (values between 0 and 1023, directly proportional to the voltage).
Let’s see how to create a new feed in Pachube: if you don’t already have an account, sign up to the site, activate your account and log in.
Choose Create a feed:
Type a name and a description:
Downwards, create a new datastream and click Save:
Click on the new feed:
Write down the feed id, shown in the address bar of our browser:
Pachube has an authentication method based on keys. Every user is assigned a master key,that should be kept secret. So you need to create a new key with only update (PUT) grant on your feed.
Choose My keys:
Click Create a new API key:
Choose only the PUT method, if you like you can restrict the new key to be used only from a source IP or set an expiration date:
Finally write down the new key:
In the next page, you’ll find how the program works…