complete circuit for a test rig. Refer to Figure 3. An LCD
has been tacked on and that’s about it so, really, no parts
list is needed. Keep in mind that there are still four port
lines free for additional features you might dream up.
For example, one could add on a real time clock,
humidity sensor, warning beeper for rapid pressure
changes, maybe even a stepper motor with indicator
needle to imitate how an analog barometer might appear.
In the words of the old Steve Allen song, “this could be
the start of something big!”
When we get to the firmware in just a moment, you’ll
find that only half of the program space has been
consumed, with a plentiful 4,000 words left over for new
Oh, and software I2C routines (“bit-banging”) have
been exploited throughout, meaning that you can connect
the sensor to most any port lines of any PIC you want, as
long as they support both input and output modes.
Bits, Bytes, Words, Integers,
The time has come to consider the program which
orchestrates the show. The code has been written in Great
Cow Basic — my tool of choice when working with PIC
and AVR microcontrollers. This excellent compiler is open
source and free of charge, yet is a genuine powerhouse. It
features many, many valuable commands and data types,
and is exceedingly easy to use. If you don’t already have
it, you can download a copy from
gcbasic.sourceforge.net. As long as you’ve got the
computer warmed up, go ahead and fetch the software
for this article from the article link, too.
First off, let’s get a feel for how the BMP085 pulls off
its magic. When the circuit of Figure 3 is first powered up,
the PIC queries the barometer for some calibration data.
These are 11 16-bit factory-set constants, personalized to
each and every unit manufactured. The calibration
constants need only be fetched once at power-up. They’ll
be used in some later computations to fine-tune the
reading. We’ll wind up with temperature accurate to one
decimal place and the atmospheric pressure to two
After that, the BMP085 is polled once every second
or so for the current readings. We’ll receive both the
uncompensated temperature and atmospheric pressure
along the I2C bus.
Next, some basic arithmetic is wielded to convert
50 August 2015
So, you've got your PIC barometer up and running;
now what? Here are a few guidelines to get you started
on your weather journey.
First off, as a rule it's the change in values that
matters most, not the absolute reading at any given
moment. Keep in mind that atmospheric pressure varies
naturally somewhat during the day due to assorted
environmental or geographic factors. So, don't hover
around the barometer taking constant readings. A more
meaningful approach is to sense the atmospheric
pressure once every 24 hours, say at 8:00 in the morning
or 8:00 at night when the effects of the day's heating are
under wraps. In this way, you'll see the big picture
unsullied by little peaks and valleys which may mean
The following interpretations are widely quoted and
reproduced on the Web, and are a good place to begin.
The predictions are for the weather to expect in the next
24 hours. The numbers shown represent the mean sea
level pressure measured in inches of mercury.
Over 30. 20"
Rising or steady - Continued Fair
Slowing falling - Fair
Rapidly falling - Cloudy, Warmer
29. 80" to 30. 20"
Rising or steady - Same as Present
Slowing falling - Little Change
Rapidly falling - Precipitation Likely
Under 29. 80"
Rising or steady - Clearing, Cooler
Slowing falling - Precipitation
Rapid falling - Storm