The Adafruit MLX90395 is a sophisticated magnetometer module capable of measuring magnetic fields in three dimensions. Utilizing the Melexis MLX90395 magnetic field sensor, this module offers precise and reliable readings, making it an ideal choice for a wide range of applications including compass navigation, position sensing, and motion detection.
The Adafruit MLX90395 magnetometer module is characterized by the following technical specifications:
Specification | Value/Description |
---|---|
Operating Voltage | 2.2V to 3.6V |
Current Consumption | 100 μA (typical) |
Measurement Range | ±5 mT per axis |
Resolution | 0.161 μT |
Communication | I2C (up to 1 MHz), SPI (up to 10 MHz) |
Operating Temperature | -40°C to 85°C |
Dimensions | 17.8mm x 15.3mm x 2.6mm (LxWxH) |
Pin Number | Name | Description |
---|---|---|
1 | VIN | Supply voltage (2.2V to 3.6V) |
2 | GND | Ground |
3 | SCL | I2C clock (also acts as SPI clock) |
4 | SDA | I2C data (also acts as SPI MOSI) |
5 | SDO | SPI data output (also acts as SPI MISO) |
6 | CS | SPI chip select (active low) |
7 | INT | Interrupt pin (active low) |
To use the Adafruit MLX90395 magnetometer module in a circuit:
Below is an example code snippet for interfacing the Adafruit MLX90395 with an Arduino UNO using the I2C protocol. Ensure you have installed the appropriate Adafruit MLX90395 library before uploading the code to the Arduino.
#include <Wire.h>
#include <Adafruit_MLX90395.h>
Adafruit_MLX90395 mlx;
void setup() {
Serial.begin(9600);
// Initialize the MLX90395
if (!mlx.begin_I2C()) {
Serial.println("Failed to find MLX90395 chip");
while (1) { delay(10); }
}
Serial.println("MLX90395 Found!");
}
void loop() {
mlx.readData();
// Print out the X, Y, Z values
Serial.print("X: "); Serial.print(mlx.x, 4); Serial.print(" uT, ");
Serial.print("Y: "); Serial.print(mlx.y, 4); Serial.print(" uT, ");
Serial.print("Z: "); Serial.print(mlx.z, 4); Serial.println(" uT");
// Delay between readings
delay(500);
}
Q: Can the MLX90395 be used with a 5V microcontroller? A: Yes, but ensure that the VIN pin is connected to a voltage within the 2.2V to 3.6V range. Use level shifters for I2C or SPI lines if necessary.
Q: How can I calibrate the magnetometer? A: Calibration typically involves rotating the sensor in all three axes and using software to map the raw readings to a calibrated scale.
Q: What is the maximum sampling rate of the MLX90395? A: The maximum sampling rate depends on the communication protocol used (I2C or SPI) and the specific settings of the sensor. Refer to the datasheet for detailed timing information.
This documentation provides a comprehensive guide to using the Adafruit MLX90395 magnetometer module. For further details and advanced usage, consult the datasheet and additional resources provided by Adafruit.