Raspberry Pi USB Hub

If you followed my little “tutorial” just a few weeks you should have with your Raspberry Pi and a simple webcam, a fully functional video surveillance system, autonomous, and motion detection.

“Fully functional”? Really?

Based on my personal experience, this is far from the case.

Eating disorders

I noticed a few days after setting up this system that my RPi became – after a random lapse (a few hours to a few days) – unreachable, either by SSH or HTTP. It was then necessary to reboot it wickedly.

By consulting the logs including /var/log/kernel.log I noted numerous reports ofwrite defects on the filesystem (SD Card).

These defects sometimes led to data corruptions, which in turn forced the kernel to rewind the affected partition or partitions in read-only. Once the / partition read-only, I could get the login prompt SSH but can not identify me, the connection was always off at the opening of the session .
After extensive research, more or less successful, I finally deduced that this behavior was due to power faults, probably caused by the webcam that “pulled” too over USB.The only solution in this case was to plug it into an independently powered USB hub, then connected to the Pi.

But most of the hubs on the market do not meet the specifications that require it not to power the device to which it is connected (ie the master device, USB hubs must be powered of course).

While most computers will not find anything wrong with a hub with this anomaly, the Raspberry Pi he did not hear it that way, and this leads to connection errors with devices (so my webcam). Strictly unusable as it is.

I was able to verify this with a cheap hub of this famous discount brand that is Heden: the simple fact of plugging the RPi on the port of entry lit the diodes of activity, sign that the hub sent to him the current, which is potentially dangerous for the card (FYI, the word to look for is ” backfeed ” backfeed if it is not good).

Troubles of … er, transit

Fortunately, there is a list of USB hubs rated “Raspberry Pi-compliant” , among whom I have chosen and ordered that proposed by the English site ModMyPi . After two weeks of waiting without receiving, sending a second copy by ModMyPi (very nice for once) and the non-receipt of it after three weeks, I finally ordered the same model on eBay , Also shipped from across the Channel. And I received it! (To tell the truth I started a little to despair …)

My readings on this model indicated that it was capable of powering both the RPI via one of the four ports, in addition to other devices that could be connected to it. The original transformer of the RPI thus became useless, which saved an electrical outlet (and it is not luxury, any geek will confirm it!). So I made the connection while dd  was copying a healthy image of the system on the SD card, starting with a good foundation.

A small hodgepodge of cables later, the small computer, the hub and the webcam were connected and functional.

A solution to the active hub-ifidus

This system has been running for a few days and, without wanting to cry victory too fast, I think it has solved the problems of instability. I have absolutely nothing left in the logs indicating corruptions of data, whereas it was enough before a maximum of 24 to see them appear. If you experience the same symptoms, try this hub (or another of the list ) and that should be enough to make them disappear.

It is against rather disappointing that a power failure, rather than cause communication problems with the device responsible causes on the Raspberry Pi a failure of “vital” organs such as SD card reader , Only available mass memory. The consequence being, as I have experienced, to make the mini computer unstable and finally to plant it (not to mention the data potentially lost in passing).

This raises serious doubts about the reliability of an “embedded” system on which it would be based. I am thinking here of a 24-hour installation with poor access, type outdoor surveillance camera, weather sensor, etc. Pity.

Before closing, I want to mention that it is strongly recommended to set up the watchdog  Linux on such a system.

But in my case this was of no use because it was rarely totally planted (only inaccessible by the network), and when it was reboot did not allow to regain control because the damage on the system of Files could have touched vital files and thus prevent the boot.

It is important to note that there RPi on a watchdog  hardware to automatically reboot the card when the system is totally broken. In short, it is a counter incremented regularly by a component external to the CPU and, if it reaches a limit value previously set, délenche a hard-reset . The task of the OS is to reset this counter to zero at regular intervals to indicate that it is still responding. If planted, the counter is never reset, leading to the term hard-reset  by the watchdog. The time limit of this watchdog on the RPi is 16 seconds .