Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3843

General • Re: Transfer data over wifi for pico for a high sampling rate

$
0
0
Hi Dan,
We are finally sampling properly but the sampling rate seems to be very low. We are seeing 21k samples in 5 seconds worth of data but it should be almost 1 million samples in that time. Am I missing something?

Well a lot of things that I don't know about how you are sampling the data?

1 - Are you using my original version in folder ./picoADC_USB?
Like I said if you modify the SAMPLE_CHUNK_SIZE and SAMPLE_CHUNK_SIZE and set them to 12 and 24 well you reduce the transfer rate about 10 folds. Bigger the chunk last handling between packet!

2- The USB speed transfer by itself!
There is a maximum speed transfer from the USB serial rate. I found out that the PI5 is slower on USB serial transfer than the Pi4.

3- And of course the storage device you are using . If it is a "Pi" than a fast SD card is needed.

Each packet contains timestamp . Check if you are missing some by comparing timestamp!

Modify the "usbtodisk.py" to save nothing but check the timestamp only. This will give you an indice about the transfer rate without saving it.

B.T.W. For all the test I did the best way was the method to save on SDcard using the SDIO mode.

A way to test the data is to store the incoming USB serial port data to ramdisk .
copy everything from the USB serial to a file on the ramdisk.
ex: create a 250 MB ramdisk on rasberry Pi

Code:

daniel@Pi5:~ $ sudo mkdir /ramdiskdaniel@Pi5:~ $ sudo chmod 777 /ramdiskdaniel@Pi5:~ $ sudo mount -t tmpfs -o size=250m aramdisk /ramdiskdaniel@Pi5:~ $ df -hFilesystem      Size  Used Avail Use% Mounted onudev            3.8G     0  3.8G   0% /devtmpfs           805M  6.0M  799M   1% /run/dev/sda2        29G   12G   16G  43% /tmpfs           4.0G  432K  4.0G   1% /dev/shmtmpfs           5.0M   48K  5.0M   1% /run/lock/dev/sda1       510M   75M  436M  15% /boot/firmwaretmpfs           805M  144K  805M   1% /run/user/1000aramdisk        250M     0  250M   0% /ramdiskdaniel@Pi5:~ $
Now /ramdisk folder is a ramdisk
Just transfer everything from the USB port to a file in the ramdisk folder

Code:

cat /dev/ttyACM0 >/ramdisk/capture1.txt
Wait 5 seconds and press ctrl-c.
Now analyze what you have on /ramdisk/capture1.txt.
This way you exclude the speed needed for the python script to decode the serial input and the transfer to store to the SDCard.

Statistics: Posted by danjperron — Tue Feb 20, 2024 8:14 pm



Viewing all articles
Browse latest Browse all 3843

Trending Articles