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…

Where Next?

Popular in Libraries Top

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
pkrawat1
Hey guyz We at @aviabird are working on a payment library in elixir/phoenix. We are targeting March 2018 to add 56 Gateways to it. Have...
New
oltarasenko
Dear Elixir community, After a year of development, bug fixes, and improvements, we are proudly ready to share the release of Crawly 0.1...
New
nikokozak
Hello all, I’ve been working on Svonix - a library for quickly integrating Svelte components into Phoenix views. It’s a much-needed succ...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
kelvinst
Hey everyone! Well, we made this lib a while ago and now we decided to finally go out and public with it! It’s a tool for creating and m...
New
bryanjos
Hi, I just published version 0.23.0 of Elixirscript. Most of the changes are around JavaScript interop now that Elixirscript uses the ...
New
gabrielpoca
Hello everyone! I want to share with you something that I’m really proud of: https://stillstatic.io/ Still is a static site builder for...
New
bryanjos
Hi, I wanted share a small library we at Revelry Labs made for rendering react components from the server side. There are instructions fo...
New
mattludwigs
Grizzly is a library for working with Z-Wave devices. Z-Wave is a low-frequency radio protocol for controlling smart home devices on a me...
New

Other popular topics Top

lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New

Sub Categories:

We're in Beta

About us Mission Statement