USB-C Power Metering with the ChargerLAB KM003C: A Google Twinkie Alternative?
by Ganesh T S on July 5, 2023 8:00 AM EST- Posted in
- Gadgets
- USB PD
- Power Assessment Tool
- USB-C
The last few years have seen an increase in adoption of the USB Type-C connector. It has simultaneously been accompanied by additional technological innovations on top of it. This has created a need for devices and tools to monitor the communication over the connector - in particular, the power delivery (USB-PD) aspect. While costly USB protocol analyzers fulfil the requirement of companies involved in silicon development and low-level hardware, these are impractical for people looking to optimize their microcontroller projects, hobbyists, enthusiasts, and even end users.
The Google Twinkie (developed in 2014) was the original USB-PD Sniffer. Since then, many devices have attempted to replicate at least some of the functionality in a more user-friendly manner. However, none of them were able to match the Twinkie's flexibility for advanced users. Unlike the Twinkie, the designs also interfered with regular data traffic while monitoring the power transfer. ChargerLAB's KM003C is one of the latest premium solutions in the list, and it ticks many of the boxes that other solutions do not. In fact, it goes one step further than the Twinkie by supporting the EPR specifications also (Extended Power Range, up to 240W).
One of the key advantages of the Google Twinkie is the availability of a shell over a serial port through which the operation can be configured. This allows end users to develop custom scripts and applications for tracking various parameters. At AnandTech, we have been using Plugable's USBC-TKEY (a version of the Google Twinkie for the retail market) to track the power consumption profile of bus-powered USB devices since 2016. After 7+ years of service, the USBC-TKEY had started to show its age, prompting us to be on the lookout for an alternative. After looking at the specifications of the ChargerLAB KM003C, we decided to take a punt and purchased one to see if it could replace the USBC-TKEY in our workflow.
ChargerLAB provides a Windows-only closed-source application to expose the advanced features of the KM003C (beyond what is presented in the display on the device). The company also provides documentation for their APIs in Chinese. This review takes a detailed look at the features of the ChargerLAB KM003C. It also details our attempts to use their APIs to replicate the Google Twinkie functionality for AnandTech's use-case.
Introduction and Product Impressions
The USB specifications have been subject to rapid updates since the introduction of the Type-C connector. Data rates have been increasing and the latest versions even allow encapsulation of PCIe traffic. At the same time, the USB-IF also foresaw the need for flexibility in transmitting different amounts of power from the host to the device and vice-versa. Towards this, the USB-PD (power delivery) specifications were also developed. The latest revision - USB-PD 3.1, brings support for 140W, 180W, and 240W power levels. The PD specifications have also allowed for power transmission either from the host, or the device. All these capabilities are enabled by a power delivery handshake process between the devices on either side of the cable. As the power delivery standards evolve in both capabilities and flexibility, a need has come up in the market for devices that can provide feedback to the users and developers on the PD handshake process and its results.
USB protocol analyzers also include support for analyzing the PD handshake process. Silicon and low-level hardware developers do use them, but they are usually extremely costly (because they also support the tracing and debugging of the high-speed data transfers). The PD handshake process is at a relatively slow speed (around 300 KHz) over the CC (control channel) wire, and doesn't require high-speed signal monitoring. There are many low-cost devices in the market that tap the CC1 and CC2 pins to provide information on the PD handshake process to the end user.
Power delivery sniffers also need to monitor the voltage and currents on the VBUS and VCONN pins. Advanced sniffers allow for the injection of power delivery packets on the CC pins and also placing the termination resistances. From a power measurement perspective, the interesting ones are the VBUS and VCONN. The former carries bus power for devices (and, in some cases, for the circuitry in the cable itself). The voltage may vary from 5V for typical USB 2.0 hosts / devices to up to 48V for USB-PD scenarios. VCONN, on the other hand, is always set to 5V and can supply up to 1W of power for circuits within the plug. These circuits can implement electronically marked cables or even be accessories.
The pin-out diagram above shows the D+ / D- differential pair that is used only for USB 2.0 traffic. An inline power delivery sniffer could opt to cut out the path, eliminating USB 2.0 data transfer path completely. The same could be done for the TX / RX pairs responsible for the higher speed data traffic in USB 3.x / USB4 / Thunderbolt 3+. While there are some legitimate use-cases for allowing only power transfer via the USB cable, most users employing an inline power delivery sniffer want data traffic to be untouched. Unfortunately, a majority of the low-cost sniffers in the market take the easy way out by completely ignoring the data transfer path.
ChargerLAB KM003C Package Contents and Feature Set
The ChargerLAB / Power-Z KM003C is marketed primarily as a USB PD tester, and comes in a non-descript box. The rear label provides the high-level specifications in terms of supported voltage and current range, as well as fast charging protocols. Contact details for support and business issues are also provided.
Inside the package, we have an aluminum storage box with the PD tester placed inside a foam cladding for protection when the unit is not in use. The Type-C male port also has a protection cap. QR codes with links to ChargerLAB's YouTube and Telegram channels are provided in an accompanying business card.
The ChargerLAB / Power-Z KM003C is an inline device placed between the downstream facing port (DFP) of a host and the upstream facing port (UFP) of a device. Either component can act as the source and sink in terms of power delivery. It is used for voltage and current detection, power delivery capability testing, cable testing for e-markers, fast charging protocols detection, and other such tests.
The KM003C itself is a cuboidal piece of aluminum (measuring 36.5mm x 35.5mm x 8.7mm, weighing in at 16.5g) with a Type-C male port as the UFP, and a Type-C female port as the DFP. It is equipped with a vibrant 240 x 240 1.54" IPS screen that provides real time information on the VBUS, IBUS, power consumption, charging protocol (if applicable), and voltages on different lines in the connector. The product is also equipped with a Type-C HID port that can be used to interface it with a PC for data recording and further analysis. There are physical buttons on the product that allow the user to navigate the menus, configure various testing parameters, set sampling rates, etc.
Physical buttons on the KM003C (the HID port is on the face opposite to the buttons)
The KM003C can perform some basic operations with the power supplied via the VCONN line, but it requires connection to power through the HID port for full-fledged operation. The typical power consumption of the KM003C itself is around 75 - 250 mW. It also includes a supercapacitor that allows for a safe shutdown (ensuring that data in flight is flushed out to permanent storage) and the display to remain active for around five seconds after the power is disconnected.
ChargerLAB also bundles a closed source Windows-only software to graph and store the recorded parameters on a PC for further processing.
ChargerLAB KM003C vs. Plugable USBC-TKEY
The Google Twinkie / Plugable USBC-TKEY and ChargerLAB KM003C are conceptually similar in that they are both USB PD sniffers / testers. However, the differences are evidence to the advancements made in the USB space between 2014 and 2022, and also reflect the evolution of end-user requirements in this space.
The key difference lies in the power specifications. The Google Twinkie / Plugable USBC-TKEY can support only up to 20V / 5A on the VBUS lines due to the limitations of the digital power monitoring ADC chip being used. The KM003C can support up to 50V / 6A (full USB-PD 3.1 specifications, with EPR up to 240W).
The use of a more recent ADC chip has enabled increased measurement accuracy in the KM003C as compared to the Google Twinkie / USBC-TKEY. The INA231 used in the latter has a 16-bit ADC and a voltage measurement step size of 1.25 mV. The INA228 in the KM003C has a 20-bit ADC and a voltage measurement step size of around 0.2 mV. The INA228 also includes temperature monitoring (and that is available via APIs and the display screen on the KM003C).
The Twinkie was designed primarily for use with Chrome OS, and as a result, its retail versions such as the Plugable USBC-TKEY support only Linux. TotalPhase offers the TP350110 based on the same hardware as the Twinkie. It comes with modified firmware and drivers that support both Windows and MacOS, along with extended APIs and a custom data processing application at a steep premium. The KM003C supports only Windows officially for the connection through the HID port, and their data processing software is also Windows-only.
The Twinkie / USBC-TKEY has a CLI shell accessible over a USB serial port and comes with support for a specific set of commands (like 'tw vbus' and 'tw vconn' for reading the voltage and current on the VBUS and VCONN lines, 'tw res param1 param2' for placing resistors on the CC lines - Rp / Rd / Ra), etc.). The KM003C is accessible over the HID port and is receptive to commands, but those are custom encodings without an interpretation layer in the middle.
The Twinkie / USBC-TKEY can act as a sink and inject power delivery packets to make the host / source negotiate a different power delivery contract. This is also available in the KM003C when using the cable simulation and charging protocol detection feature, but does not seem to be exposed via the APIs (to the best of my understanding).
The Twinkie / USBC-TKEY can set up or remove resistors on the CC lines in order to configure the connected port as either UFP or DFP. The KM003C appears to have a similar functionality for the Rd alone. Again, this does not seem to be exposed via the APIs.
The next section talks about the hardware design and software capabilities. It is followed by a discussion of the API support and how to use them on both Linux and Windows. After adapting our direct-attached storage flow to support power monitoring from both USBC-TKEY and KM003C, we recorded some results from both meters. We provide some comparisons of those results before proceeding to the concluding remarks.
20 Comments
View All Comments
ballsystemlord - Wednesday, July 5, 2023 - link
It's unfortunate that the KM003C is windowz only closed source.ganeshts - Wednesday, July 5, 2023 - link
It is not a major problem, as I have demonstrated in a couple of sections. You can use libusb or any other serial port access program to communicate with the KM003C and create a wrapper suited for your particular use-case.That said, one aspect I should have mentioned in the conclusions is related to the ability to update the firmware independent of the closed-source Windows program. Coupled with better API documentation, that would basically make the device pretty functional without having to rely on the closed-source program.
ballsystemlord - Wednesday, July 5, 2023 - link
Oh, I see.QChronoD - Wednesday, July 12, 2023 - link
Since you posted a screenshot of the code for connecting and pulling out the relevant power data, are you OK with people using it? Are you planning on posting it on github or somewhere?ganeshts - Thursday, July 13, 2023 - link
Absolutely! Code is free for anyone to start off with as the base point for their own programs.My github account has been idle for a few years now. I will probably upload a refined version of the code that appears in this review later this year when I get time. The only reason I didn't post the code as text is to avoid making the review appear like a StackOverflow post :)
TrevorH - Thursday, July 6, 2023 - link
You could have saved me from going straight to the last page by putting the price at the top of the article. At $10 I would have snapped your hand off, at $110 it's a definite no.ganeshts - Thursday, July 6, 2023 - link
I think it would be impossible to hit $10 for this type of product. Even BOM cost for microcontroller + 5 ADCs would easily exceed that (even if they are bought in 1Ku quantities). Need to add software development and distribution costs. I would imagine break-even is itself around $40 - $50.ads295 - Saturday, July 8, 2023 - link
+1It's not for "hobbyists" as mentioned in the article.
Bp_968 - Thursday, August 3, 2023 - link
Not sure I agree that 50$ puts it out of reach of "hobbyists". I'm a hobbyist and own a oscilloscope, and a number of other test tools more expensive then 50-100$. If all your doing is seeing what voltage your usb battery is negotiating with your switch or steamdeck then yes, this device is overkill. But if you building anything that's using PD or other usb-c features this could be extremely useful.I'm unlikely to build anything anytime soon that would require the features this thing supports but I still want one! ;)
DanNeely - Thursday, July 6, 2023 - link
"The KM003C can support up to 50V / 6A (full USB-PD 3.1 specifications, with EPR up to 240W)."Unless this device is going significantly beyond USB-PD levels I believe this should read 5A not 6.