API Access on Windows

Custom user programs and scripts to access the data from the KM003C are comparatively easier to create on Windows compared to Linux. One of the primary reasons is that ChargerLAB supplies a HID demo program (ZIP) on its technical support page. It includes a VisualStudio 2019 project with C++ source code to access the data from the device. The KM003C also presents itself as an USB device as well as a serial device to the OS. In the ideal case, we should have seen the latter interface even in Linux as /dev/ttyACM0, but that was not the case in our Ubuntu install.

Powershell is my preferred scripting language on Windows machines, and accessing the KM003C as a serial device is as simple as opening the appropriate COM device output in the above command. As mentioned in the API document, the baud rate and other parameters do not matter.

The command to be sent over the serial port for getting the ADC data (the 32-bit word, 0x0C000200) is prepared. Similar to libusb, the device write function expects a UTF-8 string. Unlike libusb, the read function is not blocking. In order to avoid polling for the data, or waiting for a pre-defined amount of time (by which there is no guarantee that the read might have returned the data from the device or not), a Powershell event is set up to trigger whenever data is received on the opened port.

The read out process is isolated out into a script block, and the logic to compute the instantaneous and averaged power consumption is similar to what was done using Python on Linux. The main difference is that we wait for the event triggered by the data receipt before the call to the read from the port.

The script block is called in a loop every 100ms and generates output that is similar to the one created by the Python script in the previous section - CSV strings with a timestamp, followed by instantaneous voltage, current, and power, and the averaged versions of the same.

The clean-up process involves closing the port and deregistering / removing the event set up to track the data receipt from the port.

API Access on Linux KM003C in Action - PSSD Power Consumption Profiling
Comments Locked

20 Comments

View All Comments

  • ganeshts - Thursday, July 6, 2023 - link

    The 50V and 6A are independent of each other. USB-PD 3.1 goes up to 48V / 5A, but other fast charging protocols can differ. For example, SuperVOOC 2.0 operates in the 3-10V / 0.1 - 6.5A range [ https://www.oppo.com/content/dam/oppo/en/mkt/newsr... ].

    The KM003C supports a long list of non-USB-PD fast charging protocols, and it looks like 50V and 6A are the maximum it supports for the voltage and current on the VBUS line.
  • lucaB75 - Friday, July 7, 2023 - link

    55-110 bucks ? Come on , dont waste time on these reviews, we need real news not bs (highly)overpriced
  • Threska - Friday, July 7, 2023 - link

    "Despite this premium pricing, we believe that the KM003C should be part of every USB-C power user / developer's toolkit."

    Or people who regularly buy questionable chargers and cables.
  • meacupla - Friday, July 7, 2023 - link

    With the way this tester is costing, you might as well buy from a reputable brand to begin with.

    I am pretty sure you can get an Anker USB GaN charger, with Anker 100W USB cable for $55~110.
  • TomWomack - Friday, July 7, 2023 - link

    And that gets you one charger; we have at least one charger in every bedroom plus a couple on every desk, and spending $110 once on a device which lets you determine which $20 charger it is reasonable to buy a dozen of makes reasonable sense.
  • TheinsanegamerN - Monday, July 10, 2023 - link

    If you have enough expensive power hungry devices that you have to have 100w charging in every room, just buy decent chargers and be done with it.
  • Bp_968 - Thursday, August 3, 2023 - link

    This device is massive overkill for testing your portable USB battery or USB wall wart. You can do the same thing for 20-30$ if that's all you need it for. But this device will do far more then simply tell you if the battery can output 15 or 20v and at what amperage it can do so.

    It's like saying an oscilloscope is overpriced because you can use a much cheaper multimeter to see if your home outlet is putting out the correct AC voltage.
  • PeachNCream - Saturday, July 8, 2023 - link

    Anything that lets you escape Google's revolting, mustache-twirling, sticky-fingered clutches is a good thing. It's always a pity to see the US sit idly by while Google feeds the population free candy in exchange for the entirety of the nation's personal data. At least the EU, problems noted where relevant, acts against disgusting data fetishist activity through GPDR enforcement that has teeth. Were it not for sucking from Google's four coloured teats at all levels of governance, the company could have been broken apart by now along. But who am I to complain? You let Elon Musk, Justin Bieber, and that sensationalized scammer-philantropist MrBeast all obtain fame while polluting the world for everyone by driving one and only one person with no cargo whatsoever in a enormous pickup truck or SUV. It's the US after all.
  • Fury13 - Tuesday, July 11, 2023 - link

    Is there any (affordable) hardware product available to monitor USB-C bandwidth so we view bandwidth of products such as web cams / VC systems / SSD's to PC's?
    I understand Crystal Disk Mark can work with a SSD, but this is not the only device I'd like to validate.
  • Ramalama - Saturday, July 22, 2023 - link

    I own the KM003C since around 1 Year...
    And bought it on AliExpress for less as 50€.

    Wondering why this review comes so late tbh.

    However, this thing is really great, i have others like the CT-3, which is great either!

    Tbh, the only difference is EPR, for example if i measure my MacBook Pro with the ct-3, it will limit the charging to 100W.
    No matter what you do, your MacBook will never charge higher as 100W

    If i use the KM003c, the MacBook will charge at full 140W.

    But for everything below 100W there is literally no different between the ct-3 and KM003c...
    Just that the one has usb-a and the other usb-c...

    They are both very precise. Actually they work really great!

    Would i recommend to buy one of those?
    No! Why?
    Because you literally use it once you buyed to play with and after some days you will never need it and forget where it even is.

    Cheers

Log in

Don't have an account? Sign up now