- Discrete LEDs
- Dot/Bar LEDs
- Matrix LEDs
- 7-Seg LEDs
- Serial -- Software
- Serial -- Hardware
- RS-232 via the MAX3232
- I2C -- EEPROM
- I2C -- DS1307 Real Time Clock
- 1-Wire -- DS18B20, Powered, Single-Drop
- 1-Wire -- DS18B20, Powered, Multi-Drop
- 1-Wire -- DS18B20, Parasitic, Multi-Drop
- TI Link Protocol -- Calculator Demo
- Infrared Communication
- MIDI -- Output Demo
- MIDI -- Input Demo
- MIDI to Analog Synth
Barometric Pressure Sensor
The BMP085 is an exceedingly precise barometric pressure sensor. A barometer has been my holy grail for years now, and the few times such sensors have appeared, they were outrageously expensive. But this device, besides being of true scientific utility, exacts just a drop in the bucket. I bought mine from Amazon back in 2014. Since that time, it's been replaced by the BMP180 which goes for about $7. I believe it's a plug-in replacement for the part I used, with no change of software, but haven't tested it yet myself.
Even though my Pascal code takes care of everything for you, you might still want to check out the data sheet:
The data sheet is fairly complete, but even so you'll need to read it with an eagle eye if you really want to know how the part works. It's not that the hardware is tricky, but rather that the necessary software to decode the device is crazy complex. But again, I've taken care of the nastiness by whipping up a library unit for you; all of the complexity is hidden from view.
For even more information, you might want to peruse my article, "How to Craft a PIC Barometer," Nuts & Volts Magazine, August 2015, pp. 48-52. You'll note that I wrote the code for that article in Great Cow Basic. Revising that to PIC Micro Pascal shaved off 500 bytes of program space!
I suppose I ought to mention that I spent over 160 hours writing and testing the code. The difficulty is that all sorts of different data types are called for by the component, with casting and type conversions at the right times essential to its proper working. Add on that some floating point number work is required at compile time (natural logarithms and exponentials) and you've got one fussy piece of software to weave.
By the way, the BMP085 is a surface mount part, but you'll see in the photo above that the unit I'm using is mounted on a breakout board. That suits my aging hands and eyes just fine!
The BMP085 uses I2C communication. But again, I've written and provided a library unit to take care of all that. There's a lot of extra info in both the BMP085 and I2C library units, so please take time to look them over.
These library units are easy to use, as you'll see. Really, all you have to do in the main code is indicate which port pins you're using and provide your altitude in meters. The units take care of everything else.
One last thing, if you scan the photo above, you'll notice that the temperature in Celsius and Fahrenheit comes along for free. Moreover, you also get the station pressure in inches-of-mercury, and the mean sea level pressure.
Click to get the source code.
Click to get the schematic PDF.
Next Project: Motion Detector