【问题标题】:Using iOS device as teslameter (magnetometer discussion)使用 iOS 设备作为特斯拉计(磁力计讨论)
【发布时间】:2016-06-30 06:22:49
【问题描述】:

在我的应用中,我想检测周围磁场/电磁场的强度。我想要实现的是测量磁场变化,以了解它是否比控制测量更强或更低。这是我的代码:

- (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;
}

幅度值会对设备周围的磁场做出反应,问题是您需要真正靠近这种磁场的来源。

所以,问题是:iOS 应用是否有可能测量超过 10-20 厘米距离的磁场?如果有,怎么做?

P.S.:我还检查了 Apple 的 Teslameter App,它有几乎相同的代码和完全相同的问题。

【问题讨论】:

    标签: ios objective-c iphone swift magnetometer


    【解决方案1】:

    当然可以,磁场必须非常强!

    您的第一个限制可能是硬件。如In iOS, what is the difference between the Magnetic Field values from the Core Location and Core Motion frameworks? 中所述,这些原始值的范围可能会受到限制。在某些硬件和 iOS 版本中,它们将它们限制为 -128 到 +128 微特斯拉。在 iPhone 6 上,我可以获得远远超出该范围的 microtelsa 读数,但这并不一定有帮助。苹果似乎没有为磁力计读数的准确性提供任何参考,我们可以测量出纳特斯拉的值,但我们得到的结果可能是毫无意义的噪音。

    地球表面的磁场将是25 to 65 microteslas。您希望测量的任何场都需要比所需测量距离处的场强得多。你想测量什么,它真的足够强大,可以将罗盘指针移动到你想要测量的距离吗?

    【讨论】:

    • 问题是我想测量磁场强度的增量,只是说它变强还是变弱。
    • @IvanNesterenko 对了,所以问题就变成了;设备可以测量的最小可检测增量是多少?这意味着您需要离源多近?当我运行 Apple 的示例应用程序时,我看到的组件变化至少 +/- 1 微特斯拉。由于您的目标场,您很难检测到 1 微特斯拉或更少的变化。鉴于该领域的实力,您需要多近才能让设备记录至少几微特斯拉的变化?
    猜你喜欢
    • 2011-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-08
    相关资源
    最近更新 更多