The micro-USB cable tester verifies if a USB 2.0 cable with micro-B plug can be used to transfer data, or just for charging.
Have you ever plugged in a device using a micro-USB cable and wondered why you can't see it on your computer? Especially when you are developing the USB stack of a micro-controller. This tiny gadget will test the cable and confirm if it can be used to transfer data. Now you can be sure your USB implementation needs some tweaking, and not waste time because this cable was only for charging.
Ensure a CR2032 or CR2025 coin cell is present in the holder on the back of the board. A CR2032 coin cell is provided with the tester.
Plug in the USB type A of the cable at the top, and the USB type micro-B at the bottom:
- when the red POWER LED lights up, the cable can be used to power a device (with up to 500 mA, according to USB 2.0 specification)
- when the blue DATA LED lights up, the cable can be used to transfer data
- when the red B.CHG (battery charging) LED lights up, the cable can be used to charge a device (with up to 1.5 A, according to USB Battery Charging 1.2 specification). This cable can not be used to transfer data. If the POWER LED is not on at the same time, the cable is defective
- when the green SHIELD LED lights up, the cable can be used for data transfer with High Speed devices (480 Mbit/s), else this cable should only be used for Full Speed devices (12 Mbit/s). If the DATA LED is not on at the same time, the cable is defective
- when the blue OTG LED lights up, this is a On-The-Go cable meant to connect a device (i.e. a memory stick) to a host with micro-B port (e.g. a phone). Such adapters can be tested without plugging in the type-A side
Normally USB cables capable of data transfer should always be used (USB specification compliant cables), and the charger port the cable is plugged into indicates the device can draw up to 1.5 A by shorting the data lines (D+ and D-). This is known as a Dedicated Charging Port (DCP). Because most USB ports capable of providing more than 500 mA are common practice now, some penny pincher though it was a good idea to short the data lines directly in the micro-B plug, and save the cost of the two additional wires for data transfer (along with shielding and controlled impedance). Such cables are often provided to charge battery operated devices. As described in purpose, I built the tester mainly to identify such cables and avoid using them for data transfer.
After identifying the cable with this tester, I write the result using a marker on the cable with a letter: P for power only, C for battery charging, D for data without shield, S for shields cables, and O oft OTG adapter. This allows me to immediately know what the cable is capable of next time I use it.
Here the methods used to test the different capabilities of the cable:
- POWER: ensures the VBUS and GND wires are present in the cable, required to power a device. Signal path: VCC -> micro-B_VBUS -> A_VBUS -> LED -> A_GND -> micro-B_GND -> GND.
- DATA: ensures the D- wire is present in the cable, required to transfer data. The D+ is also required, but when D- is present, I expect D+ to also be. This is not the case if the cable is broken though, but this is not in the scope of this tester. Signal path: VCC -> micro-B_D- -> A_D- -> LED -> A_GND -> micro-B_GND -> GND.
- B.CHG: checks if D+ and D- are shorted in the micro-B plug. Signal path: VCC -> micro-B_D- -> micro-B_D+ -> LED -> GND.
- SHIELD: ensures the shell of the plugs are connected on both sides of the cable. This does not ensure if there is really a shield in the cable, or just a wire. It also can't ensure the shell is simply shorted to GND. These limitations are outside of the scope of this tester since I haven't seen any cable cheating this way. Signal path: VCC -> micro-B_VBUS -> A_VBUS -> LED -> A_GND -> micro-B_GND -> GND.
- OTG: checks if the ID pin is connected to ground, indicating the "device" that it should act as host. Signal path: VCC -> LED -> micro-B_ID -> micro-B_GND -> GND.
All details are in the schematic.
- the connectors need to have through hole mounting tabs to ensure they don't break from the board, particularly the micro-B receptacle.
- to power the LEDs I used small batteries I had around: CR2032. They are plenty sufficient to power LEDs, especially because I provide them with less than 0.5 mA. Thus the battery should last testing cables for years, unless you leave them plugged in.
- to keep the board small, I decided to put the battery holder on the back of the board. This requires you to solder it last, else it would cover the hole for the USB-A receptacle.
- I did not specify the colors of the LEDs, or the value of the resistors, in the schematic, since I wanted to try out alternatives while assembling them.
to be able to generate the outputs you need following software:
- rake: the central script taking care of generating the output files (Makefile is too cumbersome to parse files)
- QEDA: to generate footprints for the parts
- Lepton EDA: for the schematic capture
- pcb-rnd: for the board layout the output generation is automatized.
almost all of the symbols and footprints used in the schematic and board layout are defined in the QEDA format and generated for the CAD software.
library folder contains the QEDA parts definitions.
to install QEDA using NPM from the official repository:
sudo npm install -g qeda
to install QEDA from the sources:
git clone https://github.com/qeda/qeda cd qeda npm install sudo npm install --global
to generate the parts:
this will use the parts definition (.yaml files) in the
library to generate gEDA gschem/Lepton EDA symbols (.sym files) in the
geda/symbols folder, and coralEDA pcb-rnd footprints (.lht files) in the
only the QEDA parts in subfolders within
library come from the QEDA library, but the files are included in this project for simplicity and archiving purposes.
all other parts are custom and written for this project.
.sch file is the schematic source file.
it has been drawn using Lepton EDA.
it uses standard symbols, and the ones in the
most symbols are generated by QEDA as described above.
to export the netlist (in tEDAx format):
to export as pdf:
to export the bill of material (as CSV):
.lht file is the board layout source file.
it has been drawn using coralEDA pcb-rnd.
it uses the symbols from the
most symbols are generated by QEDA as described above.
oshw_logo.lht is just the Open Source Hardware Logo.
it been generated from https://oshwlogo.cuvoodoo.info/.
to export gerber files for PCB manufacturer (and photo preview + overview document):