I am trying to read data from the accelerometer, however I find that the maximum data rate appearing on the serial monitor is 25Hz. Ideally I would want to push it up to 1600Hz, but the data rate cannot exceed 25Hz. Is there a way of overcoming this?
I haven't played with the IMU enough to know if the the gyro and accelerometer need to be set to the same rate. I guess it depends on your application.
I tried changing the output data rate using those functions, but the data output in the serial monitor can only go up to 25Hz, any higher and there would be information left out, do you have any idea how to overcome this?
Printing to screen is pretty slow, the rate will depend on the number of characters printed.
Are you passing this data to a program or another board? You should get better performance once you are not outputting it to the screen. Using Serial.write may be fastest.
It should help, since at 9600 bps you can only send ~40 strings composed by 30 chars every second (without considering the overhead).
Try configuring the Serial with 460800 as baudrate (the maximum reachable without any transmission error)
Thanks facchinm! I changed it to 460800 and it worked...the maximum data output is now at 100Hz, I don't suppose you know if there's anything else I can do to reduce the latency and make it display at 1600Hz?
Well, to display 1600Hz of 6 axis through a serial connection (let's suppose there is no overhead) you should:
pack your data to a binary format of choice (16bit raw data per sample should be enough) -> 1626 = 192bit
you want 1600Hz, so your channel should support at least 192*1600 = 307200 bit/s
Setting the serial to 460800 should be enough, but you should add at least a start and stop byte to the transmission.
From my experience, a 1Mb UART is ok for your purpose, but since the USB connection cannot reach this speed you should use Serial1 (pins 0/1) interfaced with an FTDI serial to USB converter
Hi facchinm, from what I understand USB2.0 has a theoretical maximum speed of 480Mbps, so shouldn’t 307200bps be acceptable? What is causing the bottleneck?
Also why did you multiply 16 by 2? Isn’t 16 the number of bits for each axis on the accelerometer/gyroscope?