TRIPLE AXIS MAGNETOMETER

 TRIPLE AXIS MAGNETOMETER

                                         The triple axis magnetometer is used to measure the magnetic fields. It identifies where the strongest magnetic force is coming from, and generally used to detect magnetic north. This is the same magnetometer sensor that is inside the LSM303. We can interface triple axis magnetometer with Arduino to measure the presence of magnetic fields.
             

Application:

  • Used to Measure earth’s Magnetic Fields.
  • To determine direction for sailors and pilots.

Sample Project With Arduino:

                                In this we going to know the presence of magnetic field which is detected by the magnetometer sensor.

Materials requireed:

  • Triple Axis Magnatometer
  • Arduino UNO 
  • Jumper Wires

Circuit:




Code:

#include<Wire.h>   //I2C arduino library

#define addr 0x1E   //I2C address for HMC5883

Void setup()

{

Serial.begin(9600);

Wire.begin();

Wire.BeginTransmission(addr);    // start talking

Wire.write(0x02);     //Set the register

Wire.write(0x00);     //Tell the HMC5883 to continuously measure

Wire.endTransmission();

}

void loop()

{

int x,y,z;    //triple axis data

Wire.beginTransmission(addr);

Wire.write(0x03);    //Start with register 3

Wire.endTransmission();

Wire.requestFrom(addr,6);

if(6<=Wire.available)()

{

X=Wire.read()<<8;     //MSB x

X|=Wire.read();                       //LSB x

z=Wire.read()<<8;      //MSB z

z|=Wire.read();                        // LSB z

y=Wire.read()<<8;      //MSB y

y|=Wire.read();                        // LSB y

}

Serial.print(“X value);

Serial.println(x);

Serial.print(“y value);

Serial.println(y);

Serial.print(“z value);

Serial.println(z);

delay(500);}


Serial Monitor Output:




Comments

Popular posts from this blog

Voice Record & Playback Module

GSM Sim800L

GPS