I'm not sure if this is the right place to post this but I am using a gps unit (SparkFun U-Blox SAM-M8Q) and am going to be using a pair of Xbees eventually.
I have 5 sensors hooked up to my Arduino nano:
- 1 barometer
- 2 accelerometers
- 1 gyroscope
- 1 GPS receiver
I'm currently just trying to read all of the sensors and print the data to the serial monitor in a csv format. Eventually this data will be saved on an SD card and/or sent wirelessly to my laptop. Currently when I'm trying to read the data over the serial monitor it reads slower than it should and also spits out a lot of gibberish with the data. I've added a timer to only read once every 1 or 2 seconds or whatever but it's still reading slower than the timer says it should. Is this possibly just overloading the processor?
Here's what my code looks like to write to the serial port:
// Current Time
Serial.print(millis() + ", ");
// Barometer
Serial.print(String(barometer.readFloatPressure()) + ", ");
Serial.print(String(barometer.readTempF()) + ", ");
Serial.print(String(barometer.readFloatAltitudeFeet()) + ", ");
// 3g Accelerometer
Serial.print(String(analogRead(littleX)) + ", ");
Serial.print(String(analogRead(littleY)) + ", ");
Serial.print(String(analogRead(littleZ)) + ", ");
// 200g Accelerometer
Serial.print(String(analogRead(bigX)) + ", ");
Serial.print(String(analogRead(bigY)) + ", ");
Serial.print(String(analogRead(bigZ)) + ", ");
// Gyroscope
Serial.print(String(event.gyro.x) + ", ");
Serial.print(String(event.gyro.y) + ", ");
Serial.print(String(event.gyro.z) + ", ");
// GPS
Serial.print(String(latitude) + ", ");
Serial.print(String(longitude) + ", ");
Serial.println(String(altitude));
And here is just a snippet from what the serial monitor looks like:
4082908.47, 69.66, 5445.71, 364, 369, 448, 365, 366, 365, -0.02, -0.03, 0.00, 396976912, -1048882867, 1671586
⸮⸮⸮⸮۾⸮w}I⸮w⸮⸮⸮⸮⸮⸮/⸮5w⸮⸮⸮⸮⸮⸮⸮]⸮⸮⸮y⸮⸮⸮⸮⸮⸮l⸮⸮⸮}⸮zl⸮?l'⸮R⸮y⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮8⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮\⸮⸮&⸮⸮⸮Z⸮~⸮>⸮w⸮⸮⸮C⸮⸮⸮⸮⸮5⸮⸮⸮l>⸮⸮⸮⸮⸮o⸮⸮鱦⸮?ǵe⸮{9⸮X⸮⸮⸮{⸮⸮⸮y⸮ѻ⸮⸮w⸮⸮⸮}e⸮⸮Xv⸮⸮⸮R⸮{⸮y⸮⸮⸮⸮⸮⸮{⸮⸮⸮⸮.3⸮⸮⸮0⸮⸮ 7⸮:3⸮⸮_߮⸮⸮⸮⸮V
~⸮~82915.83, 69.66, 5443.99, 363, 369, 449, 366, 368, 367, -0.01, -0.03, -0.00, 396976950, -1048882816, 1672675
82915.83, 69.66, 5443.77, 364, 368, 449, 366, 367, 365, -0.02, -0.03, 0.00, 396976914, -1048882823, 1672493
I've also tried maxing out the baud rate just to see if that was the problem but I don't think so. Any info/input would be very helpful! Thank you.