Skip to content

Hantek DSO5102P oscilloscope (hantek.dso5000p)

  • Connection: USB, resource = "usb://049F:505A", which the Add device dialog fills in. The scope uses its own protocol, not SCPI.
  • Once per PC (Windows):
  • Run pip install "benchloom[usb]".
  • Use Zadig to replace Hantek's driver with WinUSB for the scope. In Zadig, choose Options → List All Devices; the scope is listed as "Gadget Serial v2.4" (USB ID 049F 505A), while Device Manager calls it "DSO Measurement Device".

Hantek's own PC software no longer finds the scope after that, until its driver is put back in Device Manager. - Once per PC (Linux): install Benchloom's udev rules (benchloom udev-rules, see Getting started). No other driver is needed. - Commands: - Channels: set_channel, set_volts_per_div (including the probe factor), set_coupling, set_probe, set_position, set_bandwidth_limit. - Trigger: set_trigger(source, slope), set_trigger_level (volts), get_trigger_state, force_trigger. - Timebase and acquisition: set_timebase (2 ns to 40 s per division, 2-4-8 steps), get_timebase, run, stop, autoset. - Data: read_waveform(channel) returns {time = {...}, volts = {...}}, and capture() returns that for every channel that is on, as {CH1 = ..., CH2 = ...}, ready for save_waveform. measure_vpp, measure_vrms and measure_mean are worked out from that waveform. measure_frequency reads the scope's hardware counter for the trigger source. The counter takes 2 to 3 seconds to show a new frequency, so wait that long after changing the signal. - Frequency response: measure_response(hertz, input, output, periods) (input CH1 and output CH2 by default) returns {gain_db, gain, phase_deg, input_vpp, output_vpp, input, output} for a sine of that frequency going through a circuit; input and output are the waveforms it measured. It sets the timebase to show about four periods, switches both channels on, triggers on the input, sets each channel's volts/div so the signal fills about six divisions, and fits a sine of the known frequency to both waveforms (least squares, so noise matters little). phase_deg is the output relative to the input, between -180 and 180°. The Bode plot project template uses it. - The volts/div ranges differ by up to 2 % (0.5 V/div read 0.18 dB below 1 V/div), while the two channels on the same range agreed within 0.1 dB. So measure_response puts the output on the input's range as long as it still spans two divisions there, and gains near 0 dB compare like with like. - Settings writes are what take the time: the scope ignores requests for about 0.65 s after one. The driver writes all changes of a step at once, skips writes that change nothing, and asks again every 0.1 s until the scope answers (each unanswered request used to wait out the 1 s timeout). A Bode point takes about 1.2 s, or 2.2 s when a range changes. - Limits of the protocol: - Only the on-screen part of the record comes over USB (3200 to 15360 points). - Waveforms can only be read while the scope runs. - From about 8 ms/div up, a waveform is there only for a moment between acquisitions; asked at the wrong time, the scope answers that it has none. Asking again straight away got one usually within a second, but sometimes only after 3 to 8 s, at random, so read_waveform keeps asking for up to 10 s. With a pause of 0.25 s between requests, 20 and 40 ms/div often got nothing at all. - From 80 ms/div on the scope scrolls (scan mode). The two channels are then read from different moments, so measure_response goes no slower than 40 ms/div and refuses frequencies below about 1.6 Hz. - The timebase is set by pressing the time/div keys, because a settings write stores it without applying it. - Safety: the driver uses only commands that were verified on a real DSO5102P. It never sends the factory/debug protocol (some of its commands can brick the scope or wipe its calibration), never writes the memory depth (that crashed the scope) and changes only the channel and trigger settings that were tested. - Frequency response, tried on hardware: an FY6900 into 3.3 kΩ and a ceramic capacitor, generator to CH1, capacitor to CH2. The Bode template swept 5 Hz to 100 kHz at four points per decade in 75 s (126 s before the writes were sped up), with the same results: -0.06 dB at 5 Hz, -56.3 dB at 100 kHz (-57.0 dB expected for a single pole), the phase from -2° to -89°, and the -3 dB point at 140.5 Hz, where the phase gives 142 Hz (about 340 nF). A point takes 1 to 6 s, more below 50 Hz. - Simulator: shows a 1 kHz sine on CH1. With sim://?dut=rc_lowpass&cutoff_hz=150 it is wired like a filter test instead: CH1 shows channel 1 of a simulated FY6900 in the same run and CH2 shows it after an RC low-pass with that cutoff; dut=rc_highpass puts a high-pass there. - Tried on hardware: a DSO5102P on Windows 10 with WinUSB, measuring its own 1 kHz probe-compensation output on CH1. - Waveform: 3840 points read in 0.18 s. The signal is a 0 to 5 V square wave, and its period from the waveform is 1.0000 ms. - Measurements: the hardware counter reads 1000.000 Hz; mean 2.49 V, RMS 3.51 V. - Settings and keys: volts/div, position, trigger level, timebase (by key presses, 0.4 to 0.7 s per change), stop and run all work. Reading a waveform while stopped fails as described above. - Settings layout: the copy read from the scope matches the bundled one. - Pacing: the scope drops a request that follows a reply too closely. The driver therefore waits 80 ms after the end of each reply, not after the request. It also re-syncs and retries a request that goes unanswered. - Source: the reverse-engineered protocol notes of kooscode/hantek-dso5000p-linux (MIT licence). protocol.inf, the layout of the settings block, is copied from there. At connect the driver reads the scope's own copy and falls back to this one.