At several of our AI Racing League events, our DonkeyCars mysteriously crashed right when we were running the training processes. This only happened when we were powering the cards on battery packs or when the power supply on the barrel jack was limited to 2 amps. We tried swapping out batteries, different cables, and various hardware, but we could not reliably reproduce the problems. I felt that the problems might be related to the load in the Nvidia Nanos. I had suspected that for some reason that the Nanos were not getting enough power. The specs say they need a steady 5 volt power supply. If it drops just a few hundred millivolts the Nanos will crash.
Yet when I pulled the battery packs off and measured the batty output voltages, they seemed to be okay. When I measured the output of the ANKER Astro E1 battery packs they consistently delivered 5.1 volts, even when they were down to 25% power. We love these battery packs because at 6800mAh, they usually last an entire event, and with the PowerIQ technology, they charge quickly. They also have four LEDs that show power level so we know when they are almost fully discharged. However, despite the 5.1 voltage readings on the batteries, I knew there was something wrong with our setup. I needed some way to measure the actual voltage under load.
One of the things I love is the availability of low-cost USB voltage and current sensors you can get on eBay for a few dollars. The ones that alternate voltage and current are only about $3. I like the $8 OLED versions that show simultaneous current and voltage. These devices are great for showing the power draw of various devices like LED strips and my dozens of Arduino projects.
But what I never did, was accurately measure the voltage drop under load over a standard 3-foot long USB cable. I made the mistaken assumption that the voltage drops were negligible and that for all practical purposes, we could use whatever USB cables we wanted. Finally, I got some time to do some experiments and boy was I mistaken!
It turns out that most USB cables use very thin 24-gauge wire. 24-gauge is appropriate for low current applications like charging your cell phone where a slightly lower voltage will not cause your phone to crash. But when we are using USB cables to transmit lots of power to our power-hungry and voltage-sensitive Nvidia Nano, we were having problems getting enough voltage to the Nanos. I wondered if the cables were the problem. It turns out there were!
To verify that the cables were the source of our problems, I ran two tests. First, I hooked up a USB LED flashlight that drew around .25 amps through the current meter directly to the battery without any long cable. You can see this in the photo above. A quarter of an amp is not a huge power draw, but it is enough to demonstrate a clear voltage drop. The meter showed a voltage reading at the battery terminal was 5.1 volts. Note that the power delivered to our Nvidia Nano needs to be at least 5.0 volts. So if we had no cable, this would be great! But what if I added an additional 3-foot USB extension?
If I did this, I would only get 4.84 volts out at the LED end of the USB cable. Compared to the 5.1 volts at the battery with no cable, it was almost a .3 volt drop! Our Nvidia Nanos are very sensitive to these small voltage drops.
So the solution is to get short USB cables that have thicker gauge wires. Let me know if you know of a good supplier for these. I found these 1 foot long Anker cables on Amazon (4 for $9.99).
The diagram above claims they use the thicker gauge wire for 5-volt power and ground. Testing shows this cables eliminate the voltage drop problems. Note, I have seen 1 foot USB cables for less on eBay. Unfortunately, most suppliers don’t list the gauge of wire or resistance.
The general pattern here is we need to be able to create a hypothesis about the root cause of the problem and then devise a test to prove or disprove this hypothesis. The USB current meters proved that we had a significant voltage drop over the 3-foot USB cables. By putting in a one foot USB cable our crashes went away.
Now…off to the races!
TL/DR: DonkeyCars can have voltage drops in USB cables between the battery power packs and the computer board that causes the Nvidia Nano to crash. The solution: use shorter cables with higher gauge wires.