Using iOS device as teslameter (magnetometer discussion)

Viewed 1884

In my app I want to detect how strong surrounding magnetic/electromagnetic fields are. What I want to achieve is to measure magnetic field change to know if it's stronger than in control measurement or if it's lower. This is my code:

- (void)setupLocationManager {
    self.locationManager = [[CLLocationManager alloc] init];
    if ([CLLocationManager headingAvailable] == NO) {
        self.locationManager = nil;
    } else {
        self.locationManager.headingFilter = kCLHeadingFilterNone;
        self.locationManager.delegate = self;
        [self.locationManager startUpdatingHeading];
    }
}

// CLLocationManagerDelegate
- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)heading {
    CGFloat magnitude = sqrt(heading.x * heading.x + heading.y * heading.y + heading.z * heading.z);
    if (self.defaultMagnitudeValue == 0.f) {
        self.defaultMagnitudeValue = magnitude;
    }
    self.curentMagnitudeValue = magnitude;
}

Magnitude value reacts to the magnetic fields surrounding the device, the problem is that you need to be REALLY close to a source of such a field.

So, the question is: Is there any possibility for an iOS app to measure magnetic fields on distances more than 10-20 centimeters? If so, how?

P.S.: I have also checked the Teslameter App by Apple, it has nearly same code and totally same problems.

1 Answers
Related