MEMSIC MMC5983MA 3 Axis Digital Compass & Arduino MCU – The Basics

Robert's Smorgasbord
16 Apr 202325:53

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

00:00

🧭 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.

05:02

📄 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.

10:02

🔌 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.

15:05

💻 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.

20:07

🔍 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.

25:10

🔚 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

The QST QMC5883L is a three-axis magnetic sensor, essentially functioning as a digital compass chip. It is highlighted in the video for its affordability and capability to provide compass heading accuracy within one to two degrees. The video creator previously made a series of videos discussing this sensor, indicating its importance to the discussion.

💡MEMSIC MMC5983MA

The MEMSIC MMC5983MA is another 3-axis magnetic sensor introduced in the video as a more advanced and expensive alternative to the QST QMC5883L. It promises higher heading accuracy of plus or minus 0.5 degrees. The video focuses on this sensor's superior specifications and its potential applications.

💡Magnetic Sensor

A magnetic sensor is a device that detects and measures magnetic fields. In the video, the discussion revolves around two types of magnetic sensors, the QST QMC5883L and the MEMSIC MMC5983MA, which are used for compass applications. Their accuracy and performance are central to the video's theme.

💡Heading Accuracy

Heading accuracy refers to how precisely a compass device can determine the direction it is pointing. The video compares the heading accuracy of two magnetic sensors, with the MMC5983MA promising superior accuracy of plus or minus 0.5 degrees compared to the QMC5883L.

💡I2C Interface

The I2C (Inter-Integrated Circuit) interface is a multi-master, serial computer bus that the video mentions as the communication protocol used by the MMC5983MA sensor. The video explains how to wire this interface to an Arduino, emphasizing its importance for sensor operation.

💡SPI Interface

SPI (Serial Peripheral Interface) is another communication protocol mentioned in the video. Although the focus is on the I2C interface, the video also discusses the SPI as an alternative method for interfacing the sensor with a microcontroller.

💡Arduino

Arduino is an open-source electronics platform used for building digital devices. The video describes how to interface the MMC5983MA sensor with an Arduino, demonstrating the practical application of the sensor in a real-world project.

💡Data Sheet

A data sheet is a document provided by the manufacturer that details the specifications and capabilities of a component. The video refers to the data sheet of the MMC5983MA, discussing its specifications like noise levels, supply voltage, and output data rate.

💡Calibration

Calibration in the context of the video refers to the process of adjusting the sensor to ensure accurate readings. The video mentions that despite the MMC5983MA's low noise, it still requires calibration to obtain precise compass readings.

💡Noise Levels

Noise levels in sensors refer to the random variations or inaccuracies in the sensor's output. The video emphasizes the low noise levels of the MMC5983MA, which is a key feature for achieving high accuracy in compass heading measurements.

💡Library

In the context of the video, a library refers to a collection of code that facilitates the use of a sensor with a microcontroller like Arduino. The video discusses a specific library for the MMC5983MA and the process of using it to interface with the sensor.

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

play00:00

welcome back about one year ago I made a

play00:05

total of six videos uh one basic and

play00:09

five detailed videos about this qst qmc

play00:14

5883l three axis magnetic sensor

play00:18

basically a digital compass chip and

play00:21

that thing was dirt cheap I spent five

play00:25

bucks for it for the whole breakout bot

play00:28

that is and it promised to enable you to

play00:32

have one to two degree Compass heading

play00:35

accuracy and at the very end in the

play00:39

fifth detail video I was able to reach a

play00:42

one degree to one and a half degree

play00:44

accuracy

play00:46

with a 250 sample medium filter

play00:50

which had a reaction time of over 12

play00:55

seconds so basically as a real digital

play00:58

compass that thing was completely

play01:01

unusable

play01:03

uh car to the last video here and Link

play01:06

in the description in the description

play01:09

for the last video you find links to all

play01:12

the videos about that thing

play01:15

enter the stage of the memsic MMC

play01:20

5983 m a 3-axis magnetic sensor that's

play01:26

another Beast first of all it's more

play01:28

expensive the chip alone will set you

play01:30

back a little less than five bucks and

play01:33

this evaluation kit I have here costs uh

play01:37

almost 24 Euros however it promises you

play01:42

a heading accuracy of plus minus 0.5

play01:45

degrees and it comes actually with a

play01:50

specified noise levels very low noise

play01:53

levels in the data sheet

play01:57

in this video we will have a look at

play02:00

that set data sheet at the evaluation

play02:04

board that should be in here and we will

play02:07

try to get the whole thing up and

play02:09

running with an Arduino

play02:12

enjoy

play02:14

I really should have made a unboxing

play02:16

video for that thing so let's open the

play02:20

box and oh

play02:22

that looks very nice and

play02:27

there's the board and it comes in

play02:32

of course a little ESD bag which is open

play02:36

which is open uh don't stop the video

play02:39

right now

play02:41

and there we have

play02:45

the evaluation board

play02:48

we have eight pins in total on this side

play02:51

we have an uh interrupt out I assume pin

play02:54

scl and SDA that's your uh I squared C

play02:59

interface and then we have an sdo uh

play03:04

these pins are probably multi-purpose

play03:06

either as the ascl for i squared C or a

play03:11

slave data out slave data in enslave

play03:14

clock for SPI operation and then we have

play03:17

the chip select pin also for SPI

play03:20

operation and then we have an vddio so I

play03:25

O Supply voltage and vdd General Supply

play03:29

voltage and ground pin but let's have a

play03:33

look on the documentation for that thing

play03:36

here's the documentation for the

play03:38

breakout board they tell us right away

play03:41

that we should refer to the actual data

play03:44

sheet for more information

play03:46

and they give us a table with the pins

play03:49

we already talked about that there are

play03:51

these two multi-purpose pins so I have a

play03:55

green for SPI that would be a SPI slave

play04:00

clock and slave data in or in blue I

play04:04

squared C slave data and slave clock and

play04:07

then we have two more SPI pins for slave

play04:10

data out and the chip select and we have

play04:13

an input output interrupt output and we

play04:18

have the two power supply pins vdd on

play04:21

ground what's marked on the little

play04:25

breakout bot here as vdd I O is not

play04:29

connected and I just verified that

play04:31

visually there's really no Trace going

play04:34

off from that vdd I O pin

play04:38

there's even a little schematic of that

play04:42

breakout board here and we see here that

play04:45

pin 2 which is marked vddio not being

play04:48

connected but instead the vdd io and the

play04:53

vdd pin of the chip being connected to

play04:58

the same output pin here at the board we

play05:01

also saw that these two C1 and C2

play05:05

capacitors are populated at that board

play05:08

and their wall there were unpopulated

play05:12

positions for that are one and R2

play05:15

resistor here which are obviously the I

play05:19

squared C pull ups for the SDA and scl

play05:23

line

play05:24

however there was a populated Arrow 3 on

play05:28

there with the value 0 1 0 and an

play05:33

unpopulated of four and R5 position two

play05:37

so uh I guess that 010 is just a bridge

play05:42

and uh yeah they're using that breakout

play05:45

board for different chips

play05:48

again on the board there's the

play05:50

population C1 and C2 capacitor there's

play05:54

that uh

play05:56

010r3 resistor the unpopulated ll4 and

play06:01

R5 which are not even mentioned in the

play06:04

circuit diagram and the unpopulated

play06:07

positions for an R1 and R2 2.7 K pull up

play06:11

resistors for the I squared C lines

play06:15

let's have a look into the data sheet

play06:17

then

play06:18

the highlights plus minus 8G full scale

play06:22

range that's the usual for a compass

play06:25

chip 18 bits operation not only 16 but

play06:28

18 bits 0.4 milligaus total RMS noise

play06:34

and that's the best value in a data

play06:38

sheet I found for these Hall element

play06:41

based magnetic compasses you can get

play06:45

ships that are better but these are no

play06:48

longer based on Hull elements but they

play06:50

are really using three different coils

play06:53

to measure the magnetic field of the

play06:56

earth and they also in another price

play06:58

range

play06:59

enable setting accuracy of plus minus

play07:02

0.5 degrees we talked up already about

play07:06

that uh output data rate up to 1000

play07:09

Hertz now I don't need that but that's a

play07:13

lot and degaussing with built-in set

play07:16

reset function so that thing can

play07:19

eliminate when you boot it up any

play07:22

residual magnetic fields that might have

play07:24

built up a lot of blah blah blah yeah

play07:29

output data ready interrupt output of

play07:32

course uh then the I squared C interface

play07:35

is fast mode 400 kilohertz that's good

play07:39

3.0 volt single low power supply ER I

play07:43

hope it will run with 3.3 volts too we

play07:46

will see that in the details and of

play07:49

course it has an alternative SPI

play07:52

interface available

play07:54

here's the block diagram very tiny so

play07:58

you have here your three Hull elements

play08:01

for the X Y and z-axis and then you have

play08:04

some signal processing and then the

play08:06

results are stored in three registers X

play08:09

Y and Z which you can read while I

play08:12

squared C and SPI I'm sure there are

play08:15

also some registers that you can write

play08:17

to set different options uh clock

play08:20

generator blah blah blah set reset

play08:22

control that was that degaussing staff

play08:25

voltage reference test and buffer

play08:28

switches temperature sensor I think I

play08:32

skipped that it has a built-in

play08:34

temperature sensor for temperature

play08:36

compensation too

play08:38

maximum Supply voltage is 3.6 volts so I

play08:43

want to run that thing on 3.3 volts on

play08:46

an Arduino so that's fine uh

play08:50

Supply current okay uh yeah not even

play08:54

half a milliamp and yeah the uh there

play08:58

are these BW zero zero two one one these

play09:03

are bits in some of the control

play09:05

registers and they control how long a

play09:10

measurement can take or will take

play09:12

meaning how much filtering the chip does

play09:16

internally that's important that ranges

play09:19

from eight milliseconds to 0.5

play09:22

milliseconds that's important because if

play09:26

we go further down here our operating

play09:29

temperature range minus 40 to 105

play09:32

degrees with golden there linearity

play09:35

Arrow 0.1 percent of full scale that's

play09:39

all very very nice repeatability error

play09:42

0.1 of false scale alignment error and

play09:47

so on and so on until we come here to

play09:50

the RMS noise

play09:52

and

play09:54

the promised

play09:56

0.4 milligaus RMS noise you only get if

play10:02

you take the filtering to the Max and

play10:04

then each measurement takes eight

play10:07

milliseconds and uh yeah you don't get a

play10:11

1000 measurements per second out of that

play10:14

thing but that's okay for my application

play10:17

uh new value every eight milliseconds is

play10:20

more than I need

play10:22

there's a whole lot more information

play10:24

here in the data sheet but uh yeah we

play10:28

will come back to that when we actually

play10:29

need it

play10:31

absolute maximum ratings so Supply

play10:33

voltage from minus 0.42 plus 3.6 volts

play10:38

again we're golden here with 3.3 volts

play10:41

from our Arduino

play10:43

on page 10 respectively 11 of the data

play10:47

sheet we find for typical application

play10:49

circuits for or four different modes

play10:54

operation modes I squared C dual Supply

play10:56

operation we can forget about that

play10:58

that's not supported by our little

play11:00

breakout board SPI dual Supply operation

play11:04

is also not supported so we can

play11:07

concentrate on I squat C single Supply

play11:09

connection and SPI single Supply

play11:13

connection

play11:14

I squat C single Supply connection no

play11:17

surprises here but we have to bind the

play11:20

SPI chip select pin to vdd to indicate

play11:25

that we are actually want to use I

play11:27

squared C and the SPI slave data out

play11:31

chip is just left dangling here

play11:35

please note that the pull up resistors

play11:38

here for our I squared csdi and as clock

play11:42

lines are not on the breakout board at

play11:45

least they are not populated for SPI

play11:48

single Supply operation you just feed

play11:52

your SPI signals in the four pins that

play11:55

are for SPI so slave data out slave data

play12:00

in slave clock and Chip select

play12:04

now that we know that the thing will run

play12:07

with 3.3 volts and we have an idea how

play12:10

to connect it to our Arduino the

play12:12

question is is there an Arduino Library

play12:15

available and yes there is but only one

play12:21

at least I only found one library and

play12:25

that's the spark fund SparkFun MMC

play12:30

5983ma magnetometer Arduino Library

play12:33

what else

play12:36

um

play12:37

we will probably go into the details a

play12:40

little bit but I want to point out here

play12:44

this little remark added last year added

play12:48

SPI support Dash partial okay not that

play12:54

this matters to us because I want to use

play12:57

I squared C but this Library does

play12:59

somehow also support SPI but maybe not

play13:03

completely anyway let's have a look at

play13:08

the header file if we like that Library

play13:11

sometimes uh you don't like it or

play13:14

you know me so yeah here

play13:19

all the includes and we need the

play13:22

SparkFun IO library on Arduino Library

play13:26

constants and different files yeah or

play13:29

yeah I can live with that lots of

play13:32

private functions here nothing too bad

play13:38

than a default Constructor and the

play13:40

default Destructor okay or you can set

play13:45

an error callback function that's not

play13:48

too bad I like that uh error code string

play13:51

also not too bad uh begin that is there

play13:57

are two different begins here one

play13:59

obviously for I squared C with a two

play14:02

wire object

play14:04

and then here one with uh for SPI

play14:09

and then you get the usual is connected

play14:12

get temperature yeah we know this thing

play14:14

has a temperature sensor software Ascent

play14:16

enable interrupt disable and drop that

play14:19

obviously for the intro pin is interrupt

play14:22

enable yeah query

play14:24

uh what else we have here our enable

play14:28

three wire SPI and disable free via SPI

play14:31

we don't care about that is three wires

play14:34

yeah no SPI uh perform set operation

play14:39

perform reset operation okay enable

play14:42

automatic set reset okay whatever that

play14:46

is we will dive into those details in

play14:49

the first the details video I guess

play14:53

is automatic said okay enable X Channel

play14:57

disable

play14:58

okay Channel disable

play15:01

enable for X Y set set build a filter

play15:05

bandwidth we talked about that okay

play15:07

anyway uh

play15:10

yeah uh complete Library

play15:14

using I don't know if it's really using

play15:18

all of the functions but uh

play15:21

it doesn't look that bad so let's use it

play15:27

the library is available within the

play15:30

Arduino Library manager in the version

play15:33

one one one that was also the one we

play15:36

just saw on GitHub great

play15:39

and that Library comes with a bunch of

play15:42

examples seven to be exact starting from

play15:47

a simple measurement digital compass or

play15:49

we will try that a continuous

play15:51

measurement simple measurement digital

play15:54

compass two

play15:56

fast continuous measurement and sensor

play16:00

offset

play16:01

let's start with a digital compass and

play16:06

um

play16:06

yeah

play16:08

load that to our Arduino and connect

play16:11

everything up

play16:13

everything is wired up now nicely so we

play16:16

have our ground connection to ground and

play16:19

we have a 3.3 volt going to our vdd VD

play16:27

Dio has no connection we already talked

play16:30

about that and the SPI chip select is

play16:33

bridged to our vdd so that should put

play16:37

the whole thing into isolate C mode

play16:41

we have a two 2.7 K as was mentioned in

play16:45

the datasheet pull up resistors here on

play16:48

our chip clock uh slave clock and slave

play16:52

data lines and the slave data line is

play16:56

going over here to the slave data pin

play16:59

and the slave clock line is going over

play17:02

to the slave clock pin let's fire that

play17:05

thing up

play17:07

and right out of the bed it's working

play17:11

and I want you to note how little noise

play17:16

there is on the signal here so yeah uh

play17:21

uh it's fluctuating between five

play17:26

three

play17:28

I see a six in between can I get a six

play17:32

nah not really so uh it's fluctuating

play17:36

about two tenths of a degree

play17:40

right off the Box no additional

play17:42

filtering just with that

play17:45

SparkFun Library no calibration at all

play17:48

and that's the next big surprise uh I

play17:52

have placed here a little Compass so you

play17:55

can see

play17:56

where North is

play18:00

and

play18:03

yeah okay we're 10 degrees off but

play18:07

without calibration that's absolutely

play18:10

okay

play18:11

and if we go to 90 degrees approximately

play18:21

yeah

play18:22

seven eight degrees of

play18:26

270 degrees I mean we will make a

play18:30

Precision measurements in the details

play18:32

videos of course yeah four degrees off

play18:35

and

play18:37

if we go to 180 degrees approximately

play18:40

yeah we are at 180 degrees without

play18:43

without again if you followed the series

play18:47

about the qmc chip

play18:49

without any calibration

play18:52

that's a really really impressive uh

play18:56

right out of the gate

play19:00

I like it

play19:02

let's go over that spark fun example

play19:05

real quick so we include here wire and

play19:09

the SparkFun library then we instantiate

play19:13

that's the class name okay uh our chip

play19:18

the object for our chip we make a Serial

play19:21

begin and we make a little serial print

play19:24

that was already scrolled out of the

play19:26

screen and if Mac begin is false there's

play19:31

something wrong then you get a error

play19:34

message and it goes into an endless loop

play19:38

here

play19:39

and then we do a soft reset whatever

play19:42

that does we will see in the details

play19:44

videos there will be several of them and

play19:48

then we say we are connected and then we

play19:51

have here somehow 32-bit unsigned

play19:55

integers for the raw values of the X Y

play19:58

and set sensor then we have doubles for

play20:02

the normalized values uh please note a

play20:06

double is only a float in the Arduino

play20:09

environment so it doesn't really matter

play20:13

it's only 32-bit whatever you want to do

play20:17

and then we do I mean that

play20:19

self-explanatory uh get measurement X Y

play20:22

set into the raw values and then we

play20:25

normalize these values into a range

play20:28

between plus minus

play20:31

1.0

play20:33

and we do that for all three values for

play20:37

x y and set and then we calculate the

play20:41

heading using the archus tankans two

play20:45

function and this doesn't deliver uh

play20:49

yeah a result in degree plus but uh

play20:53

something between plus pi to minus pi

play20:56

and we convert that in degrees and then

play21:00

this is printed out so really straight

play21:04

forward uh by the way the whole Arcus

play21:08

tungans two thing to actually calculate

play21:11

a compass heading from two sensors is

play21:16

explained in the room in the third

play21:19

details video about the qmc chip card

play21:24

here Link in the description let's try

play21:27

another example then shall we

play21:31

so the examples are not that interesting

play21:35

uh this basically gives us the raw

play21:38

values and the values in Gauss on the

play21:42

serial military uh let me stop the auto

play21:45

scroll so the flickering goes back uh

play21:48

but again I want you to note how little

play21:52

how little the raw values fluctuate

play21:57

really this is a a few least significant

play22:01

bits noise we have on here so that's

play22:06

really nice and then we have our Gauss

play22:08

values and I activate the auto scroll

play22:12

again and of course if we move our

play22:15

Compass I'm doing that off screen here

play22:17

uh

play22:19

forgot to switch on the other camera

play22:22

then things are changing so yeah really

play22:28

nice

play22:29

and the code for that example is also

play22:32

very trivial uh yeah it starts exactly

play22:35

the same yeah initialize your serial

play22:39

interface check if the chip is there

play22:42

and uh yeah we already scrolled over

play22:45

that uh get the temperature and

play22:46

Fahrenheit or Celsius uh then we go into

play22:50

a loop we have again our six values here

play22:55

for x y and set count value that is an

play22:58

unsigned integral 32 and normalized we

play23:02

get our measurements this time with

play23:05

three methods each measurement for its

play23:08

own and then you saw that it's printed

play23:12

out the intellectual value

play23:14

and then we convert these 18-bit

play23:17

unsigned intentional values into

play23:20

a double which should be

play23:25

after it's multiplied by eight You

play23:29

Remember full scale is eight cows for

play23:32

that chip gives us the field value the

play23:36

magnetic field value or at least the

play23:38

component in X Y and Z Direction

play23:42

in cows

play23:45

that's it that's it yeah the examples

play23:49

are not very

play23:50

extensive uh there's also nothing

play23:54

absolutely nothing uh with calibration

play23:57

and stuff so we will have to do all that

play24:00

by ourselves

play24:02

that's it for today we had a little

play24:06

squeeze on the data sheet of that thing

play24:09

and it's uh about at least according to

play24:12

the data sheet impressive performance uh

play24:16

we learned how to wire that thing up to

play24:18

an Arduino the different modes it can it

play24:22

supports us with c and SPI and we found

play24:26

a readily available Library the examples

play24:30

are a little bit mood but yeah it's

play24:33

working

play24:34

very well

play24:36

next time

play24:38

the details one uh we will start writing

play24:42

our own library for that thing because

play24:45

never trust a library uh from the

play24:49

internet about we could look into the

play24:51

code how the library is implemented but

play24:53

anyway uh I think it's a little bit

play24:58

heavy with that uh SPI and I squared C

play25:02

support and then including some uh i o

play25:06

library from SparkFun I don't like that

play25:09

we will write our own Library just

play25:12

purely for I spread C

play25:14

and then we will add some important

play25:17

functions over the different details

play25:21

videos like for example calibration

play25:24

because while that thing is basically

play25:28

compared to the qmc

play25:31

chip uh noiseless

play25:36

it does need calibration okay otherwise

play25:40

you won't get a very good values a very

play25:44

good Compass readings out of that

play25:46

till then bye

play25:49

bye

Rate This

5.0 / 5 (0 votes)

Related Tags
Magnetic SensorDigital CompassArduino ProjectPrecision MeasurementSensor CalibrationMemsic MMC5983MAI2C InterfaceSPI InterfaceNoiseless SensorDIY Electronics