MAG3110 erroneous reading

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MAG3110 erroneous reading

1,499 Views
fakhruddinkhan
Contributor I

We are using MAG3110 sensor for parking occupancy detection application. We are getting varying results even when the sensor is placed in fixed position and there is no moving objects around the sensor (Please find attached file).

Our configuration is as follows:

CTRL_REG2 = 0x80

CTRL_REG1 = 0x01

I am reading in while loop during interrupt from MAG3110

Please suggest any method to get the stable reading , since our application is to detect a vehicle whenever the vehicle is over the sensor.

 

Thanks

Original Attachment has been moved to: MAG3110Logs.txt.zip

Labels (1)
0 Kudos
7 Replies

713 Views
fakhruddinkhan
Contributor I

Hi Antony,

Did you get the codes?

Regards,

Fakhruddin

0 Kudos

713 Views
fakhruddinkhan
Contributor I

Hi Antony,

We have purchased 2 MAG3110 boards from Ebay and initially we had tried interfacing the MAG3110 boards with the CC1110 directly using bit banging method and we got the readings we had shared with you.

Now we have interface the MAG3110 boards with the Raspberry Pi-3 using I2C peripheral and we are getting the results attached .

Since you have mentioned about defective piece how can we come to know whether the MAG3110 is defective or not?

Please reply.

Thanks,

Fakhruddin

0 Kudos

713 Views
anthonyduhamel
NXP Employee
NXP Employee

Hi Fakhruddin,

You didn't get correclty the magnetic data from the sensor to your raspberry. If you plot your data in a chart, you can see the curve shape is similar on the three axis (not same scale/offset but same tendencies):

pastedImage_1.pngpastedImage_2.png

So you really need to check how you communicate with the MAG3110  (are you sure to read the right registers?) and how do you convert it. If you need more support, please share your code and the I²C frame screenshots.

I don't think it's a defective part issue there, but if you want a trust supplier for a mag3110 evaluation board, I suggest you to try the BRKT-STBC-AGM01 , you can buy it on NXP website. 

Anthony

0 Kudos

713 Views
fakhruddinkhan
Contributor I

Hi Antony,

We had tried interfacing the 2 MAG3110 boards with both Raspberry Pi-3 board and CC1110

Case 1:- MAG3110 interface with raspberry Pi using I2C protocol

               The code for Raspberry PI-3 board is attached as "mag3110.py"

Case 2:- MAG3110 interface with CC1110 using Bit banging method

               Our main intention to interface the MAG3110 sensor is with the TI's CC1110

               Due to erroneous sensor reading we did some filtering to the raw output of the MAG3110 sensor in the code to get stable reading . The filtered process implemented in the code is as follows:-

1. Exponential average of raw sensor data

2. Difference between the raw and exponential average

3. Squaring the difference

4. Quadratic mean of the Squared Output

The main idea behind the filtering is to detect the drastic change in the earths magnetic field due to presence of the vehicle and make the readings from the sensor raw data with less difference to zero

The code for the CC1110 is attached as "CC1110_MAG3110 code"

Thanks,

Fakhruddin

0 Kudos

713 Views
anthonyduhamel
NXP Employee
NXP Employee

Hi Fakhruddin,

The dataset you provided is very strange, I can't really trust it's comming from our MAG3110 device.

pastedImage_1.png 

Here my suggestions/questions/feedback/concerns:

Regarding your data:

  • You may have a defective part. Did you test several MAG3110 or only one?
  • Are you sure to well convert the data from the MAG3110 in signed format? The noise scale is unbelivable. I think it is the best track for solution.

Regarding your application:

  • Try to use the raw mode
     pastedImage_2.png
  • Regarding your application, I'm not sure a 80 Hz datarate well adapted. I may use a lower ODR with a big OSR to reduce the noise comming from the environnement
    pastedImage_3.png

Let me know if it helps!

Regards,

Anthony

0 Kudos

713 Views
fakhruddinkhan
Contributor I

Hi Anthony,

Thanks for the reply. As per your suggestion I will check and let you know shortly.

Thanks

Fakhruddin

0 Kudos

713 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Fakhruddin,

It is hard to say where the problem might be. How many parts have you tested? Is this behavior same for all parts?

I would recommend you taking a closer look at our example project and this blog post.

Best regards,

Tomas

0 Kudos