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

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

$
0
0
The data format is correct but,
ADC0.JPG
N.B. Step aren't in 5 us interval
This file is only 3.5MB which gives only 1811847 data points in 7 minutes.

Code:

daniel@linuxserver:~/pico/picoADC_UDP/picoADC_USB$ ./bin2csv data.dat  /dev/null.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Got 1811847 data pointsAll Done!
This mean that your sample rate is around 4313.92 sample/sec

I can't figure out Why your Pi4 is so slow. I thing that I will try with my RaspberryPi B ver 1.1 to see how slow it is.
What is your SD card model and speed ? Is the boot drive the SD card?
I hope that you aren't using an external USB memory stick to store the data ?
Are you in Desktop mode or console mode?
Did you try using the ramdisk version?
Do you have something else running on that Pi4?

B.T.W. this is a little program to convert the binary output to a csv readable text file.
First parameter is the Input binary file
Second parameter is the CSV text output File.
Third parameter is the maximum number of data point to output. If omitted there is no maximum count. (Excel max is 1048576)

bin2csv.c

Code:

#include <stdio.h>#include <stdlib.h>int main(int argc, char * argv[]){  FILE * src=NULL;  FILE * dst=NULL;  unsigned short buffer[2048];  size_t bufferSize;  int loop;  int Maximum=0;  int Count;  int RunFlag=1;  if((argc!=3) && (argc!=4))  {    printf("\nUsage:\n       extractdata PicoADCDatfile    CSVFile.txt  maximum_count\n\n");    return -1;  }  src = fopen(argv[1],"rb");  if(src == NULL)   {    printf("Unable to open %s\n",argv[1]);    return -2;   }  dst = fopen(argv[2],"wt");  if(dst == NULL)   {    printf("Unable to create %s\n",argv[2]);    fclose(src);    return -3;   } if(argc==4)    Maximum = atol(argv[3]);  Count=0;  while(RunFlag)  {    // get 2048 word to fill buffer    //    bufferSize = fread(buffer,2,2048,src);    if(bufferSize==0)       break;   for(loop=0;loop<bufferSize;loop++)  // we read short than it is 2 bytes   {      fprintf(dst,"%d\n",buffer[loop]);      Count++;      if(Maximum > 0)      {        if(Count >Maximum)         {           RunFlag=0;           break;         }      }   }  printf(".",bufferSize);  // this is just an indicator  }  printf("\nGot %d data points\n",Count);  printf("All Done!\n");  fclose(src);  fclose(dst);  return 0;}

Statistics: Posted by danjperron — Thu Feb 22, 2024 8:27 pm



Viewing all articles
Browse latest Browse all 3862

Trending Articles