GithubHelp home page GithubHelp logo

nopnop2002 / esp-idf-hmc5883l Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 65 KB

Display the orientation of HMC5883L with ESP32

License: MIT License

CMake 1.25% HTML 4.75% CSS 0.31% JavaScript 5.13% Makefile 1.08% C++ 39.64% C 47.85%
compass esp-idf esp32 hmc5883l

esp-idf-hmc5883l's Introduction

esp-idf-hmc5883l

Display the orientation of HMC5883L with ESP32.
I used this I2Cdev library collection by Jeff Rowberg.

First, find the offset value for each axis.
As you can see, each axis is quite off-center.
hmc5883l-calib-1

And display the orientation.
hmc5883l-heading-1

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

HMC5883L 3-axis Electronic Compass

Note
HMC5883L and QMC5883L are completely incompatible chips.

Wireing

HMC5883L ESP32 ESP32-S2/S3 ESP32-C2/C3/C6
VCC -- 3.3V 3.3V 3.3V
GND -- GND GND GND
SCL -- GPIO22 GPIO12 GPIO5 (*1)
SDA -- GPIO21 GPIO11 GPIO4 (*1)
DRDY -- N/C N/C N/C

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

Caribration

git clone https://github.com/nopnop2002/esp-idf-hmc5883l
cd esp-idf-hmc5883l/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.
Enter the following in the address bar of your web browser.

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

As you move the compass it plots the X, Y and Z values.
X, Y, Z offset are displayed.

hmc5883l-calib-1

Execute calibration again

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

hmc5883l-calib-2

Display the orientation

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

Configuration

Sets the compass offset obtained by calibration.
config-top config-app

View orientation

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

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

Click the mouse to change the display.
hmc5883l-heading-1 hmc5883l-heading-2

WEB pages are stored in the html folder.
I used this for gauge display.
You can change the design and color according to your preference.

esp-idf-hmc5883l's People

Contributors

nopnop2002 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

sysmick

esp-idf-hmc5883l'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.