Hey everyone,
I have a problem with my data acquisition with an Adafruit Metro M4 Express board.
I am trying to read the analog input at 11 kHz, since the Bandwidth of the sensor is 11kHz.
The ADC of the Metro M4 can sample at 1 MSPS and the MCU is a Cortex M4 core running at 120 MHz. It runs on the Arduino IDE.
I am using a standard script to read the analog input and print it to the serial console.
void setup() {
Serial.begin(115200);
}
void loop() {
// read the input on A0 at default resolution (10 bits) and send it out the serial connection
analogReadResolution(16);
int sensorValue = analogRead(A1);
// Convert the analog reading (which goes from 0 - 65536) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 65536.0) - 3.870498; // Subtract offset
// print out the value you read as human-readable ASCII text followed by a carriage return character (ASCII 13, or '\r') and a newline character (ASCII 10, or '\n'):
Serial.println(voltage, 6);
}
On the other side I used a python script and cool term to receive data and write it to .txt and .csv files. For some reasons the maximum number of readings per second that I receive is around 1800. (1.8kHz)
What seems weird is, if I change the Baudrate from 300 up to even 2000000, the sample rate of 1.8kHz of the received data doesn't significantly change.
I am trying since a few days, since I am quite new to arduino and python and can not figure out where is the bottleneck?
I am wondering, whether it is the serial.println() function. But, to conclude my questions are:
- Where is the bottleneck?
- How can I test different options? - (Already tried to eliminate the baudrate)
- Could it be the HW?
- Why does the sample rate of 1.8kHz of received data doesn't change, if I increase the Baudrate?
Any help is greatly appreciated!!