Giter Club home page Giter Club logo

flashair-slibbme280's Introduction

FlashAir-SlibBME280

Lua library for BME280 environmental sensor for FlashAir.

Tested equipment

Tested on this GY-BME280 module with BME280 and FlashAir W-04 v4.00.03.

FlashAir to BME280 module connections

GY-BME280 has 10korm pull-up register for SCL, SDA, CSB.
And it has 10korm pull-down register for SD0.
So, register is not necessary.

GY-BME280 module FlashAir(Pin#) Power Memo
SD0 CLK (5) CLK pull-down in module
SCL CMD (2) SCL pull-up in module
SDA DAT0(7) SDA pull-up in module
--- DAT1(8)
--- DAT2(9)
--- DAT3(1)
CSB --- CSB pull-up in module
VCC VCC (4) 3.3V
GND VSS(3,6) GND

Install

SlibBME280.lua -- Copy to somewhere in Lua's search path.

Parameters settings

Please see the BME280 datasheet for details.

Controls the sensor mode of the device

mode Mode
0 Sleep mode
1
2
Forced mode
3 Normal mode

Controls inactive duration tstandby in normal mode

t_sb tstandby [ms]
0 0.5
1 62.5
2 125
3 250
4 500
5 1000
6 10
7 20

Controls the time constant of the IIR filter

filter Filter coefficient
0 Filter off
1 2
2 4
3 8
4
others
16

Controls oversampling of temperature data

osrs_t Temperature oversampling
0 Skipped
1 oversampling x1
2 oversampling x2
3 oversampling x4
4 oversampling x8
5
others
oversampling x16

Controls oversampling of pressure data

osrs_p Pressure oversampling
0 Skipped
1 oversampling x1
2 oversampling x2
3 oversampling x4
4 oversampling x8
5
others
oversampling x16

Controls oversampling of humidity data

osrs_h Humidity oversampling
0 Skipped
1 oversampling x1
2 oversampling x2
3 oversampling x4
4 oversampling x8
5
others
oversampling x16

Usage

If sadr is nil, it will scan the target address.
If other parameter is nil, default values is used.

command description <nil for default>
res = BME280:setup(
sadr, frq, mode, t_sb, filter, osrs_t, osrs_p, osrs_h)

or

res = BME280:setup{
sadr=xx, frq=xx, mode=xx, t_sb=xx, filter=xx,
osrs_t=xx, osrs_p=xx, osrs_h=xx}

example:
res = BME280:setup()
Setup BME280
res: Same as return value of fa.i2c().

sadr: I2C target address (7bit) <auto scan>
frq: I2C clock frequency. (45 or 100 or 189 or 40) <400>
mode: Controls the sensor mode of the device. <3>
t_sb: Controls inactive duration tstandby in normal mode. <0>
filter: Controls the time constant of the IIR filter. <4>
osrs_t: Controls oversampling of temperature data. <2>
osrs_p: Controls oversampling of pressure data. <1>
osrs_h: Controls oversampling of humidity data. <5>
res, temp, humi, pres, alti, thi =
BME280:readData( pres_sea )

example:
res, temp, humi, pres = BME280:readData()
Read environmental value
res: Same as return value of fa.i2c()
temp: temperature [DegC] (-45..85)
humi: humidity [%rH] (0..100)
pres: pressure [hPa] (300..1100)
alti: altitude [m]
thi: temperature-humidity index [%] (0..100)

pres_sea: sea-level pressure[hPa] <1013.25>

Licence

MIT

Author

GitHub/AoiSaya
Twitter ID @La_zlo

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.