I’m working on an ECG-related school project, using the TI ADS1298 with the Arduino. They communicate via SPI and I’ve had success with writing/reading register and getting data out of it. Here’s a sample of the ECG signal I plotted out via Matlab. (I have attached the file)
It has some erroneous spikes and inconsistencies, and after some thinking I am speculating that it is due to the Serial.print taking too much time. Currently, I am saving data by printing it to the Coolterm Serial Terminal which will then save it to a .txt file at the end of it. I’m not sure if the Arduino Serial Monitor is faster.
If data is ready → SPI transfer to read data → Print data to Coolterm Serial Terminal.
In between the time taken to print data to the terminal, the code is unable to check if there is any data is ready, and even if it is, the program will not be able to retrieve it if it is still printing to serial terminal. As such, I am speculating that some data samples might be lost. I am planning to sample at 8000 samples/sec. The above image is sampled at 500 samples/sec and I’m already losing samples.
As such, I have a few questions.
Since it seems like the serial terminal is taking way too long to print (even with baud rate 115200), is there another fast way to save data?
Is the slow Ardunio printing-rate due to hardware or software issues?
I was reading that the Teensy serial can communicate at 12Mbit/sec. Will this alleviate the issue? Cos right now I’m unsure if that itself is a software/hardware issue.
There isn’t much memory on the Arduino to make use of. I’ve read a bit about buffers, as temporary places to store data. Are buffers a physical memory of a microcontroller? Or are they just an extra variable assigned to hold data?
Any advise will be appreciated.
Thanks in advanced.