Tags:
create new tag
view all tags

Magnetometer and Compass

Introduction

Magnetometers measure magnetic field. The electronic devices available are very sensitive, and can measure fields down to the 100 u-Gauss level. Since the earth magnetic field is roughly 0.6 Gauss, we can measure the earth magnetic field with a resolution of 1 part in 6000. Therefore, magnetometers can be used as compasses.

Several magnetometers are on the market and we use

The chips, even though pin compatible and coming on the same PCB (GY-271), are very different. Both use I2C as communication interface, but the I2C address and the registers are different.
gy-271.png gy-271-back.png
On the photo of the GY-271 board, the HMC5883L is mounted. The QMC5883 is marked HA 5883.

The HMC5883L also comes on the GY-87 board, which combines the magnetometer with an accelerometer and a gyroscope on the MPU6050 and a BMP180 barometric pressure and temperature sensor. In this case, the HMC5883L is connected to the MPU6050 I2C bus and can be accessed either through the MPU6050 I2C master or directly through a bypass of the MPU6050 I2C master.

gy-87.png gy-87-back.png

Connections

Here are the connection tables for the two boards

GY-271 !WeMos Pin GPIO
Vcc 5V  
GND GND  
SCL D1 22
SDA D2 21
DRDY D3 27 on WROVER CPU T7 V1.5

GY-87 !WeMos Pin GPIO
Vcc_In 5V  
3.3V nc  
GND GND  
SCL D1 22
SDA D2 21
FSYNC nc  
INTA D0 16
DRDY D3 17 on the ESP32-WROOM
27 on the ESP32-WROVER-B T7 V1.5

The magnetometer driver class

The magnetometer driver class can be found at

-- Uli Raich - 2022-08-24

Comments

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng gy-271-back.png r1 manage 126.9 K 2022-08-24 - 10:14 UliRaich  
PNGpng gy-271.png r1 manage 158.9 K 2022-08-24 - 09:24 UliRaich  
PNGpng gy-87-back.png r1 manage 121.7 K 2022-08-24 - 10:08 UliRaich  
PNGpng gy-87.png r1 manage 109.5 K 2022-08-24 - 10:01 UliRaich  
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2022-08-25 - UliRaich
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback