Since I assembled my rig with my solar panels and my raspberry pi 2, I have been recording its uptime. It gave me an idea about battery capacity, and about controller efficiency.
When I had the bad controller, the battery would never be fully charged, so the PI would eventually use all available power and shut down. So I had a good idea about cloud coverage – dark days would see it turning off earlier. Usually, it would turn on around 9am, but because the PI’s boot process takes quite some power than its idle state, it would start and shut down several times, until sunlight was enough to keep it running, and it would run until 8pm (that was winter).
I would see something like this:
Fri Nov 13 20:10:01 CET 2015 20:10:01 up 1 day, 8:46 Sat Nov 14 10:10:01 CET 2015 10:10:01 up 8 min
Note that it shut down about 8pm, and restarted fully around 10am the next day.
In rainy/cloudy days, things would be even worse:
Sun Nov 15 15:10:01 CET 2015 15:10:01 up 45 min Mon Nov 16 10:20:01 CET 2015 10:20:01 up 8 min Mon Nov 16 13:40:01 CET 2015 13:40:01 up 3:28 Tue Nov 17 11:40:01 CET 2015 11:40:01 up 1 min
It would shut down as early as 3pm.
Somewhen during this spring, I changed the controller, and now the Pi can run overnight, as the battery holds much more charge than before (same battery). Which is nice, but on the other hand, invalidates my data.
Recording the output of the uptime shell command is problematic, as well. As you see above, the output is not standard. For less than one hour it shows the minutes, and for more than a day, it shows something like
Sat Jul 9 23:50:01 CEST 2016 23:50:01 up 3 days, 16:27
So the output is not useful in this way. Much easier is to record the data from /proc/uptime directly. So, now I record the date, the hour, and the uptime, in a simpler way, in an SQL table. Just check the one-line shell script at github.
Since I have all this data, I would like to visualize it, as log files are boring. I was looking for a solution. I am no data visualization expert, but I think that generating an image every couple minutes with GNUPlot would be overkill.
So, what data do I have? The date, the time, and the uptime. I wanted to see when the PI would turn on, and for how long. A simple way would be something like the contributions to github, or this: Calendar View. But it would not show the on and off times.
Recently I started to get bombarded with spam from something called “cayenne”. It looks like this:
They claim to be the internet of things for the raspberry pi, so I gave it a try. The thing installs a daemon on your pi and you have no idea what the fuck the thing is doing. Besides, it does not let you add custom widgets. I only wanted one thing: the uptime. I can’t install it. It seems that they were an arduino thing and decided to jump in the Raspberry Pi wagon later. To me, it was useless.
Comes MagPi, initialstate and Minecraft.
I subscribed to MagPi, the official raspberry Pi magazine. It is great, and I couldn’t recommend it more. Besides, they give you a Pi Zero with a subscription (I know it’s just 5 dollars, but good luck finding one. Plus, the specialized usb, hdmi and camera cables don’t come with it for 5 bucks).
The magazine had some tutorial on terraforming Minecraft. Because it is a time-intensive process, they spit the processing output to a website, in order to monitor progress. The website is https://www.initialstate.com.
Much like Cayenne, they claim to be the internet of things for Raspberry Pi. Different from Cayenne, it actually is.
You can send raw data to it (either as a python script or something as simple as a URL POST request), and it will show it in a number of ways. Like this example:
Ok, so I can settle for a line graph for my uptime.
The limitations of this one:
The recorded date is not the one I have logged: it’s when data was submitted to the website (the python library sends the current system date). So, I can’t use all the data I have – it would just show as sent right now.
It does not let you edit the data. You either submit it or forget it.
So, I am still trying to figure out how to send all the data I have to it, or find another solution. If you have any idea, let me know – and congratulations to have read up to here!