I frequently get asked to help with, seemingly random, behaviour of the Raspberry Pi. By far the most common cause is the power supply. Whilst the use of a USB socket for the power supply connection is very convenient, it brings a problem that many overlook. That is the DC resistance of the USB cable.
In an attempt to make cables more attractive and easier to use, many cable suppliers reduce the conductor size. This reduction in copper content makes the cables cheaper to manufacture and helps create soft, flexible, cables that appeal to the end user. BUT the thin conductor increases the DC resistance and hence the voltage drop. It is not uncommon to find poor quality leads that have a resistance of 0.25 ohm or more. Whilst this doesn’t sound very serious, you have to bear in mind that the Pi requires one wire for the +ve supply and another for the -ve, so the resistance is double that of a single wire. Simple ohms law will show you that a Pi drawing 1 amp from a 5 volt supply with 0.5 ohm of resistance in the supply lead will drop 0.5V, leaving just 4.5V reaching the Pi. This is below the Pi minimum operating voltage of 4.75V!
To help overcome the voltage drop, the official Pi power supplies now produce a 5.1 volt output. To indicate power problems, the Pi displays a lightning bolt icon at the top right of the screen. However, it is not uncommon to find a Pi based system behaves reliably most of the time but occasionally does odd things. This can be due to a short-term increase in current draw, such as accessing a USB hard drive or other peripheral. These short term drops can be hard to spot, but the Pi has a very useful system log that can be used to identify power problems. These can be observed using the following from the command line:
sudo grep -a Under-voltage /var/log/syslog | wc -l
This will return details of the number of under-volt events and should be 0 in a good system. Any reports here mean you have a supply problem.
Good Quality USB Cables
As you can see, good quality USB cables are important. The best way to be sure your have the right cable is to only buy cables that support the latest mobile phone fast-charging standards. These have to be able to carry up to 2.4 amps, so require a healthy conductor size. In my experience, Anker power cables are usually a safe buy.