This is only a preview of the November 2021 issue of Silicon Chip. You can view 45 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "USB Cable Tester – Part 1":
Articles in this series:
Items relevant to "R80 Synthesised Aviation Band Receiver Kit":
Items relevant to "Pocket Weather Station":
Items relevant to "Model Railway Carriage Lights":
Items relevant to "Two- or Three-Way Stereo Active Crossover – Part 2":
Purchase a printed copy of this issue for $11.50. |
Cable
U
S
B Tester
It’s frustrating when a USB device doesn’t work, and you don’t know if it’s a
problem with the device itself or the cable. This is a huge problem if, like us,
you have a drawer full of USB cables and don’t know which ones are good
or provide power only. Bad cables can also cause intermittent problems.
Now there is an easy way to test all manner of USB cables; this USB Cable
Tester is so handy, we think you will find it indispensable!
Part 1: by Tim Blythman
T
here is not much worse than an
intermittent fault when it comes to
checking and diagnosing faulty gear.
It’s worse if it is due to a dodgy cable
because you can never be completely
confident that you have ruled out other
problems. So it’s crucial to be able to
test cables for this reason.
These days, a lot of gear connects
with USB cables and not just when it’s
attached to a computer. Practically all
mobile phones use USB for charging,
and they’ve also found many niche
uses due to their ubiquity, even for
devices like shavers and toothbrushes.
So we’ve designed a USB Cable
Tester that can check practically all
standard USB cables. If you’re like us,
you probably have a mix of the latest
cables (such as USB-C) and a good
number of older types (such as miniand micro-USB).
The USB Cable Tester will test any
cable with either a USB-C or USB-A
(2.0 or 3.2) plug on one end and any
USB-C or USB-B plugs (such as 2.0,
3.2, micro or mini) on the other end.
With some basic adaptors, you can also
test common variants such as OTG
(‘on-the-go’) cables and non-standard
cables, such as those with USB-A plugs
at both ends.
28
Silicon Chip
This device is compact and automatic. Simply plug a cable into the
appropriate sockets, and it immediately gives you an assessment. You
will know straight away if the cable
is suitable for your purpose.
Testing
The USB Cable Tester performs two
primary tests. Initially, the various
conductors in each cable are tested for
continuity at low current.
This test can pick up whether, for
example, a given lead has the appropriate internal data connections for
USB 2.0 or USB 3.2, or whether it can
carry power only.
It can also detect internal short circuits which can interfere with normal
operation.
The Tester can also perform a
high-current test on the VBUS and
GND leads to establish how much
current the cable can handle without
dropping excessive voltage.
Checking the ability of the cable to
carry current is arguably the most useful test, as it allows detection of the
most subtle and intermittent faults.
These are the faults where the device
seems to operate normally but fails
when a burst of current is needed. The
Australia’s electronics magazine
device resets due to its supply dropping out and might even immediately
start working again.
Devices like portable hard drives,
which often require significant current,
are especially prone to this problem.
None of these tests characterise the
high-speed data performance of the
cable; much more specialised equipment is needed to do this. Still, these
tests are performed very quickly and
can be used to give a very fast ‘go/
no-go’ assessment on a cable.
With the rise of the Right To Repair
movement, we think that the USB
Cable Tester will become indispensable in places like Repair Cafés. We
shudder to think how much good gear
has been discarded due to having a
faulty USB cable.
Background
Before delving in, you might like to
look at some recent articles we have
published. The June 2021 article on
The History of USB (siliconchip.com.
au/Article/14883) describes the connectors and wiring that the USB Cable
Tester needs to work with.
That would be a good article to read
if you’re interested in understanding
and repairing USB cables.
siliconchip.com.au
The front panel gives
access to the six USB sockets:
two downstream facing ports (DFPs) at left and four
upstream facing ports (UFPs) at right. To test a cable, you plug one end
into either of the DFPs and the other end into one of the UFPs. It does the rest automatically.
The July and August 2021 issues
also included articles on How USB-C
Power Delivery (USB-PD) Works
(siliconchip.com.au/Article/14919),
the operation of USB-PD Chargers
(siliconchip.com.au/Article/14920),
and USB-PD Triggers (siliconchip.
com.au/Article/14996).
USB power delivery is a relatively
recent addition to the USB standards
and is not something our unit tests;
these power delivery features are
usually built into devices rather than
cables.
Both this article and the USB Cable
Tester use USB 3.2 to refer to any
cables that you might know as USB
3.0 or USB 3.1, since the USB 3.2 standard replaced (and is backwards compatible with) both USB 3.0 and USB
3.1. This is a similar situation to the
way that USB 2.0 encompassed and
replaced USB 1.0 and USB 1.1; it's
now common to refer to devices compatible with these as USB 2.0.
Design
Before delving too deeply into the
circuit details, we’ll mention some
of the design considerations that we
made along the way. We designed the
USB Cable Tester to be economical to
siliconchip.com.au
build, easy to use and robust enough
for regular use.
While it certainly would be possible to do this job without a microcontroller, that would entail a complicated design.
Add in the fact that the nature of
the test results are often more than a
simple numeric result or basic binary
go/no go, and a microcontroller is an
inevitable part of the circuit.
With that in mind, we’ve used a
40-pin PIC microcontroller. Any fewer
pins would require a multiplexer or
switch, adding complexity and cost.
Rather than fall back on one of the
old-fashioned 40-pin micros like the
PIC16F877, we’ve decided to get with
the times and use its modern descendant, the PIC16F18877.
The microcontroller displays the
test results on a 20x4 character LCD,
allowing simple ‘human-readable’
assessments to be delivered. Thus the
USB Cable Tester can be used by even
those with no electronics experience.
The low-power features of this new
microcontroller mean that a power
switch can be omitted. This may seem
like a small saving, but it’s one fewer
part to consider during design and construction and shaves a few dollars off
Features & specifications for the USB Cable Tester
1. Test just about any USB cable
2. Current pulse tests at 100mA, 500mA and 1A
3. Downstream facing ports can accept USB-A (2.0/3.2) or USB-C
(3.2)
4. Upstream facing ports can accept USB-B (2.0/3.2), USB-C (3.2),
Micro-B (2.0/3.2) or Mini-B (2.0)
5. Reports faults with individual cable ends (eg, plug with bare wires
or detect OTG cables)
6. Can differentiate between power-only, USB 2.0 & USB 3.2 cables
7. Will report short circuits, open circuits and other faults
8. Reports voltage drop and cable resistance at usable currents
Australia’s electronics magazine
November 2021 29
Fig.1: like the PCB, much of the schematic is taken up by the 26 resistors that isolate the microcontroller from the
USB sockets. In the unlikely event of a ‘live’ USB cable being plugged in, they will afford some protection to the
microcontroller and whatever is at the other end.
30
Silicon Chip
Australia’s electronics magazine
siliconchip.com.au
the cost. The USB Cable Tester simply
sleeps between uses, sipping a tiny
30μA from the battery.
It runs from three AA cells which
will last for many years with the USB
Cable Tester sitting on the shelf. The
4.5V nominal supply voltage means
that no regulator is needed; another
part (and more money) saved.
The device is housed in a compact
140mm x 110mm x 35mm instrument
case, about the smallest that would fit
everything. This means that it is sturdy
and looks the part, too.
Some parts we could not skimp
on. The USB Cable Tester uses robust
USB sockets, which cost a bit more
but are paramount to the longevity of
such a tool. We doubt that any other
device will have USB leads plugged
and unplugged so frequently.
We have aimed to use through-hole
parts to allow the parts to be easily
obtained and the USB Cable Tester to
be easily assembled. Still, it contains a
handful of SMD parts for various reasons, primarily certain types of USB
sockets. Many of these sockets are only
available in that form.
Circuit details
Refer now to Fig.1, the complete
circuit of the USB Cable Tester. CON3
and CON4 at upper left are the downstream facing ports (DFPs) – you can
equate these to the ‘host’ ports from
before USB-C. But since USB-C cables
are end-to-end symmetrical, a new distinction needs to be made.
CON3 is a USB-A 3.2 capable socket,
while CON4 is a USB-C socket (which
by nature supports USB 3.2). CON3
will also accept older USB-A 2.0 cables
since it is designed to be backwards
compatible.
CON5-CON8 are the upstream facing ports (UFPs), analogous to the
‘device’ socket before USB 3.2. CON7
is USB-B 3.2 and, like CON3, can
also accept a USB-B 2.0 plug; leads
with these plugs are sometimes called
printer leads due to printers being one
of the few items large enough to fit
such a port.
CON6 is a USB-C socket and is
accompanied by a USB micro-B socket,
CON8. Like CON7, it can accept either
a USB 2.0 or USB 3.2 plug. Finally,
CON5 is a USB mini-B socket, which
is only available in a USB 2.0 version.
The various pins from CON3-CON8
are connected to one of 26 1kW resistors. To reduce the number of pins
siliconchip.com.au
Australia’s electronics magazine
November 2021 31
that are needed, some pins are joined.
For example, the GND pins of CON3
and CON4 are connected to the same
resistor.
That is because these pins perform
similar functions in each connector
and have no reason to be connected by
a cable. They are functionally equivalent as far as the USB Cable Tester is
concerned.
This means that the USB Cable Tester does not know whether the cable
is plugged into the USB-A or USB-C
socket, but that isn’t necessary for
checking cables.
As we noted earlier, a 40-pin microcontroller does much of the work.
IC1 is a PIC16F18877 8-bit enhanced
midrange microcontroller. It’s one of
the cheapest 40-pin microcontrollers
available at the moment. There is a
slightly more inexpensive version
with less flash memory, but given the
ongoing chip shortages, we’ve decided
to standardise on the part with more
flash.
26 of IC1’s pins are connected to
those 26 1kW resistors, and these pins
are used to probe the connectivity of
the cable being tested. For the most
part, IC1’s GPIO (general purpose
input/output) pins are interchangeable.
We use one feature that is not present on all the available pins, and that
is the interrupt on change (IOC) feature. The ports that do have this feature have been wired into the downstream facing ports.
Without using IOC, we would have
to wake up the microcontroller periodically to test whether a cable is connected. This feature automatically
wakes it up as soon as any connection
is made between the downstream and
upstream ports.
This made laying out the PCB
slightly more complicated but allows
IC1 to use the deepest sleep mode
available, thus saving the most power
when the unit is idle.
This circuitry is used to probe
any pin combination between the
upstream facing port and the downstream facing port. We’ll explain how
that works in more detail in the software section below.
Current affairs
The cable current-carrying capability is tested by sending a brief burst
of power through the VBUS (5V) and
GND wires of the cable under test.
32
Silicon Chip
The completed USB Cable Tester photographed from the front and rear. This
shows that all connections are made from the front of the case. One tactile
switch is raised so it can be more easily accessed through a hole in the lid.
Since practically all the GPIO pins
on IC1 can act as analog inputs for its
internal ADC (analog-to-digital converter), we can probe the cable at several points to see how much voltage
is dropped between them.
Up to 1A is supplied by a circuit
based around Q3, a P-channel Mosfet. Q3, L1, D3 and the 10μF capacitor form a fairly standard buck (stepdown) regulator arrangement.
When Q3 is switched on by a signal
Australia’s electronics magazine
from the microcontroller via the 220W
resistor, current flows from the battery
positive through L1, charging the 10μF
capacitor. When Q3 switches off, the
inductor’s magnetic field collapses,
causing current to continue flowing
to the capacitor, through the path
provided via D3 and into the 10μF
capacitor.
As in any other buck regulator, the
duty cycle at Q3’s gate determines the
voltage that the capacitor charges up
siliconchip.com.au
to but with the proviso that Q3 is a
P-channel Mosfet and thus is on when
its gate is pulled low. A 10kW resistor
between Q3’s gate and source keeps it
turned off when it is not being driven.
The test voltage is applied to the
cable by three of the contacts of RLY1
and RLY2. One set of contacts connects VBUS of the downstream facing
port to the positive end of the storage
capacitor. The second set of contacts
connects the GND of the downstream
facing port to the 220mW shunt resistor returned to circuit ground, used to
measure the current.
The third set of contacts connects
VBUS and GND at the upstream facing
port, which is necessary to complete
the circuit. Note that current flows in
the same direction as it would under
regular use.
It’s important to realise that none
of the USB GND connections are connected directly to the circuit ground
during this test. They are connected to
either end of the 220mW shunt resistor but only when the relay contacts
are closed.
The 1kW resistor across the 10μF
capacitor discharges it when the buck
regulator is not running. This is mainly
to reduce the current flowing when the
relay contacts open, reducing relay
contact wear.
Both relays are controlled by
N-channel Mosfet Q2, which sinks
current from the battery through both
relay coils when its gate is brought
high by the microcontroller. A 10kW
resistor keeps the Mosfet off when
it is not being driven, and 1N4148
diode D1 absorbs the back-EMF from
both coils.
As we noted, power is derived from
three AA cells, giving a nominal 4.5V.
A separate battery holder is wired into
CON1. This feeds the 1000μF bulk
bypassing capacitor, Q3 and powers
the buck regulator and relay coils.
Schottky diode D2 feeds from the
battery into microcontroller IC1’s supply, bypassed by 1000μF and 100nF
capacitors. These also provide power
to the LCD. The diode means that the
microcontroller’s supply does not dip
during the brief bursts of current draw
during cable pulse testing.
Display
LCD1 is a 20x4 character LCD panel
that has its supply fed directly from
pin RD6 of IC1. The signal from RD6
is also connected to the gate of Q1,
siliconchip.com.au
Parts List – USB Cable Tester
1 double-sided PCB coded 04108211, 130mm x 102mm
1 green double-sided PCB coded 04108212, 134mm x 30mm (front panel)
1 laser-cut acrylic bezel to suit LCD [Cat SC5970]
1 140mm x 110mm x 35mm plastic instrument case
[Jaycar HB5970, Altronics H0472]
1 3xAA battery holder with leads (CON1)
1 5-way pin header (CON2; optional, for ICSP)
1 USB-A 3.2 socket (CON3) [Würth Elektronik 63.2213.200]
2 USB-C sockets (CON4 & CON6) [Würth Elektronik 632723.20011]
1 Mini-USB socket (CON5)
1 USB-B 3.2 socket (CON7) [Würth Elektronik 69222103.200]
1 Micro-USB 3.2 socket (CON8) [Würth Elektronik 69262203.200]
1 2-way pin header (CON9; optional, for calibration ➊)
2 2-way pin headers and jumper shunts
(JP1 & JP2; optional, for calibration ➊)
1 20x4 LCD module (LCD1) [eg, Jaycar QP5522]
1 16-pin header, 2.54mm pitch (for LCD)
2 1A telecom relays, 5V DC coil (RLY1, RLY2) [eg, EA2-5NU, Cat SC4158]
2 6mm tactile switches (S1 & S2; optional, for calibration ➊)
1 100uH 12x12mm SMD inductor (L1) [eg, Bourns SRR1280-101MCT]
4 M3 x 15mm machine screws
8 M3 hex nuts
8 No.4 x 6mm self tapping screws or M3 x 6mm machine screws
2 6-way stackable headers (for mounting LCD)
Semiconductors
1 PIC16F18877-I/P ➋ microcontroller, flashed with 0410821A.HEX (IC1)
2 2N7000 N-channel Mosfets, TO-92 (Q1, Q2)
1 SUP53P06 or IPP80P03P4 P-channel logic-level Mosfet, TO-220 (Q3)
1 1N4148 signal diode (D1)
2 1N5819 1A schottky diodes (D2, D3)
Capacitors
2 1000μF 6.3V electrolytic
1 10μF 16V electrolytic
1 100nF 63V MKT or 50V ceramic
Resistors (all 1/4W axial 1% metal film except as noted)
1 10kW mini horizontal trimpot
4 10kW
28 1kW
1 220W
1 100W
1 220mW 1% 2W M6432/2512 SMD
➊ The USB Cable Tester will work fine without calibration, so these parts are
optional. Still, see the text next month for information about how S1 can be
used during regular operation.
➋ IC1 can also be a PIC16F18875 programmed with 0410821B.HEX. Either
the I/P or E/P variants will work.
A kit is available from the Silicon Chip Online Shop
Because of the current semiconductor (& component) shortage, we we concerned that
our readers might not be able to build this project.
At the time of publication, several of the key components are difficult to source. So
we made the decision to purchase all the parts in advance and make a kit available. This
not only ensures you can build it, it also greatly simplifies getting the parts.
The kit (code SC5966) will come with everything needed to build a complete unit as
shown here, except for the case (available from Jaycar & Altronics) and the three AA
cells (which are easy to get).
The initial price is $110 + postage ($99 + postage for current subscribers) although
that could go up if the initial batch sells out quickly. See the shop listing on page 90 or
on our website at siliconchip.com.au/Shop/20/5966
Australia’s electronics magazine
November 2021 33
microcontroller’s reset line (which is
usually pulled up by a 10kW resistor)
and circuit ground. Since the calibration menu is only displayed just after
a reset, pushing S2 is a simple way
to reset the microcontroller and enter
calibration mode.
S1 is connected between PGD and
circuit ground. When it is pressed, it
can trigger the IOC interrupt noted earlier and can thus be used to wake up
the USB Cable Tester without plugging
in a USB cable.
Software
This main screen is
shown when the USB Cable
Tester is idle and doesn’t have a
cable plugged in. The battery voltage and a
countdown timer (until the unit sleeps) are shown.
which switches the LCD panel backlight cathode via a 100W resistor. A
10kW resistor also holds Q1 off when
the micro is not driving the pin.
Thus, when RD6 is low, LCD1 and
its backlight are both off. When RD6
is taken high, LCD1’s internal controller is activated and its backlight
is switched on. This means that the
USB Cable Tester can completely shut
off power to the LCD when IC1 is in
sleep mode.
Six more of IC1’s pins are connected
to LCD1 to control it in four-bit mode.
This makes the best use of the available pins without needing a separate
I/O expander chip.
CON2 is an optional in-circuit serial
programming (ICSP) header for programming microcontroller IC1. The
PGD and PGC pins are also used for
USB cable sensing, so a USB cable
must not be connected during programming.
The PGD pin is also connected to
CON9, a two-pin header, via a 1kW
resistor. CON9’s other connection is
circuit ground. This interface is used
to connect to the transmit pin of a
TTL-serial interface such as a USBserial adaptor which can be used to
enter a dedicated software interface
for calibration.
No receive pin is provided. Instead,
two-way communication is achieved
by displaying data on the LCD screen
34
Silicon Chip
during the calibration process.
Test points TP1, TP2 and TP3 are
provided for calibration. These connect to circuit ground, the positive
microcontroller supply and the positive end of the 220mW shunt, respectively.
JP1 and JP2 are also used only for
calibration. When bridged, JP1 connects the upstream and downstream
facing VBUS lines. Similarly, JP2 connects the upstream and downstream
facing GND lines.
When fitted, they leave only the
relay contacts and shunt resistance
in the current test circuit. Thus, the
resistance of the relay contacts can be
measured and entered into the calibration settings. This value is then subtracted from cable readings to give a
true value.
S2 is also intended to be used for
calibration. It is connected to the
The PIC16F18877 is a reasonably
well-equipped microcontroller, and
we’re using several of its internal
peripherals to provide the features
needed.
The software loaded into the chip
starts by initialising several of its internal peripherals. This includes setting
most of the I/O pins as inputs with
internal pull-ups, used to sense cable
connectivity. It also sets up the UART
(serial) receiver and PWM output for
the buck converter, plus the seven I/O
pins associated with the LCD.
Timer (T0) is configured to fire an
interrupt every 262ms (approximately
four times per second). This is a reasonable rate for quick screen updates
while still allowing the display to be
legible.
The timer is used to display a
startup screen for around seven seconds. During this time, if an ESCAPE
character is received on the UART,
the calibration is started and a menu
is displayed on the LCD. The calibration runs until either the microcontroller is reset or a Ctrl-C code is received
on the UART.
Otherwise, the UART is disabled
after seven seconds, and the main
‘idle’ screen is displayed. A subroutine is called after 10 seconds of the
idle screen to put the USB Cable Tester
into low-power sleep mode.
The Tester automatically runs tests as soon as a cable is plugged in. This
known-good cable is identified as USB 2.0 compatible with no problems and a
voltage drop of 116mV at 1A.
Australia’s electronics magazine
siliconchip.com.au
GND
GND
VBUS
DP
DM
TXP1
TXM1
RXP1
RXM1
TXP2
TXM2
RXP2
RXM2
1
VBUS
DP
1
2
DM
2
3
TXP1
RXP1
3
4
5
TXP2
6
5
TXM2
RXM2
4
4
3
RXM1
RXP2
4
3
TXM1
5
6
6
5
6
Table 1: this data is stored in the microcontroller as arrays of 18 bytes, making up 144 bits (18 x 8). These correspond to
the connection combinations that might be detected. It is compared with the data gathered during cable testing.
This involves shutting down the
peripherals mentioned earlier and setting low all the pins associated with
the LCD. This reduces the quiescent
current as it avoids leakage from any
floating input pins.
The upstream facing ports are pulled
to a low level, and the downstream facing ports remain as inputs with pullups. Thus, any cable plugged in will
pull one or more of the downstream
facing port pins low.
The IOC flags are set to allow a
pin change to wake up the micro.
Just before engaging sleep mode, the
pins are checked one more time; if a
cable is detected, sleep is bypassed.
While unlikely to occur with so many
pins, it is possible for a pin change to
be missed, hence the reason for the
double-check.
When a pin change is detected
(which could include a press on S1),
the micro wakes up and initialises all
the peripherals again before returning
to the main idle screen.
Whenever the micro is awake, it
uses the timer to perform tests about
four times per second. The results of
the test dictate what is displayed. The
idle screen is shown if no connection
is detected; this also displays the battery voltage and a countdown timer
until sleep occurs.
The tests work simply. Each pin is
typically set as an input with a pull-up.
One at a time, in turn, each pin is
pulled low and the states of the other
pins are tested. The wires in the USB
cable connecting pins in downstream
and upstream sockets result in other
pins being detected as being low.
The tests are done in three phases.
One phase simply checks for connections between the pins associated with
the downstream facing port. A second
phase checks the upstream facing port.
For the most part, these should show
no connections, except perhaps for the
cable shield and USB-ID pin. USB-ID
is grounded on USB OTG cables to
indicate that the equipment connected
to what would normally be a ‘device’
needs to behave as a ‘host’.
Depending on how the cable is
wired, there might also be a connection
between the cable shield and ground.
Any other connection within an
A faulty cable is quickly identified; in this case, the GND wire is detected as
open circuit (1-, Opens:GND) and naturally, it has no useful current-carrying
capacity on its power lines.
siliconchip.com.au
Australia’s electronics magazine
upstream or downstream port likely
indicates a cable fault. So if one end
of a cable is plugged in, any of these
sorts of problems that are detected are
displayed on the LCD screen.
The third test phase is a complete
‘matrix’ analysis of every combination of downstream facing port pin
and upstream facing port pin. This
is turned into a cable-specific signature that is compared with a list of
signatures corresponding to known
cable types.
Some cable types have multiple signatures. For example, the reversible
nature of USB-C means that there are
two equally valid signatures for a USB
3.2 cable. Table 1 shows what connections are expected for each cable type.
An exact signature match means
that the cable is a known type and
displayed as such. An inexact match
is shown as the nearest match and the
differences are detected.
For example, the LCD might indicate that a USB 2.0 cable is detected,
but with the D+ line open; such a
cable may be suitable for a power-only
application but will be no good for
data transfer.
A simplified version of the decoding would work as follows.
• Power-only cable: just the red
points in Table 1 detected.
• USB 2.0 cable: the red and mauve
points are detected.
• USB 3.2 cable (Gen 2x1): as for
USB 2.0, plus any one of the four
remaining groups of connections.
• USB 3.2 cable (Gen 2x2): as for
USB 2.0, plus either all the green
points or all the orange points.
November 2021 35
How we decided on which USB sockets to use
We’ve spent a great deal of effort
to make sure that the sockets we
are using for the USB Cable Tester
are durable and functional, as well
as being hand-solderable. The latter is actually quite a tricky problem,
especially for the USB-C parts.
USB-C packs a lot of pins into a
small connector. Since there are
two rows of pins in the connector,
breaking them out into two rows at
the PCB makes sense.
But having two rows of PCB pins
will mean that the ‘bottom’ row cannot be surface-mounted, as there
would be no way to access them
from above. They’d be covered by
the ‘top’ row of pins.
Since one row of pins goes
through holes on the board, soldering them will be slightly easier.
But we think these are the finest
pitch through-hole and SMD parts
that we have used in any project.
You’ll need to have the correct gear
(including a magnifier and a syringe
of flux paste).
Therefore, soldering these parts
is the trickiest part of constructing
the USB Cable Tester despite our
best efforts. Fortunately, the fullsize USB-A and USB-B parts are
simple through-hole devices.
We looked at utilising pre-built
USB breakout boards, but they
would have substantially increased
the size of the final unit and cost
quite a bit more too.
The mini-USB socket, CON5, is a
part we’ve used many times before.
Since there is no USB 3.2 variant of
this connector, a standard USB 2.0
part is adequate.
The micro-USB part is small too,
but not much different from the
mini-USB socket. They both only
have a single row of pins.
The good news is that you can
use the circuit itself to test that the
sockets are soldered correctly. We’ll
go into more detail during the construction, but briefly, we can use
the existing hardware and logic to
probe for any shorts in the socket
soldering.
A short in the socket soldering
will appear to the USB Cable Tester like a fault in the cable, even
if it only occurs at one end. Thus,
we will advise an unusual order of
construction, so that the USB Cable
Tester’s microcontroller can run
its tests during construction, well
before it is complete.
That way, you can take your time
and check your work both visually
and electrically to ensure that you
end up with a functioning USB Cable
Tester.
A12
A11
A10
A9
A8
A7
A6
A5
A4
A3
A2
A1
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
A11
A12
GND
RX2+
RX2−
VBUS
SBU1
D−
D+
CC1
VBUS
TX1−
TX1+
GND
GND
TX1+
TX1−
VBUS
CC1
D+
D−
SBU1
VBUS
RX2−
RX2+
GND
GND
TX2+
TX2−
VBUS VCONN
SBU2
VBUS
RX1−
RX1+
GND
GND
RX1+
RX1−
VBUS
SBU2
D−
D+
CC2
VBUS
TX2−
TX2+
GND
B1
B2
B3
B8
B9
B10
B11
B12
B12
B11
B10
B9
B8
B7
B6
B5
B4
B3
B2
B1
B4
B5
B6
B7
The two rows of closely spaced pins used in USB-C type plugs and sockets demand a tight pin pattern on the PCB. The
part we have chosen will be the most challenging part of this project to solder, and we doubt there is anything easier
to hand-solder available.
Any additional connections detected
beyond these constitute some form of
short-circuit fault.
When a cable is detected, the current pulse test is also performed once
every five seconds. This is only done
periodically to reduce battery drain
and relay wear. The first test is done
about half a second after detection,
to allow time for the cable to be fully
inserted.
For this test, the micro sets all the
pins associated with connectivity testing as inputs and closes the relays to
complete the power circuit. The reference for the ADC is set to the 1.024V
FVR (fixed voltage reference). Being a
10-bit ADC, each digital step then corresponds neatly to 1mV.
The micro ramps up the PWM signal
to Q3 while monitoring the voltages
at various points along the VBUS and
GND wires of the cables, including just
36
Silicon Chip
above the current measuring shunt,
which allows the test current to be
determined.
The ADC is sampled 16 times at
four points over several PWM cycles
to compensate for the relatively high
amount of ripple in the applied voltage.
At 100mA, 500mA and 1A, the voltages are stored. If the measured voltage rises above 1V (at any point in the
cable) at any time, the test is cut short.
The 1.024V reference used for these
measurements puts an upper limit on
what can be meaningfully measured.
Another reason for cutting the test
short is that it avoids a high load on
the batteries. With a fixed 1A output, there is actually a greater load
on the batteries when a high resistance cable is tested; this part of the
circuit behaves much like a current
source. In any case, a cable dropping
Australia’s electronics magazine
anywhere near 1V is not going to be
of much use.
The USB Cable Tester then displays
the results from the highest test reading, including voltage drop and calculated cable resistance.
When the cable is unplugged, the
USB Cable Tester returns to the idle
screen and counts down its timer to
enter sleep mode unless another cable
is plugged in for testing.
Next month
Next month we’ll describe the construction, calibration and use of the
USB Cable Tester.
We’ll also describe how the USB
Cable Tester can check its own construction and assist with finding soldering faults in the SMD USB sockets
we are using. See the panel for more
information about the sockets and why
such a feature will be handy.
SC
siliconchip.com.au
|