data acquisition on SD card / accelerometer project

hello to all,

I am currently working on a project to trace a trajectory/movement using arduino. We are using a 3 axis accelerometer on a Gotronic Uno and a sd shield with a battery to make a clock.
ref :

GY-61 ADXL335 3-Axial Accelerometer
Shield datalogging GT1046
Card UNO R3 UNO-V3

Currently I make +-27 acquisitions per second, directly recorded on the sd card.
I print on the sd card this: millisecond; axisX; axisY; axisZ

I would like to increase the number of acquisitions per second, as well as to have the precise data of the moment of acquisition of the data (in order to be able to calculate a deltaT).

If you know a way to track the trajectory efficiently or/and other sensor/module to help me in my project I am all ears.

Thanks

Sylver 20 years old, student in electromechanics.

Translated with DeepL Translate: The world's most accurate translator (free version)

I don't understand what you're asking. If you want to increase the acquisition rate, then increase the acquisition rate. Do you have problems with it? "Track the trajectory efficiently"...what does that mean?

Is there any code making this?

add an RTC to the mix. a DS3231 or DS3232. they generate a 32 khz clock signal for finer time resolution, and a time reference

tell us about the angles you expect to see, and slew rates.

Thank to reply

my acquisition rate is like 1data every 0.033 sec, but sometimes it's 0.23 or more. And i don't understand why.

Maybe i don't use the liberary correctly...

this is my code now:
do you see something i can change ?

#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include <RTClib.h>

RTC_DS1307 RTC;
File monFichier;

boolean memo = 0,ire=0;
int bouton = 2;
const int xpin = A2; // axe x de l'accéléromètre
const int ypin = A1; // axe y
const int zpin = A0; // axe z (uniquement sur les modèles à 3 axes)

void setup(){
 
   pinMode (bouton, INPUT);
   pinMode (xpin, INPUT);
   pinMode (ypin, INPUT);
   pinMode (zpin, INPUT);
   pinMode (7, OUTPUT);
 
   Serial.begin(38400); //débute la communication avec le moniteur série
       if (!SD.begin(10)){//teste la communication avec la carte(pin 10 avec le shield)
       return; //stoppe le programme
   }; 
   
   Wire.begin();
   RTC.begin();
   RTC.adjust(DateTime(2020, 4, 10, 0, 0,0));// }
   
   if (SD.exists("mesure.csv")){
     SD.remove ("mesure.csv");
     Serial.println("fichier initialisé");
     }  
}

void loop() {
   DateTime now = RTC.now();
   
   boolean etatBouton=digitalRead(bouton);
   //Serial.println(etatBouton);
    
   int x = analogRead (xpin);
   delay (1);
   int y = analogRead (ypin);
   delay (1);
   int z = (analogRead (zpin)-10);
   delay (1);
  //Serial.print (now.hour(), DEC );
  // Serial.print(':');
   //Serial.print(now.minute(), DEC);
 //  Serial.print(':');
   Serial.print(millis());
   Serial.println (" ax = " + (String) x + " ay = " + (String) y + " az = " + (String) z  );

   
   
 if (etatBouton == 1){
    memo = !memo;
    ire = memo;
    delay(50);
         }
     
 if (ire == 1){
    digitalWrite(7, HIGH);
    if (!(monFichier = SD.open("mesure.csv",FILE_WRITE))){ //tente d'ouvrir le fichier
       return; //stoppe le programme
       Serial.println ("impossible d'ouvrir");
       }
       //Serial.println ("fichier ouvert");
       
     monFichier.print(millis(), DEC);
     monFichier.println(";" + (String) x + ";" + (String) y + ";" + (String) z  );  //fichier .csv est un fichier ouvrable sur excel, chaque donnée doit être séparée par un ";"
     Serial.println ("ecriture");
     monFichier.close();  
     //Serial.println ("fermer");
           }   
     
 else {
   digitalWrite(7, LOW);
 }
 delay(1);
}

You can change and use code tags for attaching code. That's the symbol up to the left in this window.

There is nothing in the code controlling the sampling rate. Delays here and there. If there happends to be many Serial.prints the printout buffer might get filled up and the code will wait for free buffer space.

ok thanks you!

if you know something can help me with the calculation of the trajectory thanks to an arduino sensor, I am a taker.
or a way to calculate that you this sensor !