cancel
Showing results for 
Search instead for 
Did you mean: 

Inquiry for technical support regarding use of IIS2MDC sensor

Jinlee
Associate

Hello.

I am a graduate student who is conducting research using IIS2MDC and Arduino, a digital magnetic sensor of STMicroelectronics.

I am currently using IIS2MDC and Arduino Uno to measure the magnetic fields in the form of sine waves generated from the coil.

First of all, the measurement environment is composed as shown in the picture below.

fig2.jpg

 

The code used the stm32duino/IIS2MDC/IIS2MDC_DataLog_Terminal.ino code listed on Github. I am proceeding with the measurement by modifying the Baud rate and Delay time.

The picture below shows the magnetic field measurements of the coil for AC 20 Hz current at Baud rate (2000000), Delay time(0).

fig1.png

 

The questions I would like to ask are as follows.

1. I need to connect the cs pin to the Arduino Digital 0 pin for data to come in, what is the meaning of this connection? Also, I'm using the drdy pin without connecting it, and I'm curious about the meaning of these two pins.

 

2. When I set the sensor ODR to 100Hz and looked at the magnetic field data value for 1 second for the AC 20Hz current, I could see that 20 cycles were taken. However, there is a phenomenon where several of the same data values are taken. I am curious about the cause and solution to this phenomenon.
(It was improved by reducing the Buad rate, but it didn't go away. It disappeared if I grew a lot of delay, but I don't think it's a good way to reduce the sampling rate.)

3.png

 

3. When measuring the magnetic field of AC 100Hz, it was impossible to measure with ODR 100Hz. Is the ODR value of the data sheet the sampling rate we think?

 

4. I'm finally aiming to measure AC 100Hz, and if this sensor is not possible, I was wondering if you could recommend a suitable sensor.

1 REPLY 1
Federica Bossi
ST Employee

Hi @Jinlee ,

Welcome to ST Community!

To better understand the CS and DRDY pin you can look at the LIS2MDL datasheet:

FedericaBossi_0-1716455236051.png

The ODR is not the sampling data rate but it is the output data rate, the rate at which a sensor obtains new samples. To measure AC 100Hz you should set an ODR of at minimum 200Hz but, unfortunately, the maximum LIS2MDL ODR is 150Hz in LP mode in single measurement mode:

FedericaBossi_1-1716455391035.png

 

 

 

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.