Blog

Bugfix: iOS+240V+AC Measurement=Disconnect

Hi Reader,

UPDATE: Users in the US and other 120V countries have reported this issue as well.  If you’re experiencing intermittent disconnection of the Mooshimeter from your iOS device with firmware before 1447470000, this is probably the cause.

Symptom

Some users have reported a bug that I just pushed a firmware update to fix.  If you’ve experienced the following:

  • Mooshimeter connected to iOS device
  • Measuring AC 240V or higher (typical in Europe)
  • The voltage is correctly displayed for several seconds, then the connection drops
  • The meter does not reboot and the user is easily able to reconnect

Fix

You can solve the issue by updating firmware from your iOS device.  To do so, you just need to reboot the meter and connect to it in the first 5 seconds after it boots, as demonstrated in this video.  Note that the linked video is for the Android app, but the process is the same.  After update, the new version code displayed for the firmware will be 1447470000.

More details

Software Math

The Mooshimeter has a single 8-bit processor on board.  The samples from the ADC are 24 bits large.  To accomplish the 24-bit math needed for RMS calculations, the Mooshimeter needs to stitch together multiple 8-bit operations.  A side effect of stitching together math this way is that small values take less time to multiply than large values.  So calculating RMS voltage for a 240V line takes slightly longer than calculating for a 110V line, just because the numbers are bigger.

BLE Timing

Bluetooth Low Energy (BLE) connects the Mooshimeter to the phone.  BLE works by both sides of the connection agreeing to turn on their radios and check-in with each other every “X” milliseconds.  “X” is called the connection interval, and typically it’s on the order of 30ms (technically it can be anywhere from 7.5ms to 4s).

The Bug

  • iOS devices typically use a shorter connection interval than Android devices
  • The Mooshimeter is taking too long to calculate AC voltages
  • Since there’s only a single processor doing the math and operating the radio, this causes the meter to miss BLE connection events
  • The iOS device thinks the meter has broken its connection because it misses several connection events in a row

I’m not 100% sure why this came up now and why it doesn’t affect all users, but I just pushed a firmware release for the iOS app only that addresses this bug.  It’s also worth noting that this bug is basically an extension of one I addressed in November, detailed here.  Hopefully as more reports come in I can get a clearer picture.

The main thrust right now is porting the new features of the Android beta over to iOS, so I’m going back to work on that.

Thanks for reading.

~James

4 Responses to “Bugfix: iOS+240V+AC Measurement=Disconnect”

  1. aladds April 28, 2016 at 11:04 am #

    Hiya. Updated to this version, and whilst the firmware update shows as the new version (and I get the message saying it’s complete), the meter never seems to exit update mode, so when I choose it in the list it goes back to updating again. The light does the “long long short short short” flashing seemingly forever.

    I’ve tried two iPhones, a 5s and a 6s, and it’s the same for both.

    I’ve tried taking the batteries out and putting them back, hitting the button on the meter, doing the whole thing again with and without an SD card inserted… the only thing I can think of that I can’t try at the moment is an Android phone.

    • James April 28, 2016 at 11:11 am #

      Hi Aladds,

      It sounds like there was an error in the firmware upload and the meter is in a reboot cycle. There is a known issue where performing a firmware update with low batteries can cause a corrupted image to be saved. Can you try replacing the batteries and running the firmware update again?

      Sorry for the trouble

      • aladds April 28, 2016 at 11:24 am #

        That’s done it, thanks! (and wow, that was a quick response!)

        I didn’t even need to re-do the update, so I imagine it’s just to do with the boot procedure after a reset?

        • James April 28, 2016 at 11:26 am #

          I can’t say for certain from here, but I’m glad it worked. Please let me know if other issues come up.

Leave a Reply to aladds Click here to cancel reply.