I want to be able to tell which direction the Arduino is facing when mounted to the top of a car. The car can be sitting at an angle. Does anyone have some suggestions as to what sensor I should use for this application? I purchased an LSM303 from Adafruit, but I'm not sure what it means to calibrate the sensor... and I'm wondering if the LSM303 is the right sensor for this application. Thanks.
You can place the Arduino in any direction You want. It makes no difference at all. The LSM303 however You should preferably place so the compass readin of zero either matches the magnet field of the earth, or the direction of the car.
The sensor needs to be placed as far as possible above the steel roof of the car.
Calibration means you build it and put it in place, point the car to magnetic North and see what the sensor tells you. Your further readings are then relative to that one.
Thanks for the quick replies! Are there any advantages to using the BNO055 sensor instead?
In regards to calibration, once the sensor is mounted to the top of the car, and then calibrated, will placement of the device matter? In other words, will the steel only affect calibration or does it always affect the data validity?
What do you expect?
If you have metal on one side of the sensor that will cause different reading than non metal around, placing sensor on the roof ( best on middle of it ) will cause symmetrical distortion on every side of sensor , so total influence = 0
Why on the roof ?
This one's in the car.
The uC will controlling motors on the roof of the car. It sounds like mounting it on the roof isn’t going to work.
I took my iPhone and placed it on various spots on my truck while running the compass. I was able to consistently read true north.
Is it just a much better sensor?
So you have additionally motors with the magnets on the truck roof ?
On edge of the roof ?
I think calibration with sensor on the roof will work as long as sensor stays all the time in the same place.
symmetrical distortion , post #6
Would it help if I put the magnetometer into a small aluminum enclosure?
That will act as a shield for electric field, no effect for magnetic field, will reduce interferences.
Got it. I guess I’ll just mount, calibrate, and try it. I’ll test to see how close I can get to the magnetometer with the DC Motor before readings go bad. I assume the readings will be just as bad regardless if the motor is running or not right?
Some motors have permalloy shields.
Not running motor has fixed field which can be compensated by calibration, running motor create rotating field which is harder to compensate, but can be reduced by shielding.
Just as a "rule of thumb", 30 cm at least distance from the motor should be OK.
Many years ago, nearly 20, I was involved in making a compass for the Lego MindStorms competition.
The sensor was placed about 30cm above the robot, on a wooden stick, to get accurate undistorted readings.
I can't remember what sensor we used, but I programmed it give out 8 cardidinal points as 8 analog levels.
It had a calibration button that offset the reading so the robot, in what ever direction it was pointing at the time of cal, was zero.
The module had a pic microcontroller doing the work, and a R-2R output network.
This sensor I think was pretty crude but it worked.
I inside a housing, about 1cm diameter, was a compass needle, around the circumference were 8 hall effect devices that sensed the N-S ends of the compass as it aligned with the earths magfield.
There was a more expensive unit that had cos and sine outputs to give even more precise directions.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.