Arduino Rocket Data Logger




Introduction: Arduino Rocket Data Logger

This instructable will show you how to make a model rocket with a data logger payload.The data logger uses an Arduino Pro Mini and a GY-86 IMU (Inertial Measurement Unit - typically used in quad copters) to record altitude, temp, pressure and g force. The data is stored on an SD card and also broadcast via a Bluetooth module. The live data can be seen on your Android smart phone using an app called Talking Serial Monitor . This helps validate the code is working when the electronics are mounted in the rocket before launch. A small alarm has been built in to help you find the rocket if it gets lost! You can either build your own rocket or use a rocket kit. The data logger weighs 35 grams and will fit rockets with an inside diameter of 30mm or larger.

Building a rocket is fairly straight forward, requiring only basic tools. The data logger is a little more involved and may require some fiddly soldering (depending on your approach).

Disclaimer: The data gathered is approximate allowing you to visualise the rockets trajectory and see how high it actually went as well as the acceleration events and average speeds. More detailed info on model rocket physics may be found here.

Rocketry can be dangerous, make sure children are supervised and you launch in a remote area. Check the air laws concerning small rockets before launching in your area!



  • GY-86 IMU
  • Arduino Pro Mini (5v, 16Mhz) ( an Arduino Nano would also work)
  • HC-06 Bluetooth Module
  • Nano-tech 120mAh 2S 25C 7.4V Lipo Battery (or other small battery would work)
  • Micro SD card module and card ( for each flight expect to need roughly 600KB of space)
  • Jumper wires
  • Piezo buzzer
  • Breadboard
  • JST connectors


  • Estes BT55 Body Tube
  • Estes NC-55 Nose Cone
  • Estes BT 55 Body Tube Coupler
  • Estes D Engine Mount Kit
  • Estes D12-7 Motors
  • 5mm Balsa sheet
  • 5mm foam board
  • Launch pad
  • Electric igniter.
  • Parachute
  • Elastic cord
  • Recovery wadding


  • Hobby knife
  • FTDI - USB adapter
  • Glue gun
  • Wood glue
  • Soldering iron
  • Acrylic paint

Step 1: Rocket Design + Build


You may want to start by sketching the design of the rocket on paper or do a mock up model in Sketchup to check the data logger will fit.

You can optimise your design by downloading a free program called Open Rocket. This allows you to simulate your rocket design with different motors, body sizes, fin and nose cone shapes as well as payload weights. I have attached my open rocket design to get you started.


If you use Estes components as I did the actual build is relatively simple.

  1. Start by making the motor mount as detailed in the Estes instructions.
  2. Draw out your fin shape on paper, cut this out and transfer the outline to the balsa sheet.
  3. Cut the fins out using the hobby knife.
  4. Draw a circle on a piece of paper the same diameter as the body tube with lines at 120 degrees. Place the end of the body tube on the circle and align the fins using the guide. Use some glue to attach the fins.
  5. Cut the body tube and glue in the body coupler. This is the part that will separate when the rocket deploys the parachute. The lower portion will contain the motor and parachute. The upper portion contains the data logger and nose cone.
  6. Attach a shock cord between the two sections.
  7. Install a parachute, these can be made from a plastic bag or bought from Estes.
  8. Decorate the rocket as you like.

Step 2: Wiring Diagram


Its best to build the circuit on a breadboard to test and refine the code to suit you before hard wiring things together. I used an arduino uno to test the components then hard wired an arduino mini. The pinouts are the same for both boards.


  • 5V
  • GND
  • CS - PIN 4
  • SCK - PIN13
  • MOSI - PIN 11
  • MISO - PIN 12


  • 5V
  • GND
  • SCL - PIN A5
  • SDA - PIN A4
  • INTA - PIN 2


  • 5V
  • GND
  • TX - RX
  • RX - TX


  • The balance connector that comes with the battery was replaced with a JST connector.

Once your happy with the logger you can solder the components together for a secure connection (see step 4).

Step 3: Data Logger Code

How it Works

The code operates by taking the data from the GY-86 and making a string that it prints to the SD card. The GY-86 has a 3 axis accelerometer, gyroscope and magnetometer built in as well as a barometric pressure sensor. It uses 3 chips, an MPU6050, HMC883L and an MS5611 to do this. For simplicity the code only uses the accelerometer readings in one orientation and the barometric data (i.e it only measures accel readings in the vertical orientation). If you want to carry out more complex analysis of the data you may want to add more data to the string by modifying the code.


Install the following libraries by going to Sketch > Import Library...>Add Library...

  • wire (should be included in the arduino IDE)
  • SPI (should be included in the arduino IDE)
  • SD (should be included in the arduino IDE)
  • MPU6050 - the file attached has been modified to allow the sensor to sense up to +-16G.
  • I2Cdev
  • MS5611

Upload the code to the arduino once the libraries are installed.

You should see a string being printed to the serial monitor like this


This string is split like this

  • First number = absolute altitude in meters
  • Second = temperature (this may over read initially, it should stabilise if left to run)
  • Third = pressure in pascals
  • Fourth = raw acceleration reading (divide by 2048 to get value in G)
  • Fifth = time in milliseconds since the code started running.

Test the acceleration reading is correct by holding the sensor in the X direction, the value should read around 2000. Dividing this number by 2048 will give you a "G" reading of around 1 which is 1 G which is 9.81m·s−2

You should be able to see a change in temp by holding the sensor. You should see a change in altitude by lifting the sensor up or down. The buzzer will only work if the SD card is inserted. I have indicated in the code what numbers to change to alter the buzzer time delay and tone. The buzzer isn't terribly loud but will help you locate the rocket in long grass etc.


Connection via an Android phone is straight forward using the Talking Serial Monitor app. Make sure your phones Bluetooth is on, turn on the arduino and click connect on the app. It may ask for a password which is probably 1234 or 0000. Once connected a solid blue light will light up on the Bluetooth module. The data that would normally be seen on the serial monitor will now be shown on the screen. This feature was included so that you can check the arduino is working correctly before launching.

Step 4: Building the Holder and Hard Wiring


  • The holder was built from 5mm foamboard and can be modified to suit your rocket dimensions.
  • It is simply two disks that fit snugly inside the body tube with a flat piece connecting them.
  • Cut key ways in the disks and flat piece so that they fit together then secure them with hot glue.
  • Cut a small slot to allow wires to be routed from one side to another.
  • When mounting the electronics use a small piece of foam board to act as a standoff then glue the circuit to that.

Hard Wiring

  • It is important to mount the GY-86 correctly, mount it in the x direction ( x arrow pointing up towards the nose of the rocket).
  • If you hard wire your components the logger will be more compact and robust enough to withstand the forces associated with rocketry.
  • Hot glue can be used to make sure the connections are extra secure.
  • This job was fiddly, you could use short jumper wires here if you prefer not to solder, this will be a little more bulky and the connections less secure.
  • The Bluetooth module was glued on top of the battery to save space.
  • When mounting the SD card reader make sure there is space to allow the card to be inserted and removed. I had to cut a small slot in one of the end disks to allow for this.

Step 5: Launch and Data Processing

Before launching the rocket use the app to ensure the logger is working. Attach some tape round the nose cone to prevent it coming off during the parachute deployment. Launch the rocket in an open area!

Once you have completed your flights its time to get the data from the SD card. There will be a .txt file on your SD card. Open it on your computer and copy the data into excel or google sheets. Use the format (text to columns) option to split up the data. Plot the data as you like, more information on model rocket physics can be found here:

You can now experiment with different rocket shapes and sizes, compare your data with Open Rockets predictions or work out approximate speeds and accelerations of your flight. Happy rocketeering!

Space Contest 2016

Second Prize in the
Space Contest 2016

Be the First to Share


    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge
    • Paint Challenge

      Paint Challenge
    • Tiny Things Speed Challenge

      Tiny Things Speed Challenge



    6 months ago

    My code shows up with NAN for altitude. How do I fix this?


    6 months ago

    Whenever I got the output from the arduino it said NAN, -134, -10968, 2000, 24000. What does the NAN mean?


    1 year ago

    Hi everyone, I followed up with the setup and downloaded the attached files for my project. I uploaded the codes to Arduino UNO but my serial monitor is only executing the first line of the code as shown below. Please I need urgent help.

    This is my code line:
    #include <MS5611.h>
    #include <MPU6050.h>
    #include <Wire.h>
    #include "I2Cdev.h"
    #include <SPI.h>
    #include <SD.h>
    unsigned long time;
    const int chipSelect = 4;
    // Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
    // is used in I2Cdev.h
    #include "Wire.h"
    MPU6050 accelgyro;
    //MPU6050 accelgyro(0x69); // <-- use for AD0 high
    int16_t ax, ay, az;
    int16_t gx, gy, gz;
    MS5611 ms5611;
    double referencePressure;
    #define LED_PIN 13
    bool blinkState = false;
    void setup()
    // join I2C bus (I2Cdev library doesn't do this automatically)
    Fastwire::setup(400, true);
    // Initialize MS5611 sensor
    Serial.println("Initialize MS5611 Sensor");
    Serial.println("Could not find a valid MS5611 sensor, check wiring!");
    // Get reference pressure for relative altitude
    referencePressure = ms5611.readPressure();
    // Check settings
    // initialize device
    // Serial.println("Initializing I2C devices...");
    // verify connection
    // Serial.println("Testing device connections...");
    // Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
    pinMode(LED_PIN, OUTPUT);
    // Serial.print("Initializing SD card...");
    if (!SD.begin(chipSelect)) {// see if the card is present and can be initialized:
    // Serial.println("Card failed, or not present");
    // don't do anything more:
    // Serial.println("card initialized.");
    void checkSettings()
    // Serial.print("Oversampling: ");
    // Serial.println(ms5611.getOversampling());
    void loop() {
    // read raw accel measurements from device
    accelgyro.getAcceleration(&ax, &ay, &az);
    // Read raw pressure and temp values
    uint32_t rawTemp = ms5611.readRawTemperature();
    uint32_t rawPressure = ms5611.readRawPressure();
    // Read true temperature & Pressure
    double realTemperature = ms5611.readTemperature();
    long realPressure = ms5611.readPressure();
    // Calculate altitude
    float absoluteAltitude = ms5611.getAltitude(realPressure);
    float relativeAltitude = ms5611.getAltitude(realPressure, referencePressure);
    //change variables to strings
    String comma = String (',');
    String absalt = String (ms5611.getAltitude(realPressure)); //absoloute altitude in meters.
    String temp = String ( ms5611.readTemperature()); //real temp in degrees, may over read initially, will take time for sensor to stabilize.
    String realpressure = String (ms5611.readPressure()); // pressure in pascals
    String accelXraw = String (ax); // raw accel in X. Divide by 2048 to get a "G" reading.
    String timer = String (millis()); //puts a millis time stamp on each string.
    //make a big string containing above strings
    String Baro_data = String (absalt + comma + temp + comma + realpressure + comma + accelXraw + comma + timer) ;
    Serial.println (Baro_data);
    File dataFile="datalog.txt", FILE_WRITE);
    // if the file is available, write to it:
    if (dataFile) {
    dataFile.println(Baro_data);//put Baro_data on the SD card
    if (millis() > 100) //change this number to change alarm delay (1s = 1000ms)
    {tone (8,1000); // change the second number to alter the tone of the peizo alarm
    } else { noTone(8);}


    Reply 1 year ago

    This code finally works for my project. Some of the libraries are outdated, so you can add recent MS5611 and MPU6050 libraries on your Arduino. Also, I observed that Micro SD larger than 16GB will not work on the Arduino project, so I replaced my micro card and everything worked perfectly well. I started with Arduino UNO, then uploaded the program to Arduino Nano 3.3v after soldering all the components.


    Reply 1 year ago

    I am trying to put this system together for a project using an Arduino nano as well, but am certainly getting stuck in the code. We do have one difference in that we are using a GY-521 instead of a GY-86 - would you be able to tell me what you changed to make the code work for your project? And if you have any idea how to change it to work for the 521, that would be super helpful as well. Thank you!


    Reply 9 months ago

    If you use the GY-521 the barometer function won't work, but if you are ok with that you can comment out the part of the code that has something to do with the ms5611. I did it and it worked great. I can upload my code if you want?


    1 year ago

    After purchasing it all, it wont work. My code is throwing errors as if libraries are missing. I put the .h's in accessible spots and they are found only to throw a different .h missing error or unknown processor error. Now it's xc.h is unknown processor. Is there an update for this project?

    Gecko Rocketry
    Gecko Rocketry

    Reply 1 year ago

    I have gotten my code to work even though it took me like 40 hours to get it to work, but if you want an updated version of this project I would recommend LabRatMatt’s Model Rocket Flight Computer With Arduino he goes a little more in-depth about this project.


    Question 3 years ago

    So im having a little trouble with the code itself. I downloaded and included the zip files (libraries) that were included , as well as the code itself. Im using an arduino nano and as i try to test the code (wiring is correct) , the only output that i receive whatsoever is “initialize MS5611 Sensor” I cannot find a way to fix this ! Help please!


    Answer 1 year ago

    I am experiencing similar problem. Any help from any one?


    1 year ago

    My static acceleration value was around 16400. Reading about the GY-06 I reckoned this needs a 16 * 2^10 conversion factor to G, i.e. divide value by 16384 rather than 2048 assuming you have it setup in 16g mode.


    Tip 1 year ago

    A tip from me: when uploading the code to Arduino make sure to disconnect the Bluetooth module. From what I suspect the module interrupts with the code upload making it crush. If that does not work I would recommend unplugging all of the components, upload the code, connect it all together.

    Thanks a lot for the instructable!


    1 year ago

    I built this entire project with no issues according to the specs. The SD card module works great, the blue tooth module works great, the GY-86 is giving me some odd data. The whole project was done on a breadboard with a genuine Arduino UNO. I get data via blue tooth on my phone and via serial on the computer. However, it is parsed as follows: NAN,-134.30,-97684,2053,6007. The first 3 values are obviously wrong. The last 2 are correct. I'm not sure if this is a code problem. The hardware all seems correct. Any suggestions? Possibly one of the libraries is coded wrong? MPU6050, I2Cdev, MS5611.


    Reply 1 year ago

    Hi, sorry you are not getting the right values. Couple of things to try:

    Try another MS5611 library and see what numbers you get.

    There is a similar project below that may help that uses the above library

    I was using an older version of arduino, you could try rolling back to an earlier build that could solve the problem.

    I dont recall having this issue when I built mine.


    Reply 1 year ago

    I tried the above project MS5611 library. It doesn't like it.


    Question 1 year ago

    Wondering if anyone has simplified or improved this cool project since the time it was originally published? Interested in starting on it, but want to avoid using outdated approaches. Thanks!


    Answer 1 year ago

    I am currently working on a slightly different (but hopefully simpler) version of a model rocket flight computer. It should be finished within the next month or so. It is also based on Arduino, MicroSD logging, and the MPU-6050 sensor so it should be very similar.


    Reply 1 year ago

    I would like to see your progress on the modified version.


    Reply 1 year ago

    The hardware for my data logger is finished. The code works but I am planning on re-writing it to be more efficient and readable. Here is a quick video I made a few weeks ago giving an overview of the project:


    Question 3 years ago

    I try the code and I'm getting data but is nowhere near the number I'm suppose to be getting? I'm getting negative numbers? and for altitude I am getting NAN