Thursday, April 18, 2013

Raspberry Pi - 600,000 records and counting

There has been some talk on the community forums about the longevity of SDHC cards. Usually, a figure of 100,000 read/writes per sector is quoted whenever someone requests a hard number.

As part of my project for monitoring my standby generator, I decided to log temperatures. 3 different sensors report their values once a minute 24/7. These values are logged in a SQLite database. The application has been running successfully since mid-December of last year (2012). The size of the database at the time of writing (April 18, 2013) is rapidly approaching 500 MB. The total number of records is close to 600,000.

Since there appears to be some uncertainty as to the longevity of SDHC cards, I decided to do weekly backups of all vital directories using WinSCP. Not that it would not be a complete disaster if the card were to give up the ghost, but it would just be nice to have only a gap of maximum of a week, rather than have no data at all if I didn't do back ups.

I am not at all sure if any sectors on the card get written to more than others. The card really appears as a black box to me, and why shouldn't it? All I can say is, so far, so good. Who knows what tomorrow will bring. As with everything else in life, nothing is certain.

It is quite astounding though how quick data access can be. As part of the web page that I wrote to enable the monitoring of all this data, the user has the ability to have the Pi generate a graph with hourly ambient high and low temperatures for a give date range. If you take the widest possible range - from December 15, 2012 to April 17, 2013 right now - the page generates in around 2.5 seconds. That's almost 3,000 datapoints. Very briefly, the application retrieves the ambient value at the top of the hour for every hour of every day in the date range from the database and then has gnuplot these values. In addition, as part of every webcall, the last 30 values for all three sensors are retrieved as well and plotted in yet another graph.

Not bad for a 2.5 Watt computer.


No comments: