
Reverse-Engineering Our Spectrophotometer with Claude
- Alexander Grabowski
- Engineering
- March 18, 2026
Table of Contents
Our integrating sphere — the HPCS 6500 spectrophotometer — is a critical piece of equipment for LED development. It measures everything we need: luminous flux, color temperature (CCT), color rendering index (CRI), chromaticity coordinates, full spectrum analysis from 380–1050nm, and electrical parameters like power, power factor, and harmonics.
The problem? The vendor software is a closed Windows application. No API, no scripting, no automation. For a team that automates everything, this was a bottleneck.
The Integrating Sphere Setup

Our test station: the integrating sphere paired with the HPCS 6500 spectroradiometer. The sphere captures total luminous flux from all angles, while the spectroradiometer analyzes the full visible spectrum. Together, they give us everything — lumens, CRI, CCT, chromaticity, spectral distribution, and electrical parameters.
Sniffing the USB Protocol
We used Claude to help us capture and decode the USB traffic between the vendor software and the instrument. The HPCS 6500 communicates over a virtual COM port (STM32 USB serial) using a custom binary protocol — no documentation exists for it.
By capturing USB packets with our usb_capture.py tool and feeding the raw bytes to Claude, we were able to decode the entire protocol: command structure, response formats, measurement triggers, calibration sequences, and power supply control. The full byte-level protocol is now documented in PROTOCOL.md.
The Spectroradiometer

The HPCS 6500 display during a measurement — showing 760 lumens, CCT of 5082K, CRI Ra values, the full spectral distribution curve, CIE chromaticity diagram, and TM-30 color fidelity data. All of this data is now accessible programmatically through our open-source driver.
Open-Source Python Driver
The result is HPCS6500-py — a complete Python driver and CLI tool that replaces the vendor software entirely. It gives us:
- Optical measurements — lumens, CCT, CRI, chromaticity, radiometric flux, full spectrum
- Electrical measurements — voltage, current, power, power factor, frequency
- 50-harmonic analysis — voltage and current harmonics with THD calculations
- Built-in PSU control — the HPCS 6500 has an integrated AC/DC power supply (100–240V AC, 1–60V DC) that we can now control programmatically
- CSV data logging — automated measurement logging for batch testing
- Continuous mode — real-time measurement streaming with automatic power supply management
Closed-Loop LED Tuning
This is where it gets interesting for our LED lamp project. With programmatic access to the spectrophotometer, we can now run closed-loop tuning of our smart LED lamp.

The lamp PCB prototype mounted inside the sphere with an ST-Link debugger attached. The lamp sits at the center of the sphere while we adjust its parameters in real-time and measure the resulting light output.

Our custom calibration tool in action — the left panel shows the lamp’s firmware debug interface with real-time PWM values, current readings, color temperature, and temperature monitoring. The right panel shows our LED Light Calibration Tool reading the mixing ratio table from the device. The calibration process sweeps through color temperatures from 2600K to 5000K, measuring each one in the sphere and computing the optimal warm/cold LED mixing ratios.
The process:
- Set LED driver parameters (current, PWM duty, color channel mix)
- Measure the actual light output — CRI, CCT, lumens, spectrum
- Adjust parameters based on measured results
- Repeat until the target light profile is achieved
This means we can precisely calibrate every lamp against a known spectral reference, compensating for component tolerances and LED bin variations. The result is consistent, high-quality light output across production units — something that’s normally only possible with expensive proprietary systems.
Another Open-Source Contribution
No open-source driver existed for the HPCS 6500 before this. Like our test bench drivers, this is now freely available for anyone with the same instrument. The protocol documentation alone is valuable — it took significant effort to reverse-engineer, and now nobody else has to repeat that work.
Check out the repository: git.b4l.co.th/B4L/HPCS6500-py
