Vários Sensores

Promoções

Produtos visualizados

Hmc5883l Magnetometer Ver maior

Hmc5883l Magnetometer

BE15000274

Novo produto

This is a breakout board for Honeywell's HMC5883L, a 3-axis digital compass.

Mais detalhes

12,30 € com IVA

Adicionar à Lista de desejos

Mais informação

Communication with the HMC5883L is simple and all done through an I2C interface. There is no on-board regulator, so a regulated voltage of 2.16-3.6VDC should be supplied.

The breakout board includes the HMC5883L sensor and all filtering capacitors as shown. The power and 2-wire interface pins are all broken out to a 0.1" pitch header.

 

Features:

  • Simple I2C interface
  • 2.16-3.6VDC supply range
  • Low current draw
  • 5 milli-gauss resolution

 

Dimensions: 0.7x0.7" (17.78x17.78mm)

Code:

#include <Wire.h>

#define address 0x1E //I2C 7bit address of HMC5883

//Analog input 4 I2C SDA
//Analog input 5 I2C SCL

void setup(){

Serial.begin(9600);
Wire.begin();

//Put the HMC5883 IC into the correct operating mode
Wire.beginTransmission(address);
Wire.write(0x02);
Wire.write(0x00);
Wire.endTransmission();
}

void loop(){

int x,y,z

//begin reading data
Wire.beginTransmission(address);
Wire.write(0x03); //select register 3, X MSB register
Wire.endTransmission();

//Read data from each axis, 2 registers per axis
Wire.requestFrom(address, 6);
if(6<=Wire.available()){
x = Wire.read()<<8; //X msb
x |= Wire.read(); //X lsb
z = Wire.read()<<8; //Z msb
z |= Wire.read(); //Z lsb
y = Wire.read()<<8; //Y msb
y |= Wire.read(); //Y lsb
}

//Print out values of each axis
Serial.print(“x: “);
Serial.print(x);
Serial.print(” y: “);
Serial.print(y);
Serial.print(” z: “);
Serial.println(z);

delay(250);
}

Acessórios

Clientes que compraram este produto também compraram: