Home Espruino Espruino and HMC5983 magnetometer example

Espruino and HMC5983 magnetometer example

by iainhendry

The Honeywell HMC5983 is a temperature compensated three-axis integrated circuit magnetometer. This surface-mount, multi-chip module is designed for low-field magnetic sensing for applications such as automotive and personal navigation, vehicle detection, and pointing.

The HMC5983 includes our state-of-the-art, high-resolution HMC118X series magnetoresistive sensors plus an ASIC containing amplification, automatic degaussing strap drivers, offset cancellation, and a 12-bit ADC that enables 1° to 2° compass heading accuracy. The I²C or SPI serial bus allows for easy interface.

The HMC5983 utilizes Honeywell’s Anisotropic Magnetoresistive (AMR) technology that provides advantages over other magnetic sensor technologies. Honeywell’s anisotropic, directional sensors excel in linearity, low hysteresis, null output and scale factor stability over temperature, and with very low cross-axis sensitivity.

 

Schematic and Connection

espruino and HMC5983

espruino and HMC5983

 

 

Code

 

I2C1.setup( { scl: B6, sda: B7 } );
 var compass=require("HMC5883").connect(I2C1,C11,0);
 compass.setGain(1);
 compass.setup(0,0);
 compass.reads(function(a) {console.log(a);});

 

Output

 

{ “x”: 131.56000238656, “y”: -299.92000544071, “z”: -35.88000065088, “overflow”: false }
{ “x”: 202.40000367164, “y”: -42.32000076770, “z”: 89.24000161886, “overflow”: false }
{ “x”: 214.36000388860, “y”: -47.84000086784, “z”: 75.44000136852, “overflow”: false }

 

Links

GY-652 HMC5983 BMP180 MWC Electronic Compass Atmospheric Pressure Module Four-axis Flight Control Sensor

https://www.espruino.com/HMC5883

https://aerocontent.honeywell.com/aero/common/documents/myaerospacecatalog-documents/Defense_Brochures-documents/HMC5983_3_Axis_Compass_IC.pdf

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More