magnetometer

How to build a compass with the iPhone?

Hello, After some searching on Google, I ask myself: Is it possible to build a compass (simple showing the heading/direction) with the iPhone 3G's GPS sensor? I have the suspicion, that this is only possible, if the device is moving. Any ideas are appreciated. ...

Getting magnetic north from a xyz magnetometer (iPhone 3.0)

I'm actually reposting a question from the iphone development boards. I didn't ask it, but I found it when trying to find its answer. Nobody had yet responded there, so I thought I'd try posting it here. Thanks in advance for any help! Does anybody know any specifics about the algorithm of computing the magnetic heading from the raw ...

How to determine absolute orientation

I have a xyz accelerometer and magnetometer. Now I want to determine the orientation of the device using both. The problem I see is that depending on the device orientation, I'd need to use the sensors in different order. Let me give an example. If I have the device facing me then changes in both the roll and pitch can be determined wit...

Basic doubt about sensor usage

Suppose I have a cellphone with accelerometer and magnetometer, and want to determine its absolute (wrt North/East/South/West) 3d position. Imagine the phone is laid vertically, with the screen facing me, the "up" vector pointing to the ceil. Whenever I tilt, the accelerometer allows me to get the "up" vector info change. The problem is...

How to distinguish movement accelerations from oscillations and noise in iphone

Hi everybody on stackoverflow. SHORT VERSION :) I need to use (x,y,z) acceleration values related only to the movement of the iPhone. Just to be clear, think an environment like a car. The iPhone's accelerometer is very sensitive. If I log acceleration values with a frequency of 100Hz, there are so many values related to noise, car vib...

Soft reset of magnetometer in Android

I have noticed that by shaking or tapping the phone (an SE Xperia x10 mini) several times recalibrates the magnetometer. Is there any way of doing this software-wise in a more controlled way? ...

Calculating magnetic heading using raw accelerometer and magnetometer data

I have an accelerometer and magnetometer each producing raw X, Y and Z readouts. From this I need to determine the magnetic heading of an object. I'm not that great at trig, but I've put together a formula that does respond pretty well to the rotation of the device, but also responds to movement that one would not think is relevant, suc...

Android - SensorManager strange behaviour of getOrientation

Hi, I need to retrieve the orientation of my phone. At the moment i wrote this : public void onSensorChanged(SensorEvent event) { switch (event.sensor.getType()){ case Sensor.TYPE_MAGNETIC_FIELD: this.mag_vals = event.values.clone(); this.sensorReady = true; break; case Sensor.TYPE_ACCELEROMETER: this.acc_vals = ...

Heading does not update properly unless compass is started on iPhone 3gs/4g

I have a subtle bug that I'm trying to resolve regarding getting updated locations on the iPhone. Under "normal" conditions, the heading updates come in perfectly fine from the location manager. However, on reboot of the phone or killing all processes on the phone, the heading does not update properly. I always get a -1 for heading. ...

Issue with SensorEventListner.onAccuracyChanged - Allways returns the same value

Hi, I am trying to determine when to ask the user to calibrate their device. Specifically the sensor TYPE_MAGNETIC_FIELD. The event callback is called repeatedly and always with the same value of accuracy = 3 (high accuracy). I have waved a magnet over the device and really confused the sensor but still I get high? This does not sound r...

finding orientation using getRorationMatrix() and getOrientation()

Im trying to get the direction of the vector pointing out of the camera, with respect to magnetic north. I'm under the impression that I need to use the values returned from getOrientation(), but I'm not sure what they represent. The values I get from getOrientation() don't change predictably when I change the orientation of the phone (r...