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
Hi Antony,
Did you get the codes?
Regards,
Fakhruddin
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
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):
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
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
Hi Fakhruddin,
The dataset you provided is very strange, I can't really trust it's comming from our MAG3110 device.
Here my suggestions/questions/feedback/concerns:
Regarding your data:
Regarding your application:
Let me know if it helps!
Regards,
Anthony
Hi Anthony,
Thanks for the reply. As per your suggestion I will check and let you know shortly.
Thanks
Fakhruddin
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