fhunleth

fhunleth

Co-author of Nerves

BMP280 - Read temperature, pressure, and more from Bosch sensors

BMP280 is a new library for communicating with Bosch temperature, pressure, and humidity sensors. These sensors are fairly easy to buy and can be found on boards that connect to Raspberry Pis, BeagleBones and similar devices without soldering.

What makes these sensors cool is that the pressure sensor is very sensitive and can detect changes of 12.5 cm (per the datasheet). It sometimes feels better than that in practice, but that’s the official number.

The problem with using the BMP280 and BME280 sensors is that the computation for converting raw measurements into usable numbers is very tedious. This library saves you that pain.

Here’s an example:

iex> {:ok, bmp} = BMP280.start_link(bus_name: "i2c-1", bus_address: 0x77)
{:ok, #PID<0.29929.0>}

iex> BMP280.read(bmp)
{:ok,
 %BMP280.Measurement{
   altitude_m: 46.60861034844783,
   humidity_rh: 50.190531261362295,
   pressure_pa: 100766.41878837062,
   temperature_c: 17.373406414553756
 }}

This was captured using a BME280 sensor so it includes a relative humidity measurement.

Altitude is computed based on the current sea level pressure at your location. The library has to be told this to give accurate altitude estimates since this varies with the weather. If you’re only interested in change in altitude, though, you can skip this step.

Most Liked

outlog

outlog

awesome!

an unrelated caveat is the confusion between the sensors, when you go and buy some, you’ll often receive the lesser bmP - even if you ordered bmE, so watch out for that..

bmE is the better one which has humidity as well..

https://i.imgur.com/jnMkxKy.png

Where Next?

Popular in Announcing Top

grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54006 488
New
Azolo
Hey everyone, I just released WebSockex which is a Elixir WebSocket client. WebSockex strives to work as a OTP special process, be RFC6...
New
josevalim
EDIT: since Ecto 3.0 final version is out, this post was amended to use the final versions in the instructions below. Hi everyone, We a...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44532 311
New
fuelen
Hey folks! Want to present a toolkit for writing command-line user interfaces. It provides a convenient interface for colorizing text...
New
trisolaran
Hi! :waving_hand: I would like to present LiveSelect, a little library that I wrote to easily add a dynamic selection input to your LV f...
198 11220 107
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54006 488
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New

We're in Beta

About us Mission Statement