Skip to content

Commit f2c4831

Browse files
initial commit and beta release
0 parents  commit f2c4831

File tree

7 files changed

+972
-0
lines changed

7 files changed

+972
-0
lines changed

LICENSE.md

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
SparkFun License Information
2+
============================
3+
4+
SparkFun uses two different licenses for our files - one for hardware and one for code.
5+
6+
Hardware
7+
---------
8+
9+
**SparkFun hardware is released under [Creative Commons Share-alike 4.0 International](http://creativecommons.org/licenses/by-sa/4.0/).**
10+
11+
Note: This is a human-readable summary of (and not a substitute for) the [license](http://creativecommons.org/licenses/by-sa/4.0/legalcode).
12+
13+
You are free to:
14+
15+
Share — copy and redistribute the material in any medium or format
16+
Adapt — remix, transform, and build upon the material
17+
for any purpose, even commercially.
18+
The licensor cannot revoke these freedoms as long as you follow the license terms.
19+
Under the following terms:
20+
21+
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
22+
ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
23+
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
24+
Notices:
25+
26+
You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation.
27+
No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.
28+
29+
30+
Code
31+
--------
32+
33+
**SparkFun code, firmware, and software is released under the [MIT License](http://opensource.org/licenses/MIT).**
34+
35+
The MIT License (MIT)
36+
37+
Copyright (c) 2015 SparkFun Electronics
38+
39+
Permission is hereby granted, free of charge, to any person obtaining a copy
40+
of this software and associated documentation files (the "Software"), to deal
41+
in the Software without restriction, including without limitation the rights
42+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43+
copies of the Software, and to permit persons to whom the Software is
44+
furnished to do so, subject to the following conditions:
45+
46+
The above copyright notice and this permission notice shall be included in all
47+
copies or substantial portions of the Software.
48+
49+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
55+
SOFTWARE.
56+
57+

README.md

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
SparkFun <PRODUCT NAME> Arduino Library
2+
========================================
3+
4+
![SparkFun BME280 Breakout](https://cdn.sparkfun.com/assets/learn_tutorials/4/1/9/HUThumb.jpg)
5+
6+
[*SparkFun BME280 (SEN-00000)*](URL for product on Sparkfun.com)
7+
8+
This library allows the user to:
9+
10+
* Read pressure in kPa
11+
* Read temperature in C
12+
* Read humidity in %RH
13+
14+
It also provides the following mathematical functions based from the above
15+
16+
* Read temperature in F
17+
* Read altitude in meters
18+
* Read altitude in feet
19+
20+
Repository Contents
21+
-------------------
22+
23+
* **/examples** - Example sketches for the library (.ino). Run these from the Arduino IDE.
24+
* **/extras** - Additional documentation for the user. These files are ignored by the IDE.
25+
* **/src** - Source files for the library (.cpp, .h).
26+
* **keywords.txt** - Keywords from this library that will be highlighted in the Arduino IDE.
27+
* **library.properties** - General library properties for the Arduino package manager.
28+
29+
Documentation
30+
--------------
31+
32+
* **[Installing an Arduino Library Guide](https://learn.sparkfun.com/tutorials/installing-an-arduino-library)** - Basic information on how to install an Arduino library.
33+
* **[Product Repository](https://github.com/sparkfun/BME280-Breakout-Board)** - Main repository (including hardware files) for the SparkFun BME280 Breakout.
34+
* **[Hookup Guide](https://learn.sparkfun.com/tutorials/bme280-breakout-hookup-guide)** - Basic hookup guide for the SparkFun BME280 Breakout.
35+
36+
Products that use this Library
37+
---------------------------------
38+
39+
* [SEN-00000](SparkFun part URL)- Basic part and short description here
40+
41+
Version History
42+
---------------
43+
44+
* [vExxFxxZxxHxxLxxSxx](URL for tag specific to this version) - Description
45+
* [vEyyFyyZyyHyyLyySyy](URL for tag specific to this version) - Description
46+
47+
License Information
48+
-------------------
49+
50+
This product is _**open source**_!
51+
52+
Please review the LICENSE.md file for license information.
53+
54+
If you have any questions or concerns on licensing, please contact [email protected].
55+
56+
Distributed as-is; no warranty is given.
57+
58+
- Your friends at SparkFun.

examples/ReadDataI2C/ReadDataI2C.ino

+193
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
/******************************************************************************
2+
<filename>
3+
<Title>
4+
<name @ SparkFun Electronics>
5+
<original creation date>
6+
<github repository address>
7+
<multiline verbose description of file functionality>
8+
9+
This file reads and writes arbitrary values to the I2C bus, targeting the BME280
10+
11+
12+
13+
Resources:
14+
<additional library requirements>
15+
Development environment specifics:
16+
<arduino/development environment version>
17+
<hardware version>
18+
<etc>
19+
This code is released under the [MIT License](http://opensource.org/licenses/MIT).
20+
Please review the LICENSE.md file included with this example. If you have any questions
21+
or concerns with licensing, please contact [email protected].
22+
Distributed as-is; no warranty is given.
23+
******************************************************************************/
24+
25+
#include <stdint.h>
26+
#include "SparkFunBME280.h"
27+
28+
#include "Wire.h"
29+
#include "SPI.h"
30+
31+
//Global sensor object
32+
BME280 mySensor;
33+
34+
35+
float t_fine;
36+
37+
void setup()
38+
{
39+
//Tell the driver what sensor modes to use here!
40+
41+
//commInterface can be I2C_MODE or SPI_MODE
42+
mySensor.settings.commInterface = I2C_MODE;
43+
44+
//Specify chipSelectPin using arduino pin names
45+
mySensor.settings.chipSelectPin = 10;
46+
47+
//renMode can be:
48+
// 0, Sleep mode
49+
// 1 or 2, Forced mode
50+
// 3, Normal mode
51+
mySensor.settings.runMode = 3; //Forced mode
52+
53+
//tStandby can be:
54+
// 0, 0.5ms
55+
// 1, 62.5ms
56+
// 2, 125ms
57+
// 3, 250ms
58+
// 4, 500ms
59+
// 5, 1000ms
60+
// 6, 10ms
61+
// 7, 20ms
62+
mySensor.settings.tStandby = 0;
63+
64+
//filter can be off or number of FIR coefficients to use:
65+
// 0, filter off
66+
// 1, coefficients = 2
67+
// 2, coefficients = 4
68+
// 3, coefficients = 8
69+
// 4, coefficients = 16
70+
mySensor.settings.filter = 0;
71+
72+
//tempOverSample can be:
73+
// 0, skipped
74+
// 1 through 5, oversampling *1, *2, *4, *8, *16 respectively
75+
mySensor.settings.tempOverSample = 1;
76+
77+
//pressOverSample can be:
78+
// 0, skipped
79+
// 1 through 5, oversampling *1, *2, *4, *8, *16 respectively
80+
mySensor.settings.pressOverSample = 1;
81+
82+
//humidOverSample can be:
83+
// 0, skipped
84+
// 1 through 5, oversampling *1, *2, *4, *8, *16 respectively
85+
mySensor.settings.humidOverSample = 1;
86+
87+
Serial.begin(57600);
88+
Serial.print("Program Started\n");
89+
Serial.print("Starting BME280... result of .begin(): 0x");
90+
91+
//Calling .begin() causes the settings to be loaded
92+
Serial.println(mySensor.begin(), HEX);
93+
94+
//Debug chaff
95+
/*
96+
Serial.print("ID(0xD0): 0x");
97+
Serial.println(mySensor.readRegister(0xD0), HEX);
98+
Serial.print("Reset register(0xE0): 0x");
99+
Serial.println(mySensor.readRegister(0xE0), HEX);
100+
Serial.print("ctrl_meas(0xF4): 0x");
101+
Serial.println(mySensor.readRegister(0xF4), HEX);
102+
Serial.print("ctrl_hum(0xF2): 0x");
103+
Serial.println(mySensor.readRegister(0xF2), HEX);
104+
105+
Serial.println();
106+
107+
Serial.print("\nDisplaying concatenated calibration words\n");
108+
Serial.print("dig_T1, uint16: ");
109+
Serial.println(mySensor.calibration.dig_T1);
110+
Serial.print("dig_T2, int16: ");
111+
Serial.println(mySensor.calibration.dig_T2);
112+
Serial.print("dig_T3, int16: ");
113+
Serial.println(mySensor.calibration.dig_T3);
114+
115+
Serial.print("dig_P1, uint16: ");
116+
Serial.println(mySensor.calibration.dig_P1);
117+
Serial.print("dig_P2, int16: ");
118+
Serial.println(mySensor.calibration.dig_P2);
119+
Serial.print("dig_P3, int16: ");
120+
Serial.println(mySensor.calibration.dig_P3);
121+
Serial.print("dig_P4, int16: ");
122+
Serial.println(mySensor.calibration.dig_P4);
123+
Serial.print("dig_P5, int16: ");
124+
Serial.println(mySensor.calibration.dig_P5);
125+
Serial.print("dig_P6, int16: ");
126+
Serial.println(mySensor.calibration.dig_P6);
127+
Serial.print("dig_P7, int16: ");
128+
Serial.println(mySensor.calibration.dig_P7);
129+
Serial.print("dig_P8, int16: ");
130+
Serial.println(mySensor.calibration.dig_P8);
131+
Serial.print("dig_P9, int16: ");
132+
Serial.println(mySensor.calibration.dig_P9);
133+
134+
Serial.print("dig_H1, uint8: ");
135+
Serial.println(mySensor.calibration.dig_H1);
136+
Serial.print("dig_H2, int16: ");
137+
Serial.println(mySensor.calibration.dig_H2);
138+
Serial.print("dig_H3, uint8: ");
139+
Serial.println(mySensor.calibration.dig_H3);
140+
Serial.print("dig_H4, int16: ");
141+
Serial.println(mySensor.calibration.dig_H4);
142+
Serial.print("dig_H5, int16: ");
143+
Serial.println(mySensor.calibration.dig_H5);
144+
Serial.print("dig_H6, uint8: ");
145+
Serial.println(mySensor.calibration.dig_H6);
146+
*/
147+
}
148+
149+
void loop()
150+
{
151+
//Debug chaff
152+
/*
153+
Serial.print("ID: 0x");
154+
Serial.println(mySensor.readRegister(0xD0), HEX);
155+
Serial.print("Status: 0x");
156+
Serial.println(mySensor.readRegister(0xF3), HEX);
157+
Serial.print("tempMSB: 0x");
158+
Serial.println(mySensor.readRegister(BME280_TEMPERATURE_MSB_REG), HEX);
159+
Serial.print("tempLSB: 0x");
160+
Serial.println(mySensor.readRegister(BME280_TEMPERATURE_LSB_REG), HEX);
161+
Serial.print("tempXLSB: 0x");
162+
Serial.println(mySensor.readRegister(BME280_TEMPERATURE_XLSB_REG), HEX);
163+
*/
164+
165+
Serial.print("Temperature: ");
166+
Serial.print(mySensor.readTempC(), 2);
167+
Serial.println(" degrees C");
168+
169+
Serial.print("Temperature: ");
170+
Serial.print(mySensor.readTempF(), 2);
171+
Serial.println(" degrees F");
172+
173+
Serial.print("Pressure: ");
174+
Serial.print(mySensor.readFloatPressure(), 2);
175+
Serial.println(" Pa");
176+
177+
Serial.print("Altitude: ");
178+
Serial.print(mySensor.readFloatAltitudeMeters(), 2);
179+
Serial.println("m");
180+
181+
Serial.print("Altitude: ");
182+
Serial.print(mySensor.readFloatAltitudeFeet(), 2);
183+
Serial.println("ft");
184+
185+
Serial.print("%RH: ");
186+
Serial.print(mySensor.readFloatHumidity(), 2);
187+
Serial.println(" %");
188+
189+
Serial.println();
190+
191+
delay(1000);
192+
193+
}

keywords.txt

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
########################################################
2+
# Syntax Coloring Map for SparkFun LSM6DS3 IMU Library #
3+
########################################################
4+
# Class
5+
###################################################################
6+
7+
BME280 KEYWORD1
8+
9+
###################################################################
10+
# Methods and Functions
11+
###################################################################
12+
13+
begin KEYWORD2
14+
reset KEYWORD2
15+
readFloatPressure KEYWORD2
16+
readFloatAltitudeMeters KEYWORD2
17+
readFloatAltitudeFeet KEYWORD2
18+
readFloatHumidity KEYWORD2
19+
readTempC KEYWORD2
20+
readTempF KEYWORD2
21+
readRegisterRegion KEYWORD2
22+
readRegister KEYWORD2
23+
readRegisterInt16 KEYWORD2
24+
writeRegister KEYWORD2
25+
26+
###################################################################
27+
# Constants
28+
###################################################################
29+
30+
I2C_MODE LITERAL1
31+
SPI_MODE LITERAL1
32+
BME280_DIG_T1_LSB_REG LITERAL1
33+
BME280_DIG_T1_MSB_REG LITERAL1
34+
BME280_DIG_T2_LSB_REG LITERAL1
35+
BME280_DIG_T2_MSB_REG LITERAL1
36+
BME280_DIG_T3_LSB_REG LITERAL1
37+
BME280_DIG_T3_MSB_REG LITERAL1
38+
BME280_DIG_P1_LSB_REG LITERAL1
39+
BME280_DIG_P1_MSB_REG LITERAL1
40+
BME280_DIG_P2_LSB_REG LITERAL1
41+
BME280_DIG_P2_MSB_REG LITERAL1
42+
BME280_DIG_P3_LSB_REG LITERAL1
43+
BME280_DIG_P3_MSB_REG LITERAL1
44+
BME280_DIG_P4_LSB_REG LITERAL1
45+
BME280_DIG_P4_MSB_REG LITERAL1
46+
BME280_DIG_P5_LSB_REG LITERAL1
47+
BME280_DIG_P5_MSB_REG LITERAL1
48+
BME280_DIG_P6_LSB_REG LITERAL1
49+
BME280_DIG_P6_MSB_REG LITERAL1
50+
BME280_DIG_P7_LSB_REG LITERAL1
51+
BME280_DIG_P7_MSB_REG LITERAL1
52+
BME280_DIG_P8_LSB_REG LITERAL1
53+
BME280_DIG_P8_MSB_REG LITERAL1
54+
BME280_DIG_P9_LSB_REG LITERAL1
55+
BME280_DIG_P9_MSB_REG LITERAL1
56+
BME280_DIG_H1_REG LITERAL1
57+
BME280_CHIP_ID_REG LITERAL1
58+
BME280_RST_REG LITERAL1
59+
BME280_DIG_H2_LSB_REG LITERAL1
60+
BME280_DIG_H2_MSB_REG LITERAL1
61+
BME280_DIG_H3_REG LITERAL1
62+
BME280_DIG_H4_MSB_REG LITERAL1
63+
BME280_DIG_H4_LSB_REG LITERAL1
64+
BME280_DIG_H5_MSB_REG LITERAL1
65+
BME280_DIG_H6_REG LITERAL1
66+
BME280_CTRL_HUMIDITY_REG LITERAL1
67+
BME280_STAT_REG LITERAL1
68+
BME280_CTRL_MEAS_REG LITERAL1
69+
BME280_CONFIG_REG LITERAL1
70+
BME280_PRESSURE_MSB_REG LITERAL1
71+
BME280_PRESSURE_LSB_REG LITERAL1
72+
BME280_PRESSURE_XLSB_REG LITERAL1
73+
BME280_TEMPERATURE_MSB_REG LITERAL1
74+
BME280_TEMPERATURE_LSB_REG LITERAL1
75+
BME280_TEMPERATURE_XLSB_REG LITERAL1
76+
BME280_HUMIDITY_MSB_REG LITERAL1
77+
BME280_HUMIDITY_LSB_REG LITERAL1

library.properties

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name=SparkFun BME280
2+
version=0.0.1
3+
author=Marshall Taylor
4+
maintainer=SparkFun Electronics <sparkfun.com>
5+
sentence=A library to drive the Bosch BME280 Altimeter and Pressure sensor
6+
paragraph=See code for comments.
7+
category=Sensors
8+
url=https://github.com/sparkfun/SparkFun_BME280_Arduino_Library
9+
architectures=*

0 commit comments

Comments
 (0)