Serial Data Logging to SD card


#1

I’m something of a pro at Arduino programming, but this is my first Particle project, and I’m unsure of myself in the dialect of these controllers.

I’m using an Electron to receive data on a serial connection, and I need to store it on an SD card that will later transmit it via GSM to an online database. The data comes in 27k chunks, and there is no handshaking to tell the sending device to wait (the original receiving device was apparently really good at listening).

Is there some way to stream directly to the SD card or would I have to somehow buffer the data in between? I have some idea how to do that on an Arduino but I have no idea if same would work for an Electron.

Any ideas?


#2

This might be a quick and effective solution for your chunks:

I’m running this in a couple serial collectors quite effectively and it’s been flawlessly operating for awhile now.


#3

Thanks! It gives me somewhere to start.


#4

I can vouch for the @rickkas7 Serial Buffer library. I’m using it and it works great. At slow baud rates, it’s a bit overkill. But for higher bauds rates, it’s a must. I have a barcode scanner hooked up at 9600 baud and I don’t think it has ever returned more than 1 character from the buffer at a time but I’m still using it just in case. I have minimal code in my loop as well which helps clear the buffer fast. Experience will vary.


#5

I was able to transmit the file at 250k baud and never missed a character with a 4k buffer, so the library gets my thumbs up as well.