How to read from Pico Scope 2204A at a rate of 1ms continuously?

Having problems ? let us know the details here
Post Reply
ananddilpico
User
User
Posts: 4
Joined: Mon Oct 30, 2023 6:15 am

How to read from Pico Scope 2204A at a rate of 1ms continuously?

Post by ananddilpico »

Hello all,
I have been trying to read from the Pico Scope continuously by modifying the ps2000BlockExample code by giving the run block inside a while loop and timing it. I have removed the trigger. I am getting time values above 1ms like 12 ms two to three times while running the loop, for about 10 times. Is there a way to optimize the code so that all the values come below or equal to 1ms?
I am getting time values:
0.0047 s
0.0 s
0.011s
0.001s
0.0s
0.0s
0.0s
0.0s
0.0s
0.0s

Thank you
Anand

bennog
Advanced User
Advanced User
Posts: 208
Joined: Mon Nov 26, 2012 9:16 am
Location: Netherlands

Re: How to read from Pico Scope 2204A at a rate of 1ms continuously?

Post by bennog »

If you want constant timing streaming mode is your only option.
Otherwise you always have random os delay's in the nature of the os.

Benno

ananddilpico
User
User
Posts: 4
Joined: Mon Oct 30, 2023 6:15 am

Re: How to read from Pico Scope 2204A at a rate of 1ms continuously?

Post by ananddilpico »

Hello,
I have tried with the streaming mode example given for the Pico Scope 2000 series (fast streaming mode) and I am still getting a high value of time while timing it for a single read of about 60 ms. I want it to do a single reading in 1ms or less.

Thank you
Anand

Martyn
Site Admin
Site Admin
Posts: 4501
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: How to read from Pico Scope 2204A at a rate of 1ms continuously?

Post by Martyn »

We will need some context to be able to advise on the best option, so

Are you trying to collect a block of x samples at a sampling rate of y and then repeat this process with a fixed time between of z

or are you trying to collect a fixed number of samples x at a sample rate of y and then stop.

It would also help if you can give a full desrciption of what data you need to collect, from where and why you need to do this.
Martyn
Technical Support Manager

ananddilpico
User
User
Posts: 4
Joined: Mon Oct 30, 2023 6:15 am

Re: How to read from Pico Scope 2204A at a rate of 1ms continuously?

Post by ananddilpico »

Hello,
I actually want to measure voltage values continuously through PicoScope. So I am collecting a sample of values (approx:100), taking the mean, and displaying it(this is repeated continuously). For this reason, I am opening the Pico Scope only once and running it by putting the ps2000_run_block and other functions coming after in a while loop. I am getting values but while calculating the time taken for each read in the while loop is greater than 1 ms (without including time taken for the opening of Pico Scope). I have used the ps2000Blockexample with the trigger removed which helped in reducing a lot of delay but not precisely 1ms delay.
If possible I would also like to reduce the time taken for open Pico Scope (approx: 3-4 seconds).
start=time.time()
status["openUnit"] = ps.ps2000_open_unit()
assert_pico2000_ok(status["openUnit"])
end=time.time()
print(end-start) -gives 3 -4 sec as time taken.

Thank you
Anand
Last edited by ananddilpico on Sun Nov 05, 2023 5:13 am, edited 1 time in total.

bennog
Advanced User
Advanced User
Posts: 208
Joined: Mon Nov 26, 2012 9:16 am
Location: Netherlands

Re: How to read from Pico Scope 2204A at a rate of 1ms continuously?

Post by bennog »

I still think streaming is the best solution for you, set it at 100kSamples/sec so you get exactly 100 samples every 1ms. If you average every 100 samples you get then you get 1000 averages / sec.
This will be withing 0.01% of a ms for every 100 samples.
Only the OS, USB, and python will make the timing on the PC vary between 0 and 20 ms, but this is the OS not your sampling. The sampleing will still be 100samples every ms with 0.01% accurate.

Only if python can keep up with the 100000 values per second of data. (this is the biggest IF)

Benno

Post Reply