Coder Social home page Coder Social logo

pankarfa / accelerometer-calibration Goto Github PK

View Code? Open in Web Editor NEW

This project forked from michaelwro/accelerometer-calibration

0.0 0.0 0.0 371 KB

A general method (with Python scripts) for calibrating accelerometer sensors.

Home Page: https://www.youtube.com/watch?v=-1tmYPE7MAQ

Python 100.00%

accelerometer-calibration's Introduction

Accelerometer Calibration Procedure

A general method (with Python scripts) for calibrating accelerometer sensors.

Developed By: Michael Wrona, B.S. Aerospace Engineering

GitHub: @michaelwro

YouTube: @MicWro Engr

Blog: mwrona.com

Calibration result

Pip Install Python3 Dependencies

$ pip3 install numpy matplotlib pandas  # pip for Windows

Conda Install Python3 Dependencies

(myenv) $ conda install -c conda-forge numpy matplotlib pandas

IMPORTANT: Before following these steps, I highly recommend watching the video I created about this process. You can watch it at this link.

Step 1: Output Comma-Separated Data

record-data.py expects to read comma-separated accelerometer data from a serial connection. Each sensor is different, so you will need to write your own microcontroller code to output comma-separated accelerometer measurements to a serial port, similar to this format:

0.0642208,-0.05490976,1.02357024

Step 2: Configure record-data.py

Open record-data.py in a text editor. Change the variables at the top as required.

Step 3: Measure Accelerometer Data

Once you can output comma-separated raw accelerometer measurements over a serial connection, you can begin logging data. Run record-data.py to begin logging data. Have the accelerometer flat and stationary and press ENTER as prompted. Then, type 'm' as prompted to take a measurement. Move the accelerometer to a different orientation, then take another measurement. Repeat for many accelerometer orientations (sideways, upside down, left, right, etc.).

Step 4: Save Measurements to File

Once you are satisfied with the number of measurements, type 'q' to save the measurements to a tab-delimited file.

Step 5: Calibrate with Magneto

Magneto is an ellipsoid-fitting software used to calibrate accelerometer and magnetometer sensors. Magneto expects raw measurements to be input as a tab-delimited text file. The norm of the gravitational field will be the ideal magnitude of your accelerometer measurements. For example, my accelerometer output data in G's, so my norm/magnitude would be 1. Load your text file generated by record-data.py, then click 'calibrate.' BAM! It's that easy!

Magneto software interface

Step 6: Visualize Results

Open plot-calibration-data.py in a text editor. Copy the A^-1 matrix and bias vector values to the Python code and specify the tab-delimited text file of uncalibrated measurements. Run the code and compare uncalibrated and calibrated data!

3D plot of data

Resources

accelerometer-calibration's People

Contributors

michaelwro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.