USB Cable Power Tester

Tell us about your projects. Update us regularly.
Post Reply
parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

USB Cable Power Tester

Post by parkview » Tue Mar 02, 2021 10:47 pm

Over the years, I have purchased many USB micro cables and USB iPhone charging cables. Some of these have been at the famous Shenzhen Electronics Markets, where you can find them stacked up high:
USB Cables.jpg
USB Cables.jpg (84.44 KiB) Viewed 4146 times
However, it's a buyer beware market. Size and looks count for nothing. One year, just to prove a point I purchased three fat USB cables all 'Good Quality' or so I was told. Back at the Shenzhen Steamhead Makerspace, I cut them open and yes, as expected, I found that all of them had very thin internal wires inside - coated with a fat layer of silicone plastic.

Many of us touring there wondered if we could design up a simple cable tester, sop we could check the cable quality before purchasing the cable. I know you can buy them, but I wanted to make my own PCB for this. The other day I was mindlessly swimming some laps and out of nowhere a design for placing a cable under various loads popped into my mind. It made for a wonderful swim.

The idea is, that a processor will measure the USB battery voltage and current coming into the PCB. It will then be routed out to the USB cable under test and the other end will be plugged into the board and the voltage at the other end will be measured as well. Therefore, I know how much current is flowing through the cable and the voltage drop across the cable, so Ohms Law says R = V/I, so I now know the cable resistance.

This initial design is what I call an Engineering prototype, so I have various testing points across the board and I can switch in three different loads through the cable. I can also connect the USB battery directly onto the three loads, so hopefully I can test the battery load capacity as well. If this all works out well, I can then minimise the resistor load and change the ESP32-WROOM-32D processor board to something cheaper, as this project doesn't really need to be WiFi or Bluetooth enabled!
USB_Cable_Power_Tester_v0.5.jpg
USB_Cable_Power_Tester_v0.5.jpg (154.1 KiB) Viewed 4146 times

parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: USB Cable Power Tester

Post by parkview » Mon Apr 05, 2021 5:47 pm

Three manufacturing days and 20 shipping days and the JLCPCB was in my hands. I laser cut a plastic stencil for the PCB and hand picked and placed the components before hotplate soldered it up. There was a bit of excess solder, but solder wick made a short work fix for it:
ready-for-testing.jpg
ready-for-testing.jpg (73.39 KiB) Viewed 4108 times
Next up was testing the PCB. Initially I couldn't load a program via the Rx/Tx serial port lines, but upon close examination, I found that the Tx 0603 resistor has a dry contact. A quick stab with a hot solder iron and it was good to go.

After writing an Arduino program in Visual Source Code/ProgramIO, I noticed that the Loads where not properly switched on or off. This is the faulty KiCAD schematic design for the PCB, with 5V coming in on the top LH wire (the RH 5V goes off the the various Loads):
5V-to-GPIO.jpg
5V-to-GPIO.jpg (24.46 KiB) Viewed 4108 times
I didn't notice my design error until I went and measured the MOSFET gate voltage and was surprised to find it at 5V. In my head I was thinking it should be GPIO 3.3V. A quick look at the circuit diagram with fresh eyes and yes, I could see that it would be 5V on the GPIO line when the MOSFET was switched off. I realised I should have used a N-MOSFET in front of the P-MOS to pull the P-MOS gate low and isolate the GPIO line from the 5V:
logic-level-P-MOS.jpg
logic-level-P-MOS.jpg (24.79 KiB) Viewed 4108 times
I had lots of room on the PCB to retro-fit a dead-bug style extra SOT-23 MOSFET and 0603 10K resistor. The 0603 component just fits beautifully in-between the SOT-23 Gate and Source pins!
dead-bug-fix.jpg
dead-bug-fix.jpg (38.44 KiB) Viewed 4108 times
I found that the USB out and USB in connectors where 3mm too close, as one of my test cables could not fit, so that will be fixed as well. At least I could write up most of the program to run the board and it gives me a chance to experiment with various load resistor combinations:
load-fix.jpg
load-fix.jpg (79.42 KiB) Viewed 4108 times
Time to design up the next version of the PCB.

parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: USB Cable Power Tester

Post by parkview » Tue Apr 13, 2021 10:08 am

I used the revamped board to test a number of USB-Micro cables at the April 2021 SW Makers meeting. Based on feed back from that, I have modified the design a bit and a second revision is currently being manufactured at JLCPCB.
cable-testing.jpg
cable-testing.jpg (39.96 KiB) Viewed 4086 times
I also compared my boards readings against a milli-ohm meter cable measurements:
cable-testing2.jpg
cable-testing2.jpg (54.27 KiB) Viewed 4086 times
Of course, my board is only measuring the VBUS wire inside the cable. The next revision should measure both VBUS and the Ground wire in series. It's interesting to find that a lot of cables measured quite high readings and that very few cables had a reading of under 300 milli-Ohms.

parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: USB Cable Power Tester

Post by parkview » Mon May 10, 2021 11:13 am

The next revision of the cable tester PCB arrived last week and I assembled the board yesterday. So far, the connector spacing is ok and it's working well.
Cable-Tester-V0.7.jpg
Cable-Tester-V0.7.jpg (69.51 KiB) Viewed 4023 times

After a few false starts, I found a nice Apple Lightning connector on LCSC, P/N: C168722 URL: https://lcsc.com/product-detail/USB-Con ... 68722.html that works well on a PCB. Googling around, I found some suggested termination resistors that activated the USB Lightning cable:
Lightning-connector.jpg
Lightning-connector.jpg (50.4 KiB) Viewed 4023 times

I found that it appears to work ok, although, I seem to get a 1-2 ohm cable resistance reading. Maybe that's the long 1.5m cable + the built in in-line IC resistance?

With the PCB design working well, next up is to make the PCB a bit smaller so that it comfortably sits in the palm of a hand and make it a bit more ergonomic. Maybe flip the display and user buttons onto the back of the PCB?

During the wait for the above PCB to arrive, I realised I can use the design to act as a USB voltage-current-power monitor. Of course, it's a lot larger than ones you can find on-line, however it's an extra feature of the PCB with no extra hardware costs.

you can find the PCB design files and example code here: https://gitlab.com/parkview/USB-Cable-Power-Tester

Post Reply