MEMSIC MMC5983MA 3 Axis Digital Compass & Arduino MCU – The Basics
Summary
TLDRIn this video, the presenter reviews the MEMSIC MMC5983MA 3-axis magnetic sensor, a high-precision digital compass chip. They compare it with the QST QMC5883L, noting the MMC5983MA's superior accuracy of ±0.5 degrees and lower noise levels. The sensor is more expensive but offers impressive performance right out of the box. The presenter explores the sensor's documentation, evaluates its features, and demonstrates how to interface it with an Arduino using the SparkFun library. They also discuss the need for calibration to achieve accurate compass readings.
Takeaways
- 😀 The presenter discussed a 3-axis magnetic sensor, the QST QMC5883L, which is a digital compass chip costing only five dollars.
- 🔍 The QMC5883L promised 1-2 degree compass heading accuracy, but with a significant reaction time of over 12 seconds.
- 🆕 The presenter introduced a new sensor, the MEMSIC MMC5983MA, which is more expensive but offers higher accuracy of ±0.5 degrees.
- 📈 The MMC5983MA has very low noise levels and is specified in the data sheet, making it superior to the QMC5883L in terms of precision.
- 🔌 The evaluation board for the MMC5983MA has eight pins, including an interrupt out, I2C interface pins (SCL and SDA), and multi-purpose pins for SPI operation.
- 📚 The data sheet for the MMC5983MA highlights an 8G full scale range, 18-bit operation, and 0.4 milligaus total RMS noise.
- 💾 The sensor can operate with an output data rate up to 1000 Hz and has a built-in degaussing function to eliminate residual magnetic fields.
- 🛠️ The sensor is compatible with 3.3 volts, which is suitable for use with an Arduino, and has low power consumption.
- 📱 An Arduino library is available for the MMC5983MA, including examples for basic measurements and continuous measurements.
- 🔧 The presenter plans to create their own library for the sensor to include important functions like calibration, as the sensor requires calibration for accurate compass readings.
Q & A
What is the QST QMC5883L?
-The QST QMC5883L is a three-axis magnetic sensor, essentially a digital compass chip, which is known for its affordability and the promise of one to two-degree compass heading accuracy.
What was the issue with the QST QMC5883L in the fifth detail video?
-In the fifth detail video, the QST QMC5883L was found to have a reaction time of over 12 seconds with a 250 sample median filter, making it unusable as a real digital compass due to its slow response time.
What is the Memsic MMC5983MA and how does it compare to the QMC5883L?
-The Memsic MMC5983MA is a 3-axis magnetic sensor that is more expensive than the QMC5883L but promises a higher heading accuracy of plus or minus 0.5 degrees. It also has very low noise levels as specified in its data sheet.
What are the key features of the Memsic MMC5983MA according to its data sheet?
-Key features of the Memsic MMC5983MA include a full-scale range of plus minus 8G, 18 bits of operation, 0.4 milligaus total RMS noise, an output data rate up to 1000 Hertz, and a built-in degaussing function.
How is the Memsic MMC5983MA connected to an Arduino?
-The Memsic MMC5983MA can be connected to an Arduino using either an I2C or SPI interface. For I2C, the SDA and SCL lines are used along with a ground and power supply. For SPI, the slave data out, slave data in, slave clock, and chip select pins are used.
What is the maximum supply voltage for the Memsic MMC5983MA?
-The maximum supply voltage for the Memsic MMC5983MA is 3.6 volts, but it can operate at 3.3 volts, which is compatible with an Arduino.
Is there an Arduino library available for the Memsic MMC5983MA?
-Yes, there is an Arduino library available for the Memsic MMC5983MA, specifically the SparkFun MMC5983MA magnetometer Arduino Library.
What are the different operation modes supported by the Memsic MMC5983MA?
-The Memsic MMC5983MA supports I2C single supply operation and SPI single supply operation. It does not support I2C or SPI dual supply operation.
What is the significance of the 0.4 milligaus RMS noise in the Memsic MMC5983MA?
-The 0.4 milligaus RMS noise is the best value found in data sheets for Hall element-based magnetic compasses. It indicates a very low level of noise in the sensor's measurements, which is crucial for accurate compass readings.
What is the purpose of the degaussing function in the Memsic MMC5983MA?
-The degaussing function in the Memsic MMC5983MA is used to eliminate any residual magnetic fields that might have built up when the device is powered on, ensuring accurate compass readings.
Outlines
🧭 Introduction to the MEMSIC MMC5983MA 3-Axis Magnetic Sensor
The script starts with the host welcoming viewers back and mentioning a previous series of videos about the QST QMC5883L magnetic sensor. They compare the older, cheaper sensor to the new MEMSIC MMC5983MA, which is more expensive but promises higher accuracy of ±0.5 degrees. The host unboxes the evaluation kit for the MMC5983MA and describes the board's pins, including I2C and SPI interfaces, and power supply connections. They also note the absence of a connection for VDDIO and the presence of capacitors and resistors on the board.
📄 Exploring the Datasheet and Breakout Board
The host delves into the datasheet for the MMC5983MA, highlighting its features such as an 8G full-scale range, 18-bit operation, low noise levels, and the ability to set heading accuracy to ±0.5 degrees. They discuss the output data rate, degaussing capabilities, and the I2C interface's fast mode. The script mentions the block diagram, showing the sensor's components and how data is stored in registers. The host also covers the supply voltage, current, and temperature ranges, as well as the noise levels achievable with maximum filtering.
🔌 Wiring and Testing the Sensor with Arduino
The script describes how to wire the MMC5983MA to an Arduino, covering the power connections, I2C pull-up resistors, and SPI configuration. The host confirms that the sensor operates at 3.3 volts and is compatible with Arduino. They mention finding an Arduino library for the sensor and briefly review its features, including error handling and support for both I2C and SPI interfaces. The script ends with the host sharing their initial positive experience with the sensor's performance and accuracy right out of the box.
💻 Reviewing the SparkFun Library and Testing Examples
The host reviews the SparkFun MMC5983MA magnetometer Arduino Library, discussing its features and functions. They mention the library's support for I2C and SPI, and note some private functions and the ability to set an error callback. The script describes the process of using the library with Arduino, including initialization, checking for connection, performing a soft reset, and obtaining sensor measurements. The host demonstrates the library's functionality by running an example that outputs compass headings with minimal noise and high accuracy.
🔍 Analyzing Raw Data and Considering Calibration
The script continues with the host analyzing raw sensor data and normalized values, noting the low levels of noise in the measurements. They compare the sensor's output to a physical compass to demonstrate its accuracy. The host reviews another example from the library that outputs raw values and magnetic field measurements in Gauss. They express their intention to write their own library for the sensor, focusing on I2C and adding calibration functions for improved accuracy.
🔚 Conclusion and Future Plans
In the final paragraph, the host summarizes the video's content, which includes an overview of the datasheet, wiring instructions for the Arduino, and a review of the SparkFun library. They express satisfaction with the sensor's performance and outline plans for future videos, which will involve writing a custom library and implementing calibration to improve the sensor's accuracy.
Mindmap
Keywords
💡QST QMC5883L
💡MEMSIC MMC5983MA
💡Magnetic Sensor
💡Heading Accuracy
💡I2C Interface
💡SPI Interface
💡Arduino
💡Data Sheet
💡Calibration
💡Noise Levels
💡Library
Highlights
Introduction of the QST QMC5883L three-axis magnetic sensor as a digital compass chip.
The QST QMC5883L's affordability at five dollars for the whole breakout board.
Claimed one to two-degree compass heading accuracy for the QST QMC5883L.
Achieving one degree to one and a half degree accuracy with a 250 sample median filter on the QST QMC5883L.
Introduction of the MEMSIC MMC5983MA 3-axis magnetic sensor as a more advanced alternative.
Higher cost of the MEMSIC MMC5983MA chip and evaluation kit.
Promised heading accuracy of plus minus 0.5 degrees by the MEMSIC MMC5983MA.
Very low noise levels specified in the MEMSIC MMC5983MA data sheet.
Overview of the MEMSIC MMC5983MA evaluation board and its pins.
Documentation indicating that the breakout board pins should refer to the actual data sheet for more information.
Description of the multi-purpose pins on the breakout board for SPI and I2C interfaces.
Mention of unpopulated positions for resistors and capacitors on the breakout board.
Data sheet highlights including plus minus 8G full scale range and 18 bits operation.
Low noise levels of 0.4 milligaus total RMS noise as per the data sheet.
Output data rate up to 1000 Hertz for the MEMSIC MMC5983MA.
Built-in degaussing function to eliminate residual magnetic fields.
Block diagram explanation showing the three Hall elements for X, Y, and Z-axis.
Information on how to wire the MEMSIC MMC5983MA to an Arduino using 3.3 volts.
Availability of an Arduino Library for the MEMSIC MMC5983MA.
Review of the SparkFun MMC5983MA magnetometer Arduino Library.
Demonstration of the library's functionality with an Arduino and immediate accuracy results.
Comparison of the noise levels between the QST QMC5883L and the MEMSIC MMC5983MA.
Intention to create a custom library for the MEMSIC MMC5983MA focusing on I2C and adding calibration functions.
Transcripts
welcome back about one year ago I made a
total of six videos uh one basic and
five detailed videos about this qst qmc
5883l three axis magnetic sensor
basically a digital compass chip and
that thing was dirt cheap I spent five
bucks for it for the whole breakout bot
that is and it promised to enable you to
have one to two degree Compass heading
accuracy and at the very end in the
fifth detail video I was able to reach a
one degree to one and a half degree
accuracy
with a 250 sample medium filter
which had a reaction time of over 12
seconds so basically as a real digital
compass that thing was completely
unusable
uh car to the last video here and Link
in the description in the description
for the last video you find links to all
the videos about that thing
enter the stage of the memsic MMC
5983 m a 3-axis magnetic sensor that's
another Beast first of all it's more
expensive the chip alone will set you
back a little less than five bucks and
this evaluation kit I have here costs uh
almost 24 Euros however it promises you
a heading accuracy of plus minus 0.5
degrees and it comes actually with a
specified noise levels very low noise
levels in the data sheet
in this video we will have a look at
that set data sheet at the evaluation
board that should be in here and we will
try to get the whole thing up and
running with an Arduino
enjoy
I really should have made a unboxing
video for that thing so let's open the
box and oh
that looks very nice and
there's the board and it comes in
of course a little ESD bag which is open
which is open uh don't stop the video
right now
and there we have
the evaluation board
we have eight pins in total on this side
we have an uh interrupt out I assume pin
scl and SDA that's your uh I squared C
interface and then we have an sdo uh
these pins are probably multi-purpose
either as the ascl for i squared C or a
slave data out slave data in enslave
clock for SPI operation and then we have
the chip select pin also for SPI
operation and then we have an vddio so I
O Supply voltage and vdd General Supply
voltage and ground pin but let's have a
look on the documentation for that thing
here's the documentation for the
breakout board they tell us right away
that we should refer to the actual data
sheet for more information
and they give us a table with the pins
we already talked about that there are
these two multi-purpose pins so I have a
green for SPI that would be a SPI slave
clock and slave data in or in blue I
squared C slave data and slave clock and
then we have two more SPI pins for slave
data out and the chip select and we have
an input output interrupt output and we
have the two power supply pins vdd on
ground what's marked on the little
breakout bot here as vdd I O is not
connected and I just verified that
visually there's really no Trace going
off from that vdd I O pin
there's even a little schematic of that
breakout board here and we see here that
pin 2 which is marked vddio not being
connected but instead the vdd io and the
vdd pin of the chip being connected to
the same output pin here at the board we
also saw that these two C1 and C2
capacitors are populated at that board
and their wall there were unpopulated
positions for that are one and R2
resistor here which are obviously the I
squared C pull ups for the SDA and scl
line
however there was a populated Arrow 3 on
there with the value 0 1 0 and an
unpopulated of four and R5 position two
so uh I guess that 010 is just a bridge
and uh yeah they're using that breakout
board for different chips
again on the board there's the
population C1 and C2 capacitor there's
that uh
010r3 resistor the unpopulated ll4 and
R5 which are not even mentioned in the
circuit diagram and the unpopulated
positions for an R1 and R2 2.7 K pull up
resistors for the I squared C lines
let's have a look into the data sheet
then
the highlights plus minus 8G full scale
range that's the usual for a compass
chip 18 bits operation not only 16 but
18 bits 0.4 milligaus total RMS noise
and that's the best value in a data
sheet I found for these Hall element
based magnetic compasses you can get
ships that are better but these are no
longer based on Hull elements but they
are really using three different coils
to measure the magnetic field of the
earth and they also in another price
range
enable setting accuracy of plus minus
0.5 degrees we talked up already about
that uh output data rate up to 1000
Hertz now I don't need that but that's a
lot and degaussing with built-in set
reset function so that thing can
eliminate when you boot it up any
residual magnetic fields that might have
built up a lot of blah blah blah yeah
output data ready interrupt output of
course uh then the I squared C interface
is fast mode 400 kilohertz that's good
3.0 volt single low power supply ER I
hope it will run with 3.3 volts too we
will see that in the details and of
course it has an alternative SPI
interface available
here's the block diagram very tiny so
you have here your three Hull elements
for the X Y and z-axis and then you have
some signal processing and then the
results are stored in three registers X
Y and Z which you can read while I
squared C and SPI I'm sure there are
also some registers that you can write
to set different options uh clock
generator blah blah blah set reset
control that was that degaussing staff
voltage reference test and buffer
switches temperature sensor I think I
skipped that it has a built-in
temperature sensor for temperature
compensation too
maximum Supply voltage is 3.6 volts so I
want to run that thing on 3.3 volts on
an Arduino so that's fine uh
Supply current okay uh yeah not even
half a milliamp and yeah the uh there
are these BW zero zero two one one these
are bits in some of the control
registers and they control how long a
measurement can take or will take
meaning how much filtering the chip does
internally that's important that ranges
from eight milliseconds to 0.5
milliseconds that's important because if
we go further down here our operating
temperature range minus 40 to 105
degrees with golden there linearity
Arrow 0.1 percent of full scale that's
all very very nice repeatability error
0.1 of false scale alignment error and
so on and so on until we come here to
the RMS noise
and
the promised
0.4 milligaus RMS noise you only get if
you take the filtering to the Max and
then each measurement takes eight
milliseconds and uh yeah you don't get a
1000 measurements per second out of that
thing but that's okay for my application
uh new value every eight milliseconds is
more than I need
there's a whole lot more information
here in the data sheet but uh yeah we
will come back to that when we actually
need it
absolute maximum ratings so Supply
voltage from minus 0.42 plus 3.6 volts
again we're golden here with 3.3 volts
from our Arduino
on page 10 respectively 11 of the data
sheet we find for typical application
circuits for or four different modes
operation modes I squared C dual Supply
operation we can forget about that
that's not supported by our little
breakout board SPI dual Supply operation
is also not supported so we can
concentrate on I squat C single Supply
connection and SPI single Supply
connection
I squat C single Supply connection no
surprises here but we have to bind the
SPI chip select pin to vdd to indicate
that we are actually want to use I
squared C and the SPI slave data out
chip is just left dangling here
please note that the pull up resistors
here for our I squared csdi and as clock
lines are not on the breakout board at
least they are not populated for SPI
single Supply operation you just feed
your SPI signals in the four pins that
are for SPI so slave data out slave data
in slave clock and Chip select
now that we know that the thing will run
with 3.3 volts and we have an idea how
to connect it to our Arduino the
question is is there an Arduino Library
available and yes there is but only one
at least I only found one library and
that's the spark fund SparkFun MMC
5983ma magnetometer Arduino Library
what else
um
we will probably go into the details a
little bit but I want to point out here
this little remark added last year added
SPI support Dash partial okay not that
this matters to us because I want to use
I squared C but this Library does
somehow also support SPI but maybe not
completely anyway let's have a look at
the header file if we like that Library
sometimes uh you don't like it or
you know me so yeah here
all the includes and we need the
SparkFun IO library on Arduino Library
constants and different files yeah or
yeah I can live with that lots of
private functions here nothing too bad
than a default Constructor and the
default Destructor okay or you can set
an error callback function that's not
too bad I like that uh error code string
also not too bad uh begin that is there
are two different begins here one
obviously for I squared C with a two
wire object
and then here one with uh for SPI
and then you get the usual is connected
get temperature yeah we know this thing
has a temperature sensor software Ascent
enable interrupt disable and drop that
obviously for the intro pin is interrupt
enable yeah query
uh what else we have here our enable
three wire SPI and disable free via SPI
we don't care about that is three wires
yeah no SPI uh perform set operation
perform reset operation okay enable
automatic set reset okay whatever that
is we will dive into those details in
the first the details video I guess
is automatic said okay enable X Channel
disable
okay Channel disable
enable for X Y set set build a filter
bandwidth we talked about that okay
anyway uh
yeah uh complete Library
using I don't know if it's really using
all of the functions but uh
it doesn't look that bad so let's use it
the library is available within the
Arduino Library manager in the version
one one one that was also the one we
just saw on GitHub great
and that Library comes with a bunch of
examples seven to be exact starting from
a simple measurement digital compass or
we will try that a continuous
measurement simple measurement digital
compass two
fast continuous measurement and sensor
offset
let's start with a digital compass and
um
yeah
load that to our Arduino and connect
everything up
everything is wired up now nicely so we
have our ground connection to ground and
we have a 3.3 volt going to our vdd VD
Dio has no connection we already talked
about that and the SPI chip select is
bridged to our vdd so that should put
the whole thing into isolate C mode
we have a two 2.7 K as was mentioned in
the datasheet pull up resistors here on
our chip clock uh slave clock and slave
data lines and the slave data line is
going over here to the slave data pin
and the slave clock line is going over
to the slave clock pin let's fire that
thing up
and right out of the bed it's working
and I want you to note how little noise
there is on the signal here so yeah uh
uh it's fluctuating between five
three
I see a six in between can I get a six
nah not really so uh it's fluctuating
about two tenths of a degree
right off the Box no additional
filtering just with that
SparkFun Library no calibration at all
and that's the next big surprise uh I
have placed here a little Compass so you
can see
where North is
and
yeah okay we're 10 degrees off but
without calibration that's absolutely
okay
and if we go to 90 degrees approximately
yeah
seven eight degrees of
270 degrees I mean we will make a
Precision measurements in the details
videos of course yeah four degrees off
and
if we go to 180 degrees approximately
yeah we are at 180 degrees without
without again if you followed the series
about the qmc chip
without any calibration
that's a really really impressive uh
right out of the gate
I like it
let's go over that spark fun example
real quick so we include here wire and
the SparkFun library then we instantiate
that's the class name okay uh our chip
the object for our chip we make a Serial
begin and we make a little serial print
that was already scrolled out of the
screen and if Mac begin is false there's
something wrong then you get a error
message and it goes into an endless loop
here
and then we do a soft reset whatever
that does we will see in the details
videos there will be several of them and
then we say we are connected and then we
have here somehow 32-bit unsigned
integers for the raw values of the X Y
and set sensor then we have doubles for
the normalized values uh please note a
double is only a float in the Arduino
environment so it doesn't really matter
it's only 32-bit whatever you want to do
and then we do I mean that
self-explanatory uh get measurement X Y
set into the raw values and then we
normalize these values into a range
between plus minus
1.0
and we do that for all three values for
x y and set and then we calculate the
heading using the archus tankans two
function and this doesn't deliver uh
yeah a result in degree plus but uh
something between plus pi to minus pi
and we convert that in degrees and then
this is printed out so really straight
forward uh by the way the whole Arcus
tungans two thing to actually calculate
a compass heading from two sensors is
explained in the room in the third
details video about the qmc chip card
here Link in the description let's try
another example then shall we
so the examples are not that interesting
uh this basically gives us the raw
values and the values in Gauss on the
serial military uh let me stop the auto
scroll so the flickering goes back uh
but again I want you to note how little
how little the raw values fluctuate
really this is a a few least significant
bits noise we have on here so that's
really nice and then we have our Gauss
values and I activate the auto scroll
again and of course if we move our
Compass I'm doing that off screen here
uh
forgot to switch on the other camera
then things are changing so yeah really
nice
and the code for that example is also
very trivial uh yeah it starts exactly
the same yeah initialize your serial
interface check if the chip is there
and uh yeah we already scrolled over
that uh get the temperature and
Fahrenheit or Celsius uh then we go into
a loop we have again our six values here
for x y and set count value that is an
unsigned integral 32 and normalized we
get our measurements this time with
three methods each measurement for its
own and then you saw that it's printed
out the intellectual value
and then we convert these 18-bit
unsigned intentional values into
a double which should be
after it's multiplied by eight You
Remember full scale is eight cows for
that chip gives us the field value the
magnetic field value or at least the
component in X Y and Z Direction
in cows
that's it that's it yeah the examples
are not very
extensive uh there's also nothing
absolutely nothing uh with calibration
and stuff so we will have to do all that
by ourselves
that's it for today we had a little
squeeze on the data sheet of that thing
and it's uh about at least according to
the data sheet impressive performance uh
we learned how to wire that thing up to
an Arduino the different modes it can it
supports us with c and SPI and we found
a readily available Library the examples
are a little bit mood but yeah it's
working
very well
next time
the details one uh we will start writing
our own library for that thing because
never trust a library uh from the
internet about we could look into the
code how the library is implemented but
anyway uh I think it's a little bit
heavy with that uh SPI and I squared C
support and then including some uh i o
library from SparkFun I don't like that
we will write our own Library just
purely for I spread C
and then we will add some important
functions over the different details
videos like for example calibration
because while that thing is basically
compared to the qmc
chip uh noiseless
it does need calibration okay otherwise
you won't get a very good values a very
good Compass readings out of that
till then bye
bye
Browse More Related Video
How to Use a TCS3200 Color Sensor with Arduino (Lesson #38)
pH meter Arduino, pH Meter Calibration, DIYMORE pH Sensor, pH Sensor Arduino Code, pH of liquids
VERY EASY Arduino IR Sensor Tutorial for Beginners | IR Sensor Arduino Tutorial | Infrared Sensor
ATPL General Navigation - Class 5: Direction.
Watch How Capacitors Placement Makes a Big Difference #HighlightsRF
Accuracy and Precision
5.0 / 5 (0 votes)