ADC performance of MicroPython boards

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
User avatar
pythoncoder
Posts: 4935
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: ADC performance of MicroPython boards

Post by pythoncoder » Wed Nov 18, 2020 6:41 am

Interesting. I assume you've seen the figures in the official docs. These were measured on a Pyboard 1.1 and are for read_timed_multi so are just ballpark figures. The comments on IRQ's will still apply.

Note also the boolean result: it would be good if read_timed also produced this.
Peter Hinch

mironk
Posts: 9
Joined: Sun Jan 26, 2020 10:27 pm

Re: ADC performance of MicroPython boards

Post by mironk » Mon Feb 22, 2021 7:29 pm

I tried the below code, which was referenced on teh forum, on my pyboard v1.1:

http://www.robertocolistete.net/MicroPy ... Pyboard.py

It reached about 1.4 MS/s. The problem is that when I checked the buffer length by "print(len(buf))" it showed that the buffer was not 20000 but 10000. So it is two times shorter than declared. I do not understand it. Does it mean that the actual ADC rate is 0.7 Ms/s ?

Errata: Previously I made a mistake. I wrote 1.4 kS/s and 0.7 kS/s. Of course it is 1.4 MS/s and 0.7 MS/s.
Last edited by mironk on Mon Feb 22, 2021 9:28 pm, edited 3 times in total.

User avatar
Roberthh
Posts: 2454
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ADC performance of MicroPython boards

Post by Roberthh » Mon Feb 22, 2021 8:17 pm

Yes, buf has 10.000 elements. But for the sampling time you should be able to tell if the figure was right. At 1.4ks/s, getting 10000 samples takes about 7 seconds. So you should be able to tell, whether the time is 7 seconds or way shorter. I see that the scripts sets the time frequency to 2MHz. That's fast. Try lower frequencies first, like 100kHz or 10 kHz. That should deliver 10000 samples within one second.

Post Reply