
Image from gizmodo.com
While surfing the net, I came across this article about a barometer application on Samsung Galaxy Nexus, a smartphone running on Android operating system. I’m neither a smartphone user nor a big fan of it, but the idea of having a petite weather forecaster in every phone sounded very intriguing. What if these barometers can observe the weather in each smartphone user’s current time and location, collect the weather information from the smartphone users all around the world, and generate a weather forecast reflecting these on-time changes?
The idea sounded wonderful until I noticed some skeptical comments about a digital barometer below the article. Although I was not able to understand all of the discussions clearly, it left me to wonder what parts of the smartphone are involved in operating a barometer application. So based on my introductory programming knowledge and some research on Android’s hardware features, I would like to share my own investigation on how a digital barometer works, an example of an awesome idea to have a collective information gathering.
First of all, a barometer is a device which measures atmospheric pressure. If you hit “barometer” on Google, you will see some old-fashioned barometers—either a long glass tube filled with mercury and standing on a base, or a compass-like device which indicates “rain”, “change”, or “fair” in different pressure reading. Traditional barometers contain metals such as mercury and alloys, which measured the displaced volume caused by the atmosphere.
Similar to the traditional barometers, Android phones have built-in hardware which can detect pressure. Piezoelectric sensors, for example, convert the mechanical stress into electrical charge. A crystalline material inside the sensor detects mechanical stress applied to it, and undergoes an electromechanical interaction which in process, generate electricity. This electricity is now delivered to other parts of the device and act as a threshold to activate different functions.
Application developers then can use programming commands to summon the atmospheric pressure measured by these pressure sensors into their program. For example, the programmers type in “getPressure” in their script to make an application to display a current pressure measured by its built-in sensor.

A screenshot taken at http://developer.android.com/reference/android/view/MotionEvent.html#getPressure%28int%29
The programmers can use different combinations of commands to perform many other tasks using this atmospheric measurement. For example, a command “getAltitude” allows a programmer to calculate the current altitude of the device using atmospheric pressure detected by the sensor and the sea level pressure retrieved from airport databases. This command suggests how the barometer can detect the location of the phone owner. By manipulation of some other commands, this information would be able to be sent to the internet database, and used by meteorologists to generate forecasting.

A screenshot taken at http://developer.android.com/reference/android/hardware/SensorManager.html#getAltitude(float, float)
Like the article at the start of this entry suggested, digital barometer applications in smartphones are still argued to be unstable. As long as these applications can be designed adequately by meteorologists and programmers, I think this application can be a powerful device to detect rapid changes in the weather in the future. What do you guys think?
References:
- “Why the barometer is Android’s new trump card”
- “What is that Galaxy Nexus Barometer exactly for?”
- “What does the pressure sensor measure?” – A question posted on StackExchange
- Wikipedia on Barometer
- Wikipedia on Piezoelectric sensor
- Wikipedia on Piezoelecticity
- “getPressure” command found on Android Developers Database
- “getAltitude” command found on Android Developers Database
originally posted on February 6th, 2012 in Section 210 Blog . Moved to Section 212 on February 9th, 2012