Skip to content

Commit

Permalink
Initial release — version 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Rei Vilo committed Nov 12, 2016
0 parents commit 49b379c
Show file tree
Hide file tree
Showing 14 changed files with 1,643 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Weather Sensors Library

### Content

The **Weather Sensors Library** supports the

* **TMP007** infra-red thermometer,
* **OPT3001** light sensor, and
* **BME280** thermometer, barometer and hydrometer

of the [Sensors BoosterPack](http://embeddedcomputing.weebly.com/sensors-boosterpack.html).

The IMU sensors (Bosch BMI160 and BMM150) are insufficiently documented.

### External dependencies

The library requires the Wire library for the I2C bus.

### Installation

Place the `SensorWeather_Library` folder on the `Libraries` folder of the sketchbook.

### Reference

* [Texas Instruments TMP007](http://www.ti.com/product/tmp007)
* [Texas Instruments OPT3001](http://www.ti.com/product/OPT3001)
* [Bosch BME280](https://www.bosch-sensortec.com/bst/products/all_products/bme280)

### Licence

![image](https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png)

This work is licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-nc-sa/4.0/).
148 changes: 148 additions & 0 deletions examples/WeatherSensors_demo/WeatherSensors_demo.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
///
/// @mainpage WeatherSensors
///
/// @details Description of the project
/// @n
/// @n
/// @n @a Developed with [embedXcode+](http://embedXcode.weebly.com)
///
/// @author Rei Vilo
/// @author http://embeddedcomputing.weebly.com
/// @date nov. 12, 2016 19:37
/// @version <#version#>
///
/// @copyright (c) Rei Vilo, 2016
/// @copyright GNU General Public Licence
///
/// @see ReadMe.txt for references
///


///
/// @file WeatherSensors.ino
/// @brief Main sketch
///
/// @details <#details#>
/// @n @a Developed with [embedXcode+](http://embedXcode.weebly.com)
///
/// @author Rei Vilo
/// @author http://embeddedcomputing.weebly.com
/// @date nov. 12, 2016 19:37
/// @version <#version#>
///
/// @copyright (c) Rei Vilo, 2016
/// @copyright GNU General Public Licence
///
/// @see ReadMe.txt for references
/// @n
///


// Core library for code-sense - IDE-based
#if defined(ENERGIA) // LaunchPad specific
#include "Energia.h"
#else // error
#error Platform not supported
#endif // end IDE

// Set parameters
#define USE_TMP007 0
#define USE_OPT3001 1
#define USE_BME280 1

// Include application, user and local libraries
#include "Wire.h"
#include "Sensor_Units.h"


// Define variables and constants
#if (USE_TMP007 == 1)
#include "Sensor_TMP007.h"
Sensor_TMP007 myTMP007;
float TMP007_internalTemperature, TMP007_externalTemperature;
#endif

#if (USE_OPT3001 == 1)
#include "Sensor_OPT3001.h"
Sensor_OPT3001 myOPT3001;
float OPT3001_light;
#endif

#if (USE_BME280 == 1)
#include "Sensor_BME280.h"
Sensor_BME280 myBME280;
float BME280_pressure, BME280_temperature, BME280_humidity;
#endif

// Edit period_ms
const uint32_t period_ms = 10000;


// Add setup code
void setup()
{
Serial.begin(9600);
Wire.begin();

#if (USE_TMP007 == 1)
myTMP007.begin(TMP007_FOUR_SAMPLES);
myTMP007.get();
#endif

#if (USE_OPT3001 == 1)
myOPT3001.begin();
myOPT3001.get();
#endif

#if (USE_BME280 == 1)
myBME280.begin();
myBME280.get();
#endif
}

// Add loop code
void loop()
{
#if (USE_TMP007 == 1)
myTMP007.get();
TMP007_internalTemperature = conversion(myTMP007.internalTemperature(), KELVIN, CELSIUS);
TMP007_externalTemperature = conversion(myTMP007.externalTemperature(), KELVIN, CELSIUS));
Serial.print("TMP007_internalTemperature ");
Serial.print(TMP007_internalTemperature);
Serial.println(CELSIUS.symbol)

Serial.print("TMP007_externalTemperature ");
Serial.print(TMP007_externalTemperature);
Serial.println(CELSIUS.symbol)
#endif

#if (USE_OPT3001 == 1)
myOPT3001.get();
OPT3001_light = myOPT3001.light();
Serial.print("OPT3001_light ");
Serial.print(OPT3001_light);
Serial.println(LUX.symbol);
#endif

#if (USE_BME280 == 1)
myBME280.get();
BME280_pressure = myBME280.pressure();
BME280_temperature = conversion(myBME280.temperature(), KELVIN, CELSIUS);
BME280_humidity = myBME280.humidity();

Serial.print("BME280_pressure ");
Serial.print(BME280_pressure);
Serial.println(HECTOPASCAL.symbol);

Serial.print("BME280_temperature ");
Serial.print(BME280_temperature);
Serial.println(CELSIUS.symbol);

Serial.print("BME280_humidity ");
Serial.print(BME280_humidity);
Serial.println("%");
#endif

Serial.println();
delay(period_ms);
}
Binary file added extra/WeatherSensors - Reference Manual.pdf
Binary file not shown.
9 changes: 9 additions & 0 deletions library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name=Weather Sensors BoosterPack Library
version=1.0.2
author=Rei Vilo
maintainer=Rei Vilo
sentence=Library for the weather sensors of the Sensors BoosterPack
paragraph=The Weather Sensors Library supports the TMP007 infra-red thermometer, OPT3001 light sensor and BME280 thermometer, barometer and hydrometer of the Sensors BoosterPack.
category=Sensors
url=http://embeddedcomputing.weebly.com/sensors-boosterpack.html
architectures=cc3200emt,msp432,tivac,msp430
Loading

0 comments on commit 49b379c

Please sign in to comment.