Sigrok and devices like the Hantek 6022BE: Continuous operation? - Page 1
Forum section: electronics / testgear

author: Whales
author_rank: Super Contributor
timestamp: April 19, 2018, 10:41:22 pm
content: Whilst reading about USB o-scopes and the sigrok project I had assumed that you could use such a setup to continuously stream data from the scope. Eg record samples from an experiment continuously with sigrok-cli over the span of a few hours or more.Yesterday I found out this was not the case -- I tried with a Rigol DS1000E series scope and found it only does single shots. No info on the sigrok wiki seems to elude to this.I have been trying to read the6022BE mega-topichere on the forums. I've found some discussions and arguments about continuous capabilities, but I'm finding it difficult to find concrete answers.(1) Am I approaching this problem incorrectly? Is a "USB oscilloscope" always limited to short captures and I'm actually after a different name/type of equipment? [NB: student budget, not commercial](2) Where do I find information about eg the Hantek 6022 BE's continuous capture capabilities? Eg a list of sampling rates that it can sustain continuously over USB?

author: abraxa
author_rank: Frequent Contributor
timestamp: April 20, 2018, 10:53:07 pm
content: Quote from: Whales on April 19, 2018, 10:41:22 pmYou can, it just depends on the hardware and whether it supports streaming or not.Quote from: Whales on April 19, 2018, 10:41:22 pmWhich fact surprised you here? The fact that the Rigol isn't able to stream or the fact it's not mentioned on the wiki?Quote from: Whales on April 19, 2018, 10:41:22 pmDepends. USB2 is rather slow and analog data doesn't compress well, so USB scopes that stream are rather bandwidth-limited. The situation is different for USB3 but I don't know of any streaming scopes there. The closest thing I do know would be the range of devices offered by Saleae.Quote from: Whales on April 19, 2018, 10:41:22 pmI don't know whether the device supports this feature. Would definitely be nice to add to the libsigrok driver if it does.

author: Whales
author_rank: Super Contributor
timestamp: April 21, 2018, 01:19:41 am
content: QuoteBoth.I see "continuous capture streaming" as the No. 1 defining feature of a USB scope. Without this they would provide no advantage over a standalone scope that I can see, other than cost + size.Am I wrong? I've never bought one of these (eg a Hantek) before. The fact I can't find any solid information on this is making me wary.The ability to capture and stream data only for short intervals, as the Rigol USB support appears to do, is little different in my mind to saving a screenshot or data capture from the scope onto a memory stick. The USB link to a PC is a live connection, there's zero point having it when you don't support any tasks more live than equivalent to saving onto a memory stick.QuoteAll good. The theoretical limit of 480Mbit/s (60MB/s) is still a magnitude or more than what I actually need (eg 100K samples/s * 8 bits = 100KB/s + overheads).On the note of compressibility: it would be possible to make some cheap lossless reductions to be able to stream more than the link would be otherwise capable of. Eg 4 bit deltas most of the time and then 8 bit raw samples when the value jumps by more than 4 bits. Alas it would have nasty practical implications: if your data changed to a less compressible form during a live capture then you would get buffer overruns (holes). So yeah, no to thatQuoteThanks, I'll have a look.QuoteApologies: are you saying that the libsigrock driver doesn't have continuous capture support for the Hantek 6022BE?Given that sigrok-cli straight out told me the Rigol didn't support continuous capture (only when I tried to run it), I'll have a poke at the source and see what it says about what devices support it.

author: NiHaoMike
author_rank: Super Contributor
timestamp: April 21, 2018, 01:48:20 am
content: Quote from: Whales on April 21, 2018, 01:19:41 amUse a sound card with a hacked front end?

author: Whales
author_rank: Super Contributor
timestamp: April 21, 2018, 02:26:23 am
content: Quote from: NiHaoMike on April 21, 2018, 01:48:20 amI was thinking of using a soundcard, but I need DC measurement.Thanks for the idea. I might try shorting some input caps out on some USB sound cards nowSee how they fare.

author: NiHaoMike
author_rank: Super Contributor
timestamp: April 21, 2018, 05:06:03 am
content: Assuming it's not a black blob (the only blob type sound cards I have come across are limited to 48kHz with a rather bad SNR), find the datasheet for the ADC and it will tell you what its working input range is. Then design a front end and antialiasing filter using opamps.

author: Whales
author_rank: Super Contributor
timestamp: April 21, 2018, 07:31:02 am
content: I had two cheap USB sound cards handy, both epoxied black-blob chip on board. It turns out one was already dead, and the other applies AC coupling even if you bypass the input stage and inject directly into the chip.Overall however, I'm after something that:Doesn't require me to maintain the hardware (going to a home with more software-oriented folks)Can sample 100KsamplesI'll keep treading this audio card route for fun, but I'm still hoping to find more info about sigrok-supported devices and continuous capture.

author: Whales
author_rank: Super Contributor
timestamp: April 21, 2018, 07:50:16 am
content: Looking at the source code of libsigrok: the driver for hantek-6xxx has no mention of the SR_CONF_CONTINUOUS flag. This suggests me me that it's not supported.Dang.There are many drivers that do have that flag.abraxa:if it means anything then yes, I think it's really important to have information about CONTINUOUS support on the wiki. It would be a nasty bummer to buy a device based off sigrok's support list and then find out you can't use 'sigrok-cli --continuous' on it only afterwards.

author: abraxa
author_rank: Frequent Contributor
timestamp: April 21, 2018, 08:03:50 am
content: Quote from: Whales on April 21, 2018, 01:19:41 amI agree for the most part, though not entirely. The advantage of having a live USB connection is that you can save tens/thousands/millions of those data captures and perform an analysis on all of them. I, too, see streaming as the #1 reason to have a USB scope, though.I wasn't aware that your requirements were so low. Somehow, I figured you'd need more. So depending on how many channels you need,https://sigrok.org/wiki/Supported_hardware#Mixed-signal_devicesmay have something for you. Those "8ch, 24MHz; 1ch analog, 3MHz BW" devices offer only one channel but they're cheap and do streaming since they're FX2-based.Quote from: Whales on April 21, 2018, 01:19:41 amYeah, the driver doesn't have it implemented, as you noticed yourself. Whether it *can* be implemented on that device, I do not know.Quote from: Whales on April 21, 2018, 01:19:41 amThanks for the hint, I'll see what can be done.

author: PA4TIM
author_rank: Super Contributor
timestamp: April 21, 2018, 09:40:41 am
content: Thanks, I knew Sigrok, had it installed through synaptics to run my Zeroplus under linux on my old laptop, but I dit not know it could talk to so many instruments. Thanks to your topic I looked it up and found a how to install page for the whole package and I did that.Sorry, I have no answer to the question.

author: Whales
author_rank: Super Contributor
timestamp: April 21, 2018, 12:06:46 pm
content: QuoteI'm looking at alternatives to an NI USB-6216 that's currently in use by a team I'm working with. Long story short: it's occasionally/intermittently crashing a few hours into experiments. As well as trying to fix/diagnose the issue I'm also looking at alternatives devices.The most severe use case I have seen so far is two analog channels @ 100Ksample/s each. If I can get something working reliably at this level then I'll make some people very happy.The sigrok environment is appealing because it has simple-looking tools like sigrok-cli. This contrasts with NI's SignalExpress, a big GUI program with lots of quirks that outputs in a strange and proprietary TDMS file format.I'm also looking at BitScope's products at the moment. I've shot an email off to them asking about continuous capture capabilities.QuoteThanks for the chipset tip. I'll poke into this category.EDIT: It's a shame only one analog channel on the FX2's works at a time (not sure if this is a hardware or sigrok limitation). Otherwise these would be absolutely perfect.

author: Whales
author_rank: Super Contributor
timestamp: April 21, 2018, 12:09:47 pm
content: Update on the soundcard front: no luck.I've just finished trying to inject DC-biased signals after the input caps of three sound cards (2x USB and 1xPCI) without success. The signals stay AC coupled and I just hit invisible clipping walls if I try to move the DC offset. I'm beginning to suspect that I'm either very unlucky with the cards I have lying around or that something between the card and me is applying AC coupling (in software).

author: Uwe Hermann
author_rank: Contributor
timestamp: April 21, 2018, 03:11:26 pm
content: Quote from: Whales on April 21, 2018, 12:06:46 pmHardware limitation. The FX2 has 16 IOs that can be sampled very quickly and streamed to the PC via USB. The 8+1 devices use 8 of those IOs for logic analyzer data, and the other 8 for one 8-bit analog sample value (they have a parallel ADC on the PCB). The most you could do (if your hardware is properly designed; some aren't) is two 8-bit analog channels.

author: horo
author_rank: Regular Contributor
timestamp: February 25, 2022, 12:29:10 pm
content: Quote from: Whales on April 19, 2018, 10:41:22 pmEven if it is an old question, for the sake of completeness: the Hantek can measure continuously, see:https://github.com/Ho-Ro/Hantek6022API#use-the-device-as-a-data-loggerIt writes its output as CSV (time, channel, channel2).Code:usage: capture_6022.py [-h] [-d DOWNSAMPLE] [-o OUTFILE] [-r RATE] [-t TIME][-x CH1] [-y CH2]optional arguments:-h, --help show this help message and exit-d DOWNSAMPLE, --downsample DOWNSAMPLEdownsample 256 x DOWNSAMPLE-o OUTFILE, --outfile OUTFILEwrite the data into OUTFILE-r RATE, --rate RATE sample rate in kS/s (20, 50, 64, 100, default: 20)-t TIME, --time TIME capture time in seconds (default: 1.0)-x CH1, --ch1 CH1 gain of channel 1 (1, 2, 5, 10, default: 1)-y CH2, --ch2 CH2 gain of channel 2 (1, 2, 5, 10, default: 1)For visualisation, you can use this program, for example:https://github.com/Ho-Ro/Hantek6022API/blob/main/examples/plot_from_capture_6022.pyCode:usage: plot_from_capture_6022.py [-h] [-i INFILE] [-c CHANNELS] [-s ]optional arguments:-h, --help show this help message and exit-i INFILE, --infile INFILEread the data from INFILE-c CHANNELS, --channels CHANNELSshow one (CH1) or two (CH1, CH2) channels, default: 2)-s , --spectrum display the spectrum of the samples, optional up to MAX_FREQ

author: Whales
author_rank: Super Contributor
timestamp: February 25, 2022, 09:22:36 pm
content: Thankyou HoroDespite the age of these devices they still seem to be popular and easy to get, so this is useful to know.It looks like they might support up to 1Msample/sec in continuous capture?https://github.com/OpenHantek/OpenHantek6022/blob/main/docs/limitations.md... but then if they're using 256x downsampling mentioned in your link then this will really be 78.125 Ksample/sec? I presume that's configurable.

author: horo
author_rank: Regular Contributor
timestamp: February 28, 2022, 07:43:08 pm
content: Quote from: Whales on February 25, 2022, 09:22:36 pmNo, due to the python calculation overhead in the callback function the max speed is limited to 128 kS/s with the latest version. The downsampling limits the data size for long recordings and increases also the SNR (every 4x oversampling gives one additional bit of resolution, seehttps://www.silabs.com/documents/public/application-notes/an118.pdf).EDIT: max rate increased to 200 kS/s with latest version 2.10.1https://github.com/Ho-Ro/Hantek6022API/releases/tag/2.10.1