Compass Sensor - HMC5883L

TRIPLE-AXIS magnetometer (compass)

Calibration is important to get correct direction.

Datasheet

wired(obniz, { [gnd, sda, scl, i2c]});

Connect to an obniz Board.

obniz Board can't supply a power to this sensor directly.
Use external 3.3v or use linear regulator to drop 5v output of obniz Board to 3.3v.

// Javascript Example
var compass = obniz.wired("HMC5883L", {gnd:1 , sda:2 , scl:3 });
compass.init();
while(true) {
  var obj = await compass.get();
  console.log(obj.x, obj.y, obj.z);
}

init();

initialize the sensor.

// Javascript Example
var compass = obniz.wired("HMC5883L", {gnd:1 , sda:2 , scl:3 });
compass.init();

[await] get()

get x,y,z result object from a sensor.

// Javascript Example
var compass = obniz.wired("HMC5883L", {gnd:1 , sda:2 , scl:3 });
compass.init();
while(true) {
  var obj = await compass.get();
  console.log(obj.x, obj.y, obj.z);
}


Found at :



You will Get in Few Days

Circuit for Starter “obniz Board” is available on Amazon and other online stores.
You can get it at below

Our products and resellers

Forum

Visit our developer’s forum to discuss and discover technologies.

Forum

Contact

Feel free to contact out support and technical team.

Contact us