Giter Club home page Giter Club logo

hello_bmp280's Introduction

Hello BMP280

This example demonstrates how to read temperature data from the BMP280 temperature sensor board. We will use I2C protocol to connect a sensor board to our Nerves target device (e.g., Raspbery Pi).

Nerves target

The explanation below assumes a Raspberry Pi Zero W as a target device but other Nerves targets should work as well.

Sensor board

The Bosch BMP280 sensor itself is so tiny that it might be difficult to handle but some electronics components manufactureres mount it on a breakout board for our convenience, which is what we look for. Do Google search by "BMP280 breakout board" and you will find something like Adafruit BMP280 Sensor board.

You can alternatively use BME280 or BME680 since the elixir-sensors/bmp280 library supports them.

Wiring

Roughly speaking, there are typically two ways to hook up a sensor to our Nerves target.

A: Pin header

If you already have a soldering iron and enjoy using it, this is the go-to option. Even if you have not already, soldering can be fun. This option only requires a pin header and 4 jumper wires

I2C protocol uses 4 pins. It is confusing but different products may name the pins differently.

Target (I2C controller) Sensor (I2C peripheral) Description
3.3V Vin power
GND GND common ground for power and logic
I2C SDA (GPIO 2) SDA I2C data
I2C SCL (GPIO 3) SCL I2C clock

B: Qwiic Connect System etc

Taking advantage of Qwiic Connect System or similar system, we can remove the need for the soldering. One tradeoff is that we need to get an extra board like Qwiic HAT for Raspberry Pi and special wires.

How to use this repository

Please see the main Nerves installation docs if you haven't used Nerves before.

Go to the hello_bmp280 directory

cd hello_bmp280

Set up your build environment

Specify the Nerves target hardware.

export MIX_TARGET=rpi0

Specify the WiFi name and password in order to hard-code WiFi credentials in the firmware.

export WIFI_SSID=your_wifi_name
export WIFI_PSK=your_wifi_password

If you do not have WiFi available, you can alternatively connect the target board to your host machine (e.g., your laptop) using a USB cable.

Install dependencies

mix deps.get

build firmware

mix firmware

burn firmware to an SD card

mix firmware.burn

Insert the SD card into your target board and power up

Wait for the target board to finish booting

SSH into the target board

ssh nerves.local

Once you shell into your target board, you can play around with the elixir-sensors/bmp280 library.

Learn more

hello_bmp280's People

Contributors

mnishiguchi avatar

Stargazers

Frank Hunleth avatar

Watchers

 avatar

Forkers

layeddie

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.