Wednesday, February 18, 2009

Bubble


Bubble is a free virtual bubble level for the Android platform.

Hold any of your phone's four sides against a vertical or horizontal object to test it for plumb/level, or lay it down on a flat surface to see a 360° level. Bubble automatically switches its orientation based on how you hold your phone. It measures angles up to 60°, accurate to within about 1 degree.



Use it to hang a poster, level a table, straighten a picture, check a wall for plumb, setup a tripod. Wherever you might need it, you can now have an accurate level with you.

Bubble can also do things that a traditional level can't do. If you need to hold it in an awkward position where you can't see the screen, turn on the beeper or the vibrate mode and you'll know when it's level. Or turn on voice mode and it will speak the angle to you.



Settings:
  • Show Angle: Displays the numeric value of the angle. If the phone is held flat then two angles are shown, one for the horizontal value and one for the vertical.
  • Enable Voice: Speaks the angle out loud using the Text-to-Speech library, also available for free on the Android Market. (Not available when in 360° level mode.)
  • Enable Beep/Buzzer/Light: All of these can be used to indicate when the phone is exactly level.
  • Calibration: Independent calibration for each side of the phone.


Calibration:

Every phone is slightly different. To compensate for this, Bubble can calibrate each side of the phone independently. Hold your phone up against a real bubble level, tip them together so they are both level, and choose Menu> Calibrate. Hold still for a moment and that side of the phone will become calibrated and read zero degrees.

Calibration can be reset to its defaults in the Settings menu.


Accelerometer Problems

Bubble uses your phone's accelerometer to determine the current angle. Dropping your phone can cause its accelerometer to malfunction, suddenly becoming extremely inaccurate or even stuck in one position. (I had this happen to me after I dropped my phone on pavement.) Luckily this does not necessarily mean your accelerometer is permanently damaged. A factory reset was able to correct this problem for me and for a number of other people who contacted me with similar problems.

If your angle is off by a large amount (mine was off by about 30 degrees) or stuck in one position with little or no change in value no matter how you hold it, your accelerometer is probably malfunctioning. Try testing other apps that use your phone's orientation, like Amazed, Wikitude, or Google Street View with compass mode enabled. If you find similar problems with other apps, you should definitely try performing a factory reset on your phone to correct the problem. T-Mobile support will walk you through this process.


Calibration API:

If you are authoring an Android app that needs to know the device's exact orientation, you can use the calibration values mesaured by Bubble rather than having to build a similar calibration feature yourself.

Bubble uses a content provider to share its calibration values with other apps. It provides a single result set containing six values: pitch offsets for the left and right edges, roll offsets for the top and bottom edges, and both a roll and a pitch offset for the back of the device.

Sample Code:

Uri CONTENT_URI = Uri.parse(
"content://bz.ktk.bubble.orientationcalibrationprovider" );

Cursor cursor = managedQuery( CONTENT_URI, null, null, null, null );

if ( cursor == null )
return;

cursor.moveToFirst();

// Use these when the device is lying flat:
int basePitch = cursor.getColumnIndex( "base_pitch_delta" );
int baseRoll = cursor.getColumnIndex( "base_roll_delta" );

// Use these when the device is on an edge:
int left = cursor.getColumnIndex( "left_pitch_delta" );
int right = cursor.getColumnIndex( "right_pitch_delta" );
int top = cursor.getColumnIndex( "top_roll_delta" );
int bottom = cursor.getColumnIndex( "bottom_roll_delta" );

// Finally, apply these offsets to the reported angles:
if ( on_back ) {
pitch += cursor.getFloat( basePitch );
roll += cursor.getFloat( baseRoll );
} else if ( on_left_edge ) {
pitch += cursor.getFloat( left );
} else if ( on_right_edge ) {
pitch += cursor.getFloat( right );
} else if ( on_bottom_edge ) {
roll += cursor.getFloat( bottom );
} else if ( on_top_edge ) {
roll += cursor.getFloat( top );
}


Availability:

Bubble is available for free on the Android Market.

Name: Bubble
Category: Applications: Tools
Price: Free




Scan this with the Barcode Scanner app on your Android phone and it will take you directly to Bubble on the Market.

15 comments:

  1. Thanks for this useful application.
    Would it be possible to add a 1/10° digit ?
    It would be wonderful for relative angles measurements required in my RC heli hobby.
    Fabien

    ReplyDelete
  2. I'm glad you like it!

    As far as I can tell, the G1's accelerometer is only accurate to one degree. Sorry.

    ReplyDelete
  3. Nice App.
    It would be even better with the camera view as background image instead of white or black color!

    ReplyDelete
  4. I see the process bz.ktk.bubble is running even when I'm not running the bubble app. (Via the command "top") and that it's the 4th highest consumer of CPU cycles. Why is it running and what is it doing?

    ReplyDelete
  5. It shouldn't be doing anything. I'll investigate.

    ReplyDelete
  6. Will work for the blackberry ?

    ReplyDelete
  7. No, sorry. My apps are all Android-only.

    ReplyDelete
  8. the Y axis is reversed on my phone, when I tilt Y+ the bubble follows Y+ it's like one of those marble mazes.

    I tested this against Labyrinth Lite and Shooter when i tilt down the bubble goes down instead of up.

    would it be possible to add an advanced setting to reverse y+/y- or x+/x- as this is the only app i've used that doesn't function properly.

    great app btw, love the TTS option it works sooooo well!

    ReplyDelete
  9. the Y axis is reversed on my phone, when I tilt Y+ the bubble follows Y+ it's like one of those marble mazes.

    I tested this against Labyrinth Lite and Shooter when i tilt down the bubble goes down instead of up.

    would it be possible to add an advanced setting to reverse y+/y- or x+/x- as this is the only app i've used that doesn't function properly.

    great app btw, love the TTS option it works sooooo well!

    ReplyDelete
  10. Sorry...now I have the circle view and can't figure out to get back to the tube view....what am I missing?

    ReplyDelete
  11. I have a X10 mini and cannot get the voice spoken when using this app. I have tts engine installed ('Install voice data' is grayed-out). My 'Accessibility' options are enabled and I have installed Soundback and Talkback also. Incidently, when I check these 2 features, everything I do on the phone has a running commentary (annoying). Can that be stopped? However, still no voice on bubble app. My phone is running 2.1 and voice works fine in other apps e.g. google maps or navigation. Please could you give me some advice.

    ReplyDelete
  12. Great app! Thank you very much! Could you please consider taking the readings from the accelerometer instead of the orientation sensor? That would enable 1/10 digit.

    ReplyDelete
  13. The droid auto-rotates the screen and I have turned that option off, however, when I turn my phone the level turns as well, hence I can only take horizontal checks and not for vertical checks.

    Thoughts?

    ReplyDelete
  14. I have a Droid and the screen changes/turns as I turn the phone. I have turned that option off and I still can not take use this app on vertical walls. Any thoughts?

    Hojo

    ReplyDelete
  15. What a great app. Simply marvelous!! Thanks

    ReplyDelete