So far we have developed a sensor box and sensor sampling software for Arduino, using home energy meter as a data source. Hence, we have a setup that provides measurements of current energy consumption once per second, ready to be plugged into a USB port of a PC. However, all this will be of little use without a piece of software that stores the data stream into a file. And again, these data files are pretty pointless without means for visualizing their content as graphs or scripts that calculate interesting statistics from the tens of thousands of individual samples.
We must start by making a few decisions. The first thing would be to decide which programming language to use on the PC side. For hobby projects - and why not for professional work as well - I recommend the Python programming language, because it is pretty easy to learn, comes with all kinds of great libraries, and in general allows you to do wonders with just a few lines of code. Over the years I have learned to value that last part, especially in prototyping and hobby projects: the less code lines you have, the easier it is to comprehend and memorize the whole thing, which makes at least me much more productive.
Python runs on many different platforms, so you can choose any one that you like - probably it is Windows, Mac or Linux. Personally I prefer open source solutions especially at home tinkering projects, so I choose Linux. Since this article is written with beginners in mind, we'll go with the Ubuntu flavor. However, to stay focused to sensors, I won't go through setting up the operating system nor installing Python to it - there's plenty of resources available for both and you know how to use Google. Besides, in Ubuntu it's already set up - just type python in console to start the interactive shell. If you prefer to use Windows or Mac, that won't be a problem as Python is easy to install.
We are fortunate in that for Python there are truly excellent tools available free of charge as add-on libraries: Via PySerial we get access to computer's serial ports for reading the data stream from Arduino. With the aid of the Matplotlib library, we can create incredibly useful plots with just a few lines of code. Statistics and general number crunching will be handled with ease via the Numpy library. These tools are really vast in features; we will barely scratch the surface. However, you should find that they are also rather simple to use and you can easily expand the examples given here to create more fancy stuff on your own - which is the goal of this article series. Now, let's get going.