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.
ADC performance of MicroPython boards
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: ADC performance of MicroPython boards
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: ADC performance of MicroPython boards
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.
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.
Re: ADC performance of MicroPython boards
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.