$13.95

Now mounted on a breakout board, the MPL115A1 is a digital barometer that uses MEMs technology to give accurate pressure measurements between 50kPa and 115kPa. We stock the SPI interface version of the sensor. Average current consumption is 10µA at one measurement per second.

The sensor outputs both temperature and pressure readings on the SPI bus. See page 3 of the datasheet for information on how to take readings from the pressure sensor.

Sample Arduino code

Core Skill: Soldering

This skill defines how difficult the soldering is on a particular product. It might be a couple simple solder joints, or require special reflow tools.

1Soldering

Skill Level: Noob - Some basic soldering is required, but it is limited to a just a few pins, basic through-hole soldering, and couple (if any) polarized components. A basic soldering iron is all you should need.
See all skill levels

Core Skill: Programming

If a board needs code or communicates somehow, you're going to need to know how to program or interface with it. The programming skill is all about communication and code.

3Programming

Skill Level: Competent - The toolchain for programming is a bit more complex and will examples may not be explicitly provided for you. You will be required to have a fundamental knowledge of programming and be required to provide your own code. You may need to modify existing libraries or code to work with your specific hardware. Sensor and hardware interfaces will be SPI or I2C.
See all skill levels

Core Skill: Electrical Prototyping

If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.

1Electrical Prototyping

Skill Level: Noob - You don't need to reference a datasheet, but you will need to know basic power requirements.
See all skill levels

NEGATIVE TEMPERATURE ERROR?
I can’t for the life of me work out how nobody has reported this?
On my MPL115A1 device, when the temperature goes over 25 degrees c, the computeTemperature() function in all Arduino examples I have found) returns a negative temperature like “-12222.4 degrees. (and some people can’t understand why I hate ‘C’).
The offending code is the last line of that function, where it computes the return value:return 25 + (uiTadc - 472) / -5.35;
The error occurs because the Arduino processes ‘part’ of the above using integer arithmetic and when the ADC crosses the 472 constant the ‘sign’ inverts. The compiler is probably getting confused because ‘uiTadc’ is an unsigned int.THE FIX: Simply add a ”.0" (decimal point zero) after the 472 constant, this forces it to be computed as a float, so that when we multiply it by ‘-5.35’, ‘C’ doesn’t choke on it and sprurt out it’s breakfast. I also added additional brackets as shown below, though probably not needed.return 25 + ((uiTadc - 472.0) / -5.35);
Once I did that, I got more stable results when below 25c and correct (i.e. positive) results above 25c.
I found I needed to tweak the function to improve the accuracy. I calibrated it by printing out the ADC count (uiTadc) at two known temperatures, and with a simple Excel spreadsheet, I found the following was perfect for my chip:return 25 + ((uiTadc - 498.0) / -5.35);
I’m running this on a Mega-2560, there may possibly be a bug in the Mega core which might explain why nobody has reported this already?
Hope this saves somebody from ripping out their last few sprigs of hair, like I did!!!
Cheers,
Paul Taylor {Affordable Technology - Perth}

There might possibly be an issue with the included header file in the example code. The registers seem to be defined incorrectly. Every address is 2x the address it should be. For example, according to the Freescale Semiconductor datasheet, the MSB of the a0 register is 0x04. The header file defines it as 0x08. Could somebody either confirm or correct me?

I purchased this version and I am having trouble making it work (Talk) SPI. The chip has M1PR written on it. Does that actually translate to MPL115A1? The datasheet is not useful. Why not post a current one from freescale?
http://cache.freescale.com/files/sensors/doc/data_sheet/MPL115A1.pdf?fsrch=1&sr=1

Miah- thanks for posting that example code, as I think most people here will agree that the C code provided with the product under ‘example code’ is pretty awful to read. However that link now appears to be dead. I have been unable to find a good Arduino example, even pure C would do fine as long as it’s readable. Anybody able to hook me up?

the line above is indicative of extremely poor coding. instead of a floating point division by a constant, that could have easily been turned into a multiplication saving some precious cycles. instead of dividing by (-5.35) the code should multiply by (-0.187).

The comment above is indicative of extremely poor development practices. Most compilers these days are good enough to automatically optimize things like that. Code is meant for humans to read. Legibility first. Avoid unnecessary optimizations (especially when the compiler does a better job than you can anyways), and only optimize based on measurements, not preemptively.

did i hit a nerve or something? you seem to have no clue how many hours programmers spend coding in assembly to ensure a higher degree of determinism because they cannot rely on the compiler to do the trick. the worst approach to embedded programming is to assume that “the compiler knows best and does a better job than ‘you’ can anyway”, and if you do not believe that just read a few lines how the compiler can get confused when you declare uiTadc as unsigned. in addition, this code is meant to be portable, you do not know what compiler people are gonna use, the “most compilers” approach does not cut it. code is meant for programmers to read, not for humans. when you code you would assume that your target audience is another programmer, unlike what your CS101 java teacher is preaching.

Customer Reviews

5 out of 5

It works

The item arrived on time, and was perfectly functional. I coupled it with MSP430G2553 and they communicate effortlessly with the SPI protocol. My only criticism would be that the highest pressure limit is a bit low, but the item performs exactly as it states on the label.

A quality product and easy to use

The MPL115A1 is quite easy to hook up to an Arduino Uno, and the example code makes reading the data quite reasonable. Even more surprising to me was that the pressure values returned by the device almost exactly match the readings we get from a carefully corrected mercury barometer. The datasheet says it should be that accurate, but I was a little skeptical. It is a good sensor for use in recording the weather.

In 2003, CU student Nate Seidle fried a power supply in his dorm room and, in lieu of a way to order easy replacements, decided to start his own company. Since then, SparkFun has been committed to sustainably helping our world achieve electronics literacy from our headquarters in Boulder, Colorado.

No matter your vision, SparkFun's products and resources are designed to make the world of electronics more accessible. In addition to over 2,000 open source components and widgets, SparkFun offers curriculum, training and online tutorials designed to help demystify the wonderful world of embedded electronics. We're here to help you start something.