Do you have frustrating issues with your Raspberry PI

 

Are you experiencing problems with your PI, you can’t explain or figure out why? You bought what you thought where good accessories (Keyboard, Mouse, WIFI adapter and cables), well read on, you may discover your problem is simply the USB cable between the power adapter and the PI. Don’t rush out and blow money on the 5.25V fix everything power adapter because you may end up no further ahead and if you’re really unlucky damage the PI.

 

Raspberry PI common problems or questions

· Raspberry PI reboots randomly

· Raspberry PI keyboard stutter

· Raspberry PI Crashes Randomly

· PI Ethernet stops working after a few hours or less

· Forums tell me I need to get a 5.25V power supply for my PI, or 5.5V even…?

· Whenever I plug in my WIFI adapter or other USB device it reboots the PI

· Are all USB A to micro B cables the same just different lengths?

· Back feeding USB power to the PI

· Can I damage my Pi by back feeding power?

 

Why am I doing this article

My son is at university, he has to use a PI for assignments in computer science classes, in order to better help with coaching him I bought one of my own to use at home (In a hope to be one step ahead of him ) I very quickly discovered issues with repeating keys and un-expected restarts, I diagnosed the problem to the USB cable quite quickly but read up on the issue online anyway(Just in case). After reading through many forums on the issues it became very clear to me that people were being directed in the wrong direction to resolve their problem. Mostly shorting out fuses or replacing the correct 5V adapter with a 5.25V one. Did these fix the problems… in some cases yes but at the risk or voiding warranty or worse breaking the PI or simply deferring the problem until the day an additional device gets added where the problems start all over again


Description of the working of the PI power grid.

NOTE: I am deliberately simplifying the description below by not using all the formal electronics engineering terms in order to be more understood by people who do not know them. Please do not flame me for this, I am trying to help a larger audience and apologize to those who do know the correct terms.

Input Power from Wall adapter to the PI

Ignoring Power stations, distribution to your home etc., we start at the wall outlet, here we plug in the power adapter, this is recommended to be an adapter rated at an output of 5.0 Volts at 1000mA (1Amp)

This then has a USB cable that plugs into the adapter at one end and the PI at the other. The cable can come in lengths of a few inches to well over 6 feet. You will see later, longer is not always better, but then again nether is shorter in some cases.

The PI micro USB power connector

This connector is ONLY used to provide power to the PI, it cannot be used to transfer data

The diagram below shows that the power from the wall adapter (Direction of the Arrow) goes into the micro USB connector (VBUS - VIN) and then through an 1100mA fuse (F3 in the diagram).

Also note in the diagram “TP1” and “TP2”, this is the test points on the PI circuit board used to measure the voltage level on the board. When connecting a test meter to these pins it should read +5V0 (5 Volts) as indicated on the label top right of the diagram. We will use these pins later when we run some real tests.

USB INPUT PI.png

Regulators that supply the PI internal circuits and the GPIO devices (If any)

If you don’t understand the diagram, don’t worry, the description should be enough for you to understand what is happening.

USB INPUT 2 PI.png

The 3v3 regulator (top) feeds (From pin 3) all the internal circuits and the GPIO connector as well as supplying the 2V5 (middle) and 1V8 (bottom) regulators, this 3V3 regulator must be supplied with power that is at least 1.2V above the output power which works out to be 4.5V (3.3V + 1.2V). This means that if the input power goes lower than 4.5V the output of the 3v3 regulator can start to go unstable affecting the Ethernet and other parts of the PI. Oh and a note to a few people that provide advice on the various forums, there is NO 5V regulator on the PI, it relies on the wall adapter for this.

USB Output connectors

In earlier PI revisions, there used to be fuses just before the USB connectors limiting the output power to connected devices, this was causing many issues with users who connected anything other than the simplest of devices, as a result the makers of the PI removed them thereby limiting the total power protection to the first fuse mentioned above (F3). You will note that the same +5V0 label from the above diagrams is also on the top left of this diagram. They are all connected together meaning the only thing between the devices connected to the output USB and the input USB power adapter is the F3 fuse.

USB INPUT 3 PI.png

Don’t be fooled into thinking you can happily connect devices to the GPIO and USB ports that add up to 1100mA (Including the power the PI takes), you can’t. The rating of this fuse is the point at which it will “Blow”, the sustainable current is only 700mA above which the fuse will start heating and increasing its resistance causing the power on the other side to slowly fail and eventually the PI will reset or start behaving erratically, this could be minutes or even hours after the initial power up.

This is not a permanent problem, the fuse is resettable and if disconnected from power for a while it will heal itself and start to allow power to flow correctly again. It may take several hours or even days to fully recover which means if you use the PI too soon after blowing it may not work correctly even if you now unplug those extra devices. You need to give the fuse time to heal.

Test Setup

In order to be able to measure the power being drawn through the USB cable, I will have to cut into the wires carrying the power, rather than damage the test wires I have modified one of my older but good quality extender cables. It contains thicker wires for the power than most modern cables and therefor will have little impact on the results and in addition I shortened it considerably.

In order to simplify the connections, I completely cut the extender cable, soldered the ends onto a breadboard either side of pin headers so I can add jumpers to create a pass through or remove one or more to be able to perform measurements, in addition I added a very low value resistor (0.010Ω) to allow measuring the mA flowing through the wires. This will have little effect on the measurements, I could have used the meter to measure the mA directly but this would have also added several feet of addition wire.

You can see in the pictures below the results of this as well as the markings on the outside of the cable indicating the gauge of the wires within, later you will see how much thicker the actual wire is compared to the test cables.

Homemade made break out cable

P1010086320x240.jpgP1010116320x240.jpg

Black jumper is removed to measure mA flow. I will use the 30mV range on meter due the use of the 0.01Ω resistor, this will give me 10mV per 1000mA flowing

P1010084320x240.jpgP1010085320x240.jpg

Overall test environment

P1010087320x240.jpg

Keyboard, Mouse (Plugged into the Keyboard), WIFI module, HDMI connected screen, breakout cable connected at the power adapter end of the USB cable under test, Agilent U1272A (Orange) 4 1/2 digit meter and my old but trusty Master Craft (Grey) 3 1/2 digit meter

The orange meter was connected across the terminals on the break out board where the black jumper was installed in the previous pictures, this will monitor the mA flowing but still allow me to disconnect the meter for other measurements without shutting down the PI, the master craft meter was used to measure the voltage across TP1 and TP2 on the PI board itself.

P1010069320x240.jpg

I will use averaging on the Agilent meter to measure the power flow once the PI has booted, this will give a better reading for our calculations later, once I have performed the initial power measurements I will repeat with my oscilloscope and graph the voltage on the GPIO header from initial power on through to the PI being stable at the main screen (About 60Seconds duration), this will allow us to see how the power dips and jumps around during the startup and show any spikes that the meters can easily miss

USB cables to test

I found five different makes and sizes of cable, nothing bought specifically for this test and all supposed to be quality cables. Only three had markings indicating their “Claimed” internal wire gauges. The other two had no markings at all. I numbered each one with tape and a sharpie and used a white board to keep track of measurements. Each cable was measured in order to allow me to calculate the resistance per foot after we have taken the readings.

P1010078320x240.jpgP1010076320x240.jpgP1010080320x240.jpg

P1010075320x240.jpgP1010077320x240.jpg

Preliminary Checks

I used the power adapter that was provided by the store I purchased the PI from, this is a regular 5V 1100mA wall wart and should be sufficient for most things you should connect to the PI.

In order to have full set of measurements I started out with simply measuring the output of the adapter with nothing connected , then with only the PI and HDMI screen attached and finally added the Keyboard, mouse and WIFI adapter. I also decided to see how much current would be drawn if I connected a USB hub un-powered to the PI (It took almost as much as the PI on its own… wow!)

The results are below. These results are not part of the USB cable test but I was curious, you can see that adding USB devices adds significant load to the PI (Don’t forget the fuse on the board starts to blow above 700mA)

TEST

Current

Volts

Comments

Power Supply only

5.212V

Measured on the breakout cable

PI with HDMI attached

332mA

HUB + KBD, Mouse, WIFI

960mA

USB Hub with no devices

626mA

HDMI + HUB but no keyboard, mouse or WIFI adapter

Powered USB Hub

340mA

Now power the hub to see what’s left powering the PI

Testing

The actual test procedure is simple, connect each USB lead in turn, power up the PI and wait for it to boot up, measure the current and the voltage at the breakout board and the voltage across TP1 and TP2, rinse and repeat for each cable noting the readings as I go, subtracting the two voltage readings gives me the drop across the length of the test cable. When I calculated the resistance in ohms per foot, I doubled the length of the cable as it contains two wires involved with powering the PI, one for the positive supply coming from the power adapter and one for the ground going back to the adapter.

P1010088320x240.jpg

Note the PI in the diagram above is rotated 180deg from earlier pictures as it was easier to measure this way during testing.

Below are a few sample shots of the meter readings during testing

P1010089320x240.jpg

Waiting for the PI to boot up and for the readings to average over more than 200 samples

P1010091320x240.jpg

With cable 2 and the WIFI, Keyboard and Mouse attached, the PI would not boot sucessfully, it would start, get so far and reset, this cycle would keep repeating so in order to test the cable I removed all but the HDMI output and repeated the test. This is why the lower mA reading (The reading is in mV so multiply by 100 to get the mA (Remember the 0.01ohm resistor)

P1010094320x240.jpg

As I was curious if the PI could deliver up to the rating of the power adapter, I added a USB Hub (Un Powered) and connected my WIFI, KBD and Mouse to it and powered up the PI, as you can see, the power consumed is just over an amp or 1009mA, I only left it like this for a few seconds as I did not want to blow the fuse on the board, note also the volts was down to 4.5V, way below the recommended limit for 5V devices and most older USB devices too. Even if the fuse did not blow, I can pretty much guarantee the PI would behave badly.

Results

So finally to the results.

The definition of the table headers are as follows:

· Vin is the voltage measured across the blue and black jumpers on the breakout cable, this gives a reading of the output of the power adapter.

· Vout is the voltage measured across TP1 and TP2.

· Amps is the current powering the PI and its attached devices measured in Amps (1000mA), ohms law works better if all units are in the same scale (Amps, Ohms, Volts).

· Vdrop = Vin – Vout.

· is calculated using ohms law formula I=V/R so after re-factoring we get R=V/I.

· Length ft is the length of the cable in feet to the nearest 3”.

· Ω/Ft is the /2* the cable length.

· Error is the deviation from the standard AWG specification’s for a 28AWG cable.

Cable

type

Vin

Vout

Amps

Vdrop

Length ft

Ω/Ft

Error

1

No Mark

5.182

4.800

0.651

0.382

0.587

2.75

0.107

66.7%

2

28AWG

5.190

Would not power up successfully

3.25Removed Devices

2

28AWG

5.190

4.280

0.365

0.910

2.493

3.25

0.384

499.3%

3

28AWG

5.179

4.860

0.667

0.319

0.478

1.50

0.159

149.1%

4

28AWG

5.185

4.640

0.672

0.545

0.811

6.00

0.068

5.6%

5

No Mark

5.168

4.490

0.668

0.678

1.015

2.50

0.203

217.2%

* Ohms per foot divided by two as the cable is positive out and negative return

 

So in summary,

Cable 2 is absolute rubbish, even though it claims to be 28AWG is can’t be, I will rip it apart to see in a while.

The winner for resistance (Ω) per foot is cable number 4 but because it is 6’ long it does not have the lowest voltage drop, this cable is not the best to use given my choices but is the most accurate to the specifications.

The best cable for the job at hand has to be number 3, it has 3 times the resistance but because it is 4 times shorter than number 4 it drops less volts.

If all cables where the same length then clearly cable 4 would be the obvious choice.

OK, so we have rated the test cables and found good and really bad ones, great, but what is actually happening on the PI board to make things go bad, well I hooked up my oscilloscope to let you see…

P1010104_edited320x240.jpg

The best cable (3) shows the power go straight to 5V and after about 20seconds settles down, the worst spikes dipping down to 4.25V probably as components are powered up during boot.

P1010103_edited320x240.jpg

The worst cable (2) clearly has a problem, the PI cannot even boot, it keeps getting so far and then resets and tries again, you can clearly see where the 5V supply dips below 3V, once I’m done with this test, the cable is going in the trash, bin for you Brits J… I’m one too so no worries, I’m not having a dig.

P1010098_edited320x240.jpg

Sorry about the glare on this one. I think this was cable 5, either way it did allow the PI to boot and seemed to work ok, but you can clearly see even here the volts during boot up dip well below the recommended operating volts for a 5V device (4.75 – 5.25V). If I ever started to get problems, it could easily be this cable and I discovered later that when I plugged in and out the WIFI module it sometimes rebooted the PI, this never happened with cable 3.

 

Time to dissect cable 2.

So cable 2 clearly claims to be 28AWG as can be seen in this photo of its markings

P1010083320x240.jpgP1010109320x240.jpg

After carefully stripping the outer layers to reveal the inner cables, they look to be thicker than the signal wires from my breakout cable but much smaller than the power wires (which is correct as the power wires are 20AWG and the signal wires 28AWG) The test cable is the lower in the right diagram, the upper is an off cut from my breakout cable for reference.

P1010110320x240.jpgP1010113320x240.jpg

Now were getting somewhere, I stripped the wires to reveal that the test cable indeed has thinner wires than advertised, you can clearly see that the wires on the left are significantly thinner than the “signal” wires on the right in each of the above photos, and on top of that there not even tinned

P1010120320x240.jpg

As a final act I separated a strand from each cable, both show signs of oxidation but then my breakout cable is over 10 years old, the test cable is at most 4months old

What have I and hopefully you learned from all of this

1. Don’t buy cheap cables for powering your UDB devices (Unless there really short), if you’re paying only 2 or 3 dollars (1-2 pounds) for a cable, don’t be surprised if you get issues if the cable is used to charge or power your devices. If it is only used for data as would be the case with say a printer cable, then it will probably work ok, other than that… NO.

2. If you think you need a 5.25V adapter or even a 5V5 one, NO YOU DON’T, you have an issue with something else and as you now have seen, it is probably with the USB power cable. Remember that the recommended limits for typical 5V logic devices is 4.75-5.25V, if the 5.25V power adapter is a little high on the volts, you are risking damage to the PI, it may never happen but is it worth it now you know the facts?, laso the higher volts will simply cause your device to dissipate more heat which can lead to premature failure in the worst cases.

3. If your suffering from one of the other symptoms listed at the top of the article, look to your USB power cable first, if you don’t have a better one, try removing as many devices as you can and see if the problem goes away. A typical keyboard (Not a fancy one with backlit keyboard and displays, I’m talking the 20$ kind) will typically only draw about 50mA, a mouse will be closer to 100mA, WIFI adapter between 50-150mA depending on make etc. an unpowered USB hub with no attached devices, over 300mA. Pile them all on and you’re asking for trouble, look at the preliminary test above for details.

Back feeding USB Hubs

So, what about back feeding USB hubs and the like. This is a USB hub that has 5V supplied out of its upstream port. This is not meeting the technical specifications for USB hubs so should not happen. But it does.

You can check to see if your hub back feeds quite easily, simply plug the HUB into the PI USB out port (Not the power port), power up the HUB ONLY, if the PI also tries to boot up, the hub is back feeding power.

This can cause problems if the PI is powered from one power adapter and the HUB from a different one, depending on the difference in volts between the HUB power and the PI power, (there will always be a difference). So if you do want to use a back feeding hub, the best approach will be to have one cable going from the PI USB Out port to the HUB, allowing data to the HUB and Power to back feed to the PI . This will in most cases work just fine and probably won’t cause problems to the PI. Remember in this configuration the fuse (F3) on the PI will not be protecting it, you will be relying on the HUB to limit the power to the PI and on a cheap HUB there may be NO protection between its power adapter and the usb ports so a short on the PI GPIO for instance could cause many Amps to flow into the PI and could easily damage it… proceed with caution.

But there is a potential problem with the back feeding hubs beside what I just mentioned, USB power requirements allow the USB device voltage to go down to 4.5V or less for newer devices. The PI is not designed to work at that voltage and therefor if you try this and get problems, measure the voltage across TP1 and TP2 to make sure it is over 4.75V and if not go back to a none back feeding hub and two power adapters

The best solution for stability is a 5V 1100mA adapter for the PI with a good USB cable, and a Powered None Back Feeding USB HUB. Use the HUB for all your attached devices. This will minimize issues if your cable is not the best. If you can, find a USB cable with 20AWG power wires and 28AWG twisted pair data. See the picture of my breakout cable for what the markings would look like on the cable.

About Cable Selection

20AWG is thicker wire than 28AWG, most USB data wires are 28AWG and that works great. Power on the other hand is a different matter, the longer you want to cable to be, the thicker you should have the power wires in order to minimize the voltage drop under load

Reference AWG Table

Resistance in Ω/Ft

Wire Gauge

(AWG)

Chassis
Amps

Transmission Amps

0.010

20

11.000

1.500

0.016

22

7.000

0.920

0.025

24

3.500

0.577

0.064

28

1.400

0.226

0.103

30

0.860

0.142

0.164

32

0.530

0.091

0.206

33

0.430

0.072

Chassis Amps is the recommended max current when the individual wire is used within a case for wiring up electronics circuits, this would typically be short cables with air surrounding the wires to dissipate heat

Transmission Amps is the recommended amps for a wire used to transfer power over longer distances than that found in chassis, and also the wire may be bundled tightly with other wires and have outer insulation etc, this prevents heat from dissipating as easily into the surrounding air and therefor has significantly less power rating than the wire on its own, technically speaking a USB Cable is a transmission cable so if you look at the 28AWG wire it is only recommended to handle 226mA, this is why on my breakout cable you will see 20AWG (1.5Amps) used for the power and the 28AWG reserved for the signal (DATA) wires.

Here are a few links to cables that should work in this regard: (NOTE: I do not have interests in any of these cables nor do I receive any payback, these are from a simple google search, I have only included cables where the ads specifically claim the wire sizes )… Sorry Element 14, I could not find any cables meeting my search criteria even though you have numerous selections, they do not specify the wire sizes? So where not included

22AWG .96A 6 ft long. http://www.newegg.ca/Product/Product.aspx?Item=N82E16812189234

22AWG .96A 3.5 ft long. http://www.ebay.com/itm/1-2M-USB-2-0-A-to-Micro-B-5pin-Male-Charger-Sync-Data-Transfer-Cable-22-28AWG-/181095048890?pt=US_PDA_Accessories&hash=item2a2a1b26ba

24AWG .57A 3 ft http://www.amazon.com/Monoprice-3-Feet-Micro-24AWG-Ferrite/dp/B004C4WEVI/ref=sr_1_9?ie=UTF8&qid=1394215740&sr=8-9&keywords=USB+A+to+Micro+B+20+AWG <- use with a HUB

Or make your own

28/20AWG 6 ft extender http://ca.mouser.com/ProductDetail/AIM-Cambridge-Emerson-Connectivity-Solutions/30-3008-6/?qs=sGAEpiMZZMsgIz308WEU02gs7EWvcZdW4h02r%2fA08oY%3d

extender cable.jpg

Cut off the extender connector and replace with http://www.adafruit.com/products/1390 type B micro connector (You will need to be able to solder or know someone who can do this for you)

Micro USB Connector.jpg

This is the only option I have found that will give you a 20AWG 6ft USB cable, if you can find a really short USB A to Micro USB B (6”) then you can avoid having to cut and solder and simply use the short cable as an adaptor, or get an actual adaptor. http://www.amazon.com/StarTech-USB-Micro-Cable-Adapter/dp/B001K9BEJ6

Micro USB Adapter.jpg

Unfortunately there are so many cables to choose from that do not specify the wire size it is very easy to get a bad one, the best advice I can give right now is keep it as short as possible or use a 20AWG extension cable and either modify it or add a very short adapter

 

Ok, that’s it, I hoped you enjoyed the report and learned something along the way

I welcome feedback on this post, please keep it civil and constructive. If you have other ideas to share, I would love to hear them

 

My name is Peter Oakes, I am an electronics engineer for over 38 years specializing in industrial Electronics additionally trained in calibration and maintenance of automated test and measurement equipment. I’m also a seasoned software engineer both with embedded systems and enterprise commercial software. Recently I have begun designing and building home automation devices and fun things with LEDs etc using Atmel and TI micro-controllers. You can contact me through this forum or at peter@thebreadboard.ca, come visit  my new web site: www.thebreadboard.ca where I will be adding more and more interesting stuff regarding home automation, micro-controllers and gadgets and custom tools