recording Cyton data to SDcard @ 1000 Hz
Hi developer,
I have bought my Cyton board at Apr 06,2020. I am looking for a way to change the sample rate up to 1000 Hz. I follow the threads online but I failed. Is there any way to change my sample rate? It becomes 250 Hz after when I use dongle or even Wifi-sheid following the guide of SDK. I am going to do the project which can record the EEG data by SD card at 1000 Hz sample rate.
The second problem is that I had tried to refresh my Cyton to default board firmware version (v 3.1.2); however, my SD card files( . txt) cannot convert to SD_converted file. It does work will before I refresh the firmware, do you have any idea about this question? I've attached the .txt file
all the best
Howard
OBCI_28.TXT (https://drive.google.com/file/d/1uv1D9_HdxjfGu8X5vJZ6gVHL0pJUW1ID/view?usp=drive_web)
Comments
I was suggested to mention @wjcroft ,@retiutut and @evaesteban
Howard, hi.
There is a firmware fix you can try, that enables faster SDcard recording, using just Bluetooth, see.
https://github.com/OpenBCI/OpenBCI_Cyton_Library/pull/96
https://openbci.com/forum/index.php?p=/discussion/2435/over-250-sps-to-sd-card-using-bluetooth-dongle
I'm not clear why you are having issues with Cyton + Wifi Shield and faster sample rates. Cyton is known to be glitchy with the Shield. Some workarounds suggested include powering Cyton mainboard and Shield (both) with separate 6v alkaline power supplies. And using UDPx3 packets.
Hmm, the conversion happens in the GUI, correct? You are saying the GUI is not converting correctly? Mentioning Richard @retiutut.
William
GUI v4 can convert SD card files to work with GUI v4.
GUI v5 can read SD card files without conversion.
@retiutut Did you see the .txt file that I had attached? Both serial monitor and GUI asked me to"try the valid file". Here is the error message" Tried to load anun supported file for platback! Please try a valid file" I am wondering why the .txt file cannot be generated correctly?
1
I'm using cyton+Wifi because I always failed to record data with SD card at sample rate 1000. The problem is that I can't even have a correct data by recording with SD card using only cyton at the rate of 250 after I uploaded the default board code.
@HowardK I am unable to download the file you shared to test. Can you make it public please?
Is it available now?
@HowardK The file looks corrupt, and I see characters in your file that should not be there. Also, it looks like only a few samples are written to file.
@HowardK's Cyton SD Card Recording
Normal Output
This is likely caused by an error/glitch in the firmware. You may need to re-flash the firmware to the Cyton. @wjcroft Do you agree that HowardK should re-flash? Let's get confirmation before you try this.
Richard, hi. I agree that a reflash is worth a try.
I've long argued for adding this feature to the Cyton firmware: when it starts up, it should checksum its code segment, and compare to a known value. That way, if flash errors creep in over time, the startup routine would warn of this.
Over the history of Cyton flash firmware, we've seen multiple cases where a firmware reload normalized the operation of unusual behaviors.
William
@retiutut @wjcroft
Thanks for your replying! The reason why the glitch happening might be the speed of SD card writing is not fast enough. I have re-flash my board for tons of times. It seems like not the uploaded problem. I had solved the problem after changing my SD card.
@wjcroft
How can I make sure the SD card data I got is at SPS==1000Hz? I use SD-converted file which output by GUI v4 to check it. The file told me that the SPS is 250Hz,however; The arduino serial monitor told me I am in SPS==1000Hz after I sent the comment ~~.
The header in the GUI CSV text file is unchanging, would be my guess. You should be able to tell by the length of your file, the number of samples / lines will be roughly seconds * 1000.
The SD card conversion in GUI v4 might be hardcoded to 250Hz for 8ch and 125Hz for 16ch. Try @wjcroft's suggestion.
GUI v5 SD card playback is also hardcoded at the moment to 250Hz and 125Hz. The reason is that the SD card file does not indicate the sampling rate in the header.
Does it mean that I have to modify the column of SPS to 1000 by hand ?
The converted output file is a CSV text file. The comments at the top are ignored by any CSV reading program.
Does that mean we cannot read the data at the rate of 1000Hz with GUI v5? I am wondering how can I read it without GUI v4?
There are a handful of options:
Hardest and not a good idea: Modify Cyton Firmware SD Card File Code and GUI for all users.. Requires firmware update... Could brick hardware!!!
Moderate: Add an option in the Control Panel to Specify SD Card Sampling Rate Manually
Easiest: @HowardK can run the GUI from Processing and modify 1-2 lines of code for now to make it work. Details below.
https://github.com/OpenBCI/OpenBCI_GUI/blob/58fb49495841ac2fbabc68d4b69d9b0c7a8bffe0/OpenBCI_GUI/DataSourceSDCard.pde#L46
https://github.com/OpenBCI/OpenBCI_GUI/blob/58fb49495841ac2fbabc68d4b69d9b0c7a8bffe0/OpenBCI_GUI/DataSourceSDCard.pde#L53
It's ok to build off of 5.0.1(current public release). Remember to copy the libraries to the Processing library folder. And you can also use the Processing IDE to export the application as a standalone executable.
@retiutut So I need to change the number to 1000 and 500 if my Sampling rate is 1000?
>
https://github.com/OpenBCI/OpenBCI_GUI/blob/58fb49495841ac2fbabc68d4b69d9b0c7a8bffe0/OpenBCI_GUI/DataSourceSDCard.pde#L46
Yes. Existing SD card playback code in GUI 5.0.1 looks for the number of columns to determine if 8ch or 16ch are present in file.
I have implemented the changes in processing GUI. Do I also need the custom firmware cited above for this to work?
Still getting 250hz after following @retiutut suggestion