Python Forum
Sampling - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Sampling (/thread-36678.html)



Sampling - frohr - Mar-17-2022

Hi,
Is there any possibility how to read samples - one sample every 30microseconds?
Is it real in python?
I need read samples via GIPO pins, in totoal 30k samples.
One array will be time in microseconds [0,30,60,.....]
Second data [20.2233443,21.3454567,19.3456543,.....]
Is it possible on Raspberry with Python?

Thank you


RE: Sampling - Larz60+ - Mar-17-2022

frohr Wrote:Is it possible on Raspberry with Python?
it's done all the time. One sample every 30 ms is not fast and easy.
Of course a sample from GPIO is binary.
If you need to read intensity or other analog signal, you will need to used Analog to Digital conversion
example, see: https://learn.adafruit.com/raspberry-pi-analog-to-digital-converters

There are quite a few tutorials on using python to read GPIO in the pi.
Use google, it's your friend here.
Here's one example: https://projects.raspberrypi.org/en/projects/physical-computing/1


RE: Sampling - frohr - Mar-18-2022

I use ADS1256 connected to the GPIO pins. But now I am pretty sure, there is no possibility to read 30kSPS on Raspberry with Python.
Anyway, thank you for links.


RE: Sampling - deanhystad - Mar-18-2022

33 khz sampling is going to be a challenge with C. No way with Python.


RE: Sampling - Larz60+ - Mar-18-2022

to get a feel, see: https://forums.raspberrypi.com/viewtopic.php?t=128387


RE: Sampling - frohr - Mar-21-2022

OK, thank you for info.
I will use Teensy 4.0 with ADS1256 because there I can sample 30kHz and then send array to Raspberry via USB for FFT.
In this case I will have more hardware and more power consumption but is works fine.


RE: Sampling - Marbelous - Mar-21-2022

Those Teeny boards are pretty cool. I was going to chime in with the dual problems of sampling speed and non-determinism with the RPi but the Teeny looks like a good solution for both. Let us know how it works out...


RE: Sampling - Larz60+ - Mar-22-2022

FYI: you can add up to 16 MB additional memory if needed (teensy 4.1) for $3.40
see: https://www.pjrc.com/store/psram.html