Open ChironeX1976 opened 1 year ago
Roughly the same problem here. @ChironeX1976 did you found any solutions?
No, i did not find a solution. The program in C is much faster than Python, someone told me, but i did not do any experiments with C. cheerz Kris
Op ma 18 dec 2023 om 06:53 schreef Mahdi Aslani @.***>:
Roughly the same problem here. @ChironeX1976 https://github.com/ChironeX1976 did you found any solutions?
— Reply to this email directly, view it on GitHub https://github.com/waveshare/High-Pricision_AD_HAT/issues/15#issuecomment-1859601810, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANHCYO5FVJWCMS3EVGSSODLYJ7K6XAVCNFSM6AAAAAA2UVGH4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJZGYYDCOBRGA . You are receiving this because you were mentioned.Message ID: @.***>
@ChironeX1976 Read the FAQ in this link. There you can find the reason of low sps and an example code with higher rate (in both c an python). Hope this helps.
I have just had a look at the c implementation on the pi zero2 W
Firstly, there are some optimizations you can do for the SPI communications; You can request multiple bytes from the lower level librarys, instead of going back and forth asking for each byte at a time. This will gain you approx 1KHz straight off.
Secondly, the clock is set to 1MHz, changing this will get you a much higher sampling rate. The clocks are hardcoded. BCM driver needs to set a clock divider, while the wiringpi, and dev lib need to be set. My clock seems to top out at 22MHz. This can be configured in /lib/config/dev_config.c under DEV_module_init.
With the above changes, 35KHz can be achieved with wiring pi.
I was a little bit surprised that not requesting the status bytes actually slowed down the sampling rate.
I feel a better interface to the underlying libraries would be beneficial.
Hope this helps.
Hello, I was looking at buying this ADC for audio as well. I have a very basic question about the 38400 SPS. If you plug in multiple microphones, would the sample rate be divided by the number of microphones, or is this a per-channel figure?
on my Raspberry Pi Zero 2 W I was able to speed up the python solution from 6.275 SPS to 20.500 SPS -- in case someone wants to give it try for more testing: https://github.com/schwebke/High-Pricision_AD_HAT
Did anyone use Pi 5 for this ADC ? I am not able to run this with C as well as python .. because it doesn't have bcm2835 ...can anyone help me.
@bibhu223 to use the python library for RPi 5 do the following:
rpi-lgpio
library
pip install rpi-lgpio
config.py
file and force it to use RPi:
#if hostname == "raspberrypi":
# implementation = RaspberryPi()
#else:
# implementation = JetsonNano()
implementation = RaspberryPi()
- run ```main.py``` (first cd to the folder containing this file)
```bash
Python3 main.py
I have already tried this way ,, but it's showing error Runtime error : Cannot determine SOC peripheral bas address
@mahdiaslanimk Thank you ,, i reboot the system now it's working on python ,, but it's very slow SPS , I was using pi zero W , In C the speed was very good .. but in this case 4kHz in single channel maximum .. How to increase the speed , One more thing the sample rate is not consistent , in my python program I am using some software smoothing and filtering ,which requires constant sampling rate ..but during data acquisition the sample is fluctuating...how to deal with this .
@ChironeX1976 , Have you tried with raspberry pi 5 with C , I am not able to run on C with pi 5 .
@bibhu223 have you enabled SPI interface in the config:
sudo raspi-config
@mahdiaslanimk n@raspberrypi:~/adc/hat/c $ sudo ./main ADS1263 Demo /***/ Current environment: Debian Please make JETSON !!!!!!!!!! Segmentation fault ...This is error I am getting
@mahdiaslanimk yes it's running on python. But the above issue is coming when I run in C . As I need little bit higher data rate ....so I was trying with C . But not able to run.
@bibhu223 i didn’t try the C codes. Have you tried @E-wallace0001 ‘s suggestions or @schwebke ’s codes to speed up data acquisition using python?
@mahdiaslanimk yes , but still if I am plotting the voltage data in real time ...the frequency of data rate is only 40-60Hz ,,
Hello, i was wondering how i can get a higher sample rate when reading a sensor. I use a Raspberry Pi with 8 gig RAM. CPU is set at 1200 Mhz. I am using the ADC-device to capture sound, so i need at least 20.000 samples per second. When i run the by waveshare provided Main.py - TEST_ADC1_RATE at 38400SPS, the output is:
As you can see, i want 38400 samples per second and i get approx. 7000 samples per second.
Attached, also a plot of 10 seconds of audiosignal-recording. 10 seconds * 38400 SPS should be 384.000 points of data. The horizontal axis shows only 80.000 points.
What am i doing wrong?
Thanks for any advice.
Kris