hmc5883l tywu. gy-271 hmc5883l compass module pictures

Post on 19-Jan-2016

219 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

HMC5883L

TYWu

GY-271 HMC5883L Compass Module

• Pictures

Other Versions

• 3 Axis Magnetometer - HMC5883L Breakout Board R2

• Sparkfun Triple Axis Magnetometer Breakout - HMC5883L

HMC5883L

• Block Diagram

HMC5883L

• 3-Axis Digital Compass IC• Use Honeywell’s Anisotropic Magnetoresistive

(AMR) technology that provides advantages over other magnetic sensor technologies. These

• 12-Bit ADC Coupled with Low Noise AMR Sensors Achieves 5 milli-gauss Resolution in ±8 Gauss Fields

• Low Voltage Operations (2.16 to 3.6V) and Low Power Consumption (100 μA)

HMC5883L

• Specifications

HMC5883L

• Specifications

Arduino Resource

• Example in WWW– http://www.geek-workshop.com/thread-105-1-1.html– http://www.elechouse.com/elechouse/images/product/

3-axis%20Compass%20Module/HMC5883L.rar

Experiment

• Connection– VCC 3.3V– GND GND– SCL A5– SDA A4– DRDY Floating

Experiment

• Arduino Code (Simple Version)

#include <Wire.h> //I2C Arduino Library#define address 0x1E //0011110b, I2C 7bit address of HMC5883void setup(){ Serial.begin(9600); Wire.begin(); //Put the HMC5883 IC into the correct operating mode Wire.beginTransmission(address); //open communication with HMC5883 Wire.send(0x02); //select mode register Wire.send(0x00); //continuous measurement mode Wire.endTransmission();}

Experimentvoid loop(){ int x,y,z; //triple axis data //Tell the HMC5883 where to begin reading data Wire.beginTransmission(address); Wire.send(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.receive()<<8; //X msb x |= Wire.receive(); //X lsb z = Wire.receive()<<8; //Z msb z |= Wire.receive(); //Z lsb y = Wire.receive()<<8; //Y msb y |= Wire.receive(); //Y lsb }

Experiment

//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);}

Experiment

• Snapshot of

execution

top related