Account Navigation

Account Navigation

Currency - All prices are in AUD

Currency - All prices are in AUD
 Loading... Please wait...
CuteDigi

MAG3110 electronic compass module three axis magnetic sensor magnetometer

$6.50

MAG3110 electronic compass module three axis magnetic sensor magnetometer

$6.50
SKU:
SEN_MAG3110
Weight:
0.10 LBS
Shipping:
Calculated at checkout
Share

Product Description

MAGSensorA.png

MAGSensorB.png

MAG3110 is a small, low -power digital 3D magnetic sensor with wide dynamic range , capable of operating in a PCB with high external magnetic field. The sensor device can be used in combination with the sensor which has triaxial accelerometer to produce accurate way navigation information . It uses a standard IIC output interface and smart embedded features , capable of measuring up to 10 gauss local magnetic field , the output data rates up to 80Hz.

Feature

  • Voltage: 3.3-5V
  • Output data rates up to 80Hz
  • Standard IIC interface , Under fast mode ,rates up to 400Hz
  • Low power, single measurement mode

Application Ideas

  • Electronic compass
  • Location Information Service

Schematic

MAGSensor.png

Interface function

Interface pin description

MAGSensor1.jpg

Usage

Hardware:

1 x Arduino UNO

1 x Linker Base Shield

4 x Dupont line

1 x MAG3110

Wiring Diagram:

Arduino MAG3110

5V --> VCC

GND --> GND

SDA (A4) --> SDA

SCL (A5) --> SCL

MAGSensor2.png

Test Code:

#include <Wire.h>
#define MAG_ADDR  0x0E //7-bit address for the MAG3110, doesn't change
void setup()
{
 Wire.begin();        // join i2c bus (address optional for master)
 Serial.begin(9600);  // start serial for output
 config();            // turn the MAG3110 on
}
void loop()
{
 print_values();
 delay(5);
}
void config(void)
{
 Wire.beginTransmission(MAG_ADDR); // transmit to device 0x0E
 Wire.write(0x11);              // cntrl register2
 Wire.write(0x80);              // send 0x80, enable auto resets
 Wire.endTransmission();       // stop transmitting
 delay(15);
 Wire.beginTransmission(MAG_ADDR); // transmit to device 0x0E
 Wire.write(0x10);              // cntrl register1
 Wire.write(1);                 // send 0x01, active mode
 Wire.endTransmission();       // stop transmitting
}
void print_values(void)
{
 Serial.print("x=");
 Serial.print(readx()); 
 Serial.print(",");  
 Serial.print("y=");    
 Serial.print(ready());
 Serial.print(",");       
 Serial.print("z=");    
 Serial.println(readz());      
}
int readx(void)
{
 int xl, xh;  //define the MSB and LSB
 
 Wire.beginTransmission(MAG_ADDR); // transmit to device 0x0E
 Wire.write(0x01);              // x MSB reg
 Wire.endTransmission();       // stop transmitting
 delayMicroseconds(2); //needs at least 1.3us free time between start and stop
 Wire.requestFrom(MAG_ADDR, 1); // request 1 byte
 while(Wire.available())    // slave may send less than requested
 { 
   xh = Wire.read(); // receive the byte
 }
 delayMicroseconds(2); //needs at least 1.3us free time between start and stop
 Wire.beginTransmission(MAG_ADDR); // transmit to device 0x0E
 Wire.write(0x02);              // x LSB reg
 Wire.endTransmission();       // stop transmitting
 delayMicroseconds(2); //needs at least 1.3us free time between start and stop
 Wire.requestFrom(MAG_ADDR, 1); // request 1 byte
 while(Wire.available())    // slave may send less than requested
 { 
   xl = Wire.read(); // receive the byte
 }
 int xout = (xl|(xh << 8)); //concatenate the MSB and LSB
 return xout;
}
int ready(void)
{
 int yl, yh;  //define the MSB and LSB
 Wire.beginTransmission(MAG_ADDR); // transmit to device 0x0E
 Wire.write(0x03);              // y MSB reg
 Wire.endTransmission();       // stop transmitting
 delayMicroseconds(2); //needs at least 1.3us free time between start and stop
 Wire.requestFrom(MAG_ADDR, 1); // request 1 byte
 while(Wire.available())    // slave may send less than requested
 { 
   yh = Wire.read(); // receive the byte
 }
 delayMicroseconds(2); //needs at least 1.3us free time between start and stop
 Wire.beginTransmission(MAG_ADDR); // transmit to device 0x0E
 Wire.write(0x04);              // y LSB reg
 Wire.endTransmission();       // stop transmitting
 delayMicroseconds(2); //needs at least 1.3us free time between start and stop
 Wire.requestFrom(MAG_ADDR, 1); // request 1 byte
 while(Wire.available())    // slave may send less than requested
 { 
   yl = Wire.read(); // receive the byte
 }
 int yout = (yl|(yh << 8)); //concatenate the MSB and LSB
 return yout;
}
int readz(void)
{
 int zl, zh;  //define the MSB and LSB
 
 Wire.beginTransmission(MAG_ADDR); // transmit to device 0x0E
 Wire.write(0x05);              // z MSB reg
 Wire.endTransmission();       // stop transmitting

 delayMicroseconds(2); //needs at least 1.3us free time between start and stop
 
 Wire.requestFrom(MAG_ADDR, 1); // request 1 byte
 while(Wire.available())    // slave may send less than requested
 { 
   zh = Wire.read(); // receive the byte
 }
 
 delayMicroseconds(2); //needs at least 1.3us free time between start and stop
 
 Wire.beginTransmission(MAG_ADDR); // transmit to device 0x0E
 Wire.write(0x06);              // z LSB reg
 Wire.endTransmission();       // stop transmitting
 delayMicroseconds(2); //needs at least 1.3us free time between start and stop
 Wire.requestFrom(MAG_ADDR, 1); // request 1 byte
 while(Wire.available())    // slave may send less than requested
 { 
   zl = Wire.read(); // receive the byte
 }
 int zout = (zl|(zh << 8)); //concatenate the MSB and LSB
 return zout;
}

Test Runs: (1)Copy the code into the ArduinoIDE, and select the upper left corner of the compile button to compile, as shown below:

MAGSensor3.png

(2)Next, click “Tools->Board” to select the model of the development board and pair serial number, we select AVRISP mkll at here, found from the Device Manager for the serial port COM7. As shown below:

MAGSensor4.png

(3)After completing the above steps , upload code to the Arduino UNO , when the lower left corner of ArduinoIDE display “Done uploading”, open the serial monitor , set the baud rate ( 9600 ) , you can see the data return from MAG3110:

MAGSensor5.png

MAGSensor6.png

Documents

MAG3110 Datasheet.pdf

MAG3110 Schematic.pdf

Simplecode.rar

Product Reviews

Find Similar Products by Category