Giter VIP home page Giter VIP logo

esp-idf-gy85's Introduction

esp-idf-gy85

A demo showing the pose of the GY-85 9DoF IMU sensor in 3D using esp-idf.

GY-85 consists of the following three chips.

  • ADXL345 Accelermter
  • ITG3205 Gyroscope
  • QMC5883L Electronic Compass

You can use the Kalman filter to estimate the Euler angle.
Euler angles are roll, pitch and yaw.
It's very intuitive and easy to understand.
a-Pitch-yaw-and-roll-angles-of-an-aircraft-with-body-orientation-O-u-v-original

First, calibrate the compass and find the offset value for each axis.
As you can see, the X, Y and Z axes are quite off-center.
gy85-calib-1

Then use the sensor values to find the Euler angles.
gy85-euler

I used this library.

Software requiment

ESP-IDF V4.4/V5.x.
ESP-IDF V5.0 is required when using ESP32-C2.
ESP-IDF V5.1 is required when using ESP32-C6.

Hardware requirements

GY-85 9DoF IMU Sensors.

Wireing

GY-85 ESP32 ESP32-S2/S3 ESP32-C2/C3/C6
VCC_IN -- N/C N/C N/C
3V3 -- 3.3V 3.3V 3.3V
GND -- GND GND GND
SCL -- GPIO22 GPIO12 GPIO5 (*1)
SDA -- GPIO21 GPIO11 GPIO4 (*1)
M_DRDY -- N/C N/C N/C
A_INT1 -- N/C N/C N/C
G_INT -- N/C N/C N/C

(*1)You can change it to any pin using menuconfig.

Caribrate compass

git clone https://github.com/nopnop2002/esp-idf-gy85
cd esp-idf-gy85/calibrate
idf.py set-target {esp32/esp32s2/esp32s3/esp32c2/esp32c3/esp32c6}
idf.py menuconfig
idf.py flash

Configuration

To find the offset value, set the compass offset to 0.
config-top config-app

Execute calibration

ESP32 acts as a web server.
I used this component.
This component can communicate directly with the browser.
It's a great job.
Enter the following in the address bar of your web browser.

http:://{IP of ESP32}/
or
http://esp32.local/

As you rotate the IMU it plots the X, Y and Z values.
X, Y, Z offset are displayed.

gy85-calib-1

Execute calibration again

If you set the offset you got from the calibration and run it again, the circle position will change.

gy85-calib-2

Get Euler angles from IMU

git clone https://github.com/nopnop2002/esp-idf-gy85
cd esp-idf-gy85/euler
idf.py set-target {esp32/esp32s2/esp32s3/esp32c2/esp32c3}
idf.py menuconfig
idf.py flash

Configuration

Sets the compass offset obtained by calibration.

config-top config-app

View Euler angles with built-in web server

ESP32 acts as a web server.
I used this component.
This component can communicate directly with the browser.
It's a great job.
Enter the following in the address bar of your web browser.

http:://{IP of ESP32}/
or
http://esp32.local/

gy85-euler

WEB pages are stored in the html folder.
I used this for gauge display.
I used this for 3D display.
You can change it as you like.

View Euler angles using PyTeapot

You can view Euler angles using this tool.
It works as a UDP display server.
This is a great application.

+-------------+     +-------------+     +-------------+
|     IMU     | i2c |    ESP32    | UDP | pyteapot.py |
|             |---->|             |---->|             |
|             |     |             |     |             |
+-------------+     +-------------+     +-------------+
$ sudo apt install python3-pip python3-setuptools
$ python3 -m pip install -U pip
$ python3 -m pip install pygame
$ python3 -m pip install PyOpenGL PyOpenGL_accelerate
$ git clone https://github.com/thecountoftuscany/PyTeapot-Quaternion-Euler-cube-rotation
$ cd PyTeapot-Quaternion-Euler-cube-rotation
$ python3 pyteapot.py

The posture of your sensor is displayed.
gy-85_2023-04-20_11-17-50

esp-idf-gy85's People

Contributors

nopnop2002 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

esp-idf-gy85's Issues

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.