Thursday, April 18, 2013

Raspberri Pi – problem with power supply cable

Last week, one of my Raspberry Pi's locked up after it was physically moved while powered up. The symptoms showed up when I tried to connect to it through Remote Desktop. To troubleshoot and solve this, I hooked up a monitor to the HDMI port (through an HDMI-DVI converter) and tried rebooting. The Pi didn’t start. Since the SDHC card was rather stock, I reimaged it with Raspian Wheezy. Another reboot. This time it started, but the SDHC was corrupted, and showed sectors invalid. I tried a new card. It booted properly. Solved! (or so I thought). I installed xrdp, the remote management protocol and tried to reach the Pi from my laptop. It hung, after closer inspection I noticed that networking had dropped out, the message in syslog was "Link beat lost". During  scanning of the  forums I noticed how there seemed to be a general trend to blame this on the power supply. So I replaced it with a spare. Same problem. I then hooked up a volt meter to the 5V pin and GND. When running, but more or less idling, it showed roughly 4.65 volts. When I tried to start Remote Desktop, it dropped to 4.55 volts and then networking failed.

At long last, I decided to swap power supply cables. Problem solved. DVM showed steady voltage level of 5.05 volts. Remote Desktop started properly and remained connected for the duration of the session.

I bought a bunch of micro USB cables on eBay a number of weeks ago. The faulty cable was one of them.

The moral of the story: not everything on eBay is naturally a bargain.

Raspberry Pi - Power consumption

A few years ago, I bought a Kill-A-Watt meter. This device allows you to monitor your electricity usage for a single electric/electronic item through an LCD display. It measures Watts consumed by whatever device is currently plugged into its outlet, as well as total kWh consumption over the number of hours the television/fridge/radio/charger has been been plugged into the Kill-A-Watt meter.

Recently, I plugged in my Raspberry Pi, which was running several Python applications and let it run for 40 hours. The results? Power consumption over 40 hours was 0.09 kWh, or 2.3 Watts per hour.

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.

extendedgraph