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

scohen
Lexical Lexical is a next-generation language server for the Elixir programming language. Features Context aware code completion As-you...
New
RobertDober
Earmark is a pure-Elixir Markdown converter. It is intended to be used as a library (just call Earmark.as_html), but can also be used as...
239 11851 134
New
kevinlang
Hey all, We have made an Ecto3 Adapter for SQLite3, ecto_sqlite3! We have successfully on-boarded the full suite of integration tests (...
New
dbern
I’m excited to announce that TaxJar has developed and open-sourced DateTimeParser. We developed it because we found a need to parse user ...
New
martinthenth
Hello everybody :wave: Recently, some of my colleagues talked about database ids and uuids and their problems, and I remembered the pain...
New
tmbb
PhoenixWS - Websockets over Phoenix Channels Source code on Github here: https://github.com/tmbb/phoenix_ws Phoenix channels are a great...
New
Crowdhailer
Experimenting with this code. OK.try do user &lt;- fetch_user(1) cart &lt;- fetch_cart(1) order = checkout(cart, user) save_or...
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
Hal9000
Here is my first stab at this. README pasted below. https://github.com/Hal9000/elixir_random Comments and critiques are welcome. Th...
New
versilov
Could not wait for the missing Elixir ML libraries to appear, so, I wrote one myself, taking https://github.com/sdwolfz/exlearn as a foun...
New

Other popular topics Top

srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
Tee
can someone please explain to me how Enum.reduce works with maps
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 record...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
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
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
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

Sub Categories:

We're in Beta

About us Mission Statement