A multifunctional and modular Firmware for Multitech's mDot based on ARM mBed provides a widerange of functionality for several Sensors such as MAX44009, BME280, MPU9250, SI1143 and uBlox. It allows you to quickly build a Sensornode that measures specific data with its sensors and sends it via LoRaWAN.

Dependencies:   mDot_LoRa_Sensornode_Flowmeter_impl mbed-rtos mbed

LoRa-Sensornode Firmware for Multitech mDot

A multifunctional and modular Firmware for Multitech's mDot which provides a widerange of functionality for several Sensors. It allows you to quickly build a Sensornode that measures specific data with its sensors and sends it via LoRaWAN.

/media/uploads/mitea1/logo-lora-600x370.png /media/uploads/mitea1/mt_mdot_family_642px.png

Supported Sensors

Idea

The Firmware has some predefined Application Modes running different Tasks(Measurements). Each mode can be used in a different Scenario. Application_Modes define which sensors are used, how often they aquire data and how often the data has to be sent via LoRa. Lets say you just want to measure the Light then you choose an Application_Mode (or define one) that only runs TaskLight for light measurement. As a standard all measurements are taken every second and sent via LoRa but you can change that interval depending on your usage Scenario

Committer:
mitea1
Date:
Wed Jul 06 20:40:36 2016 +0000
Revision:
0:f2815503561f
Child:
7:87cbeafdba06
initial commit;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mitea1 0:f2815503561f 1 /*
mitea1 0:f2815503561f 2 * BME280.h
mitea1 0:f2815503561f 3 *
mitea1 0:f2815503561f 4 * Created on: 18.05.2016
mitea1 0:f2815503561f 5 * Author: Adrian
mitea1 0:f2815503561f 6 */
mitea1 0:f2815503561f 7 #include <stdint.h>
mitea1 0:f2815503561f 8 #include "I2C_RT.h"
mitea1 0:f2815503561f 9 #include "BME280Config.h"
mitea1 0:f2815503561f 10
mitea1 0:f2815503561f 11 #ifndef APP_BME280_H_
mitea1 0:f2815503561f 12 #define APP_BME280_H_
mitea1 0:f2815503561f 13
mitea1 0:f2815503561f 14
mitea1 0:f2815503561f 15 #define BME280_SENSOR_ADDRESS 0b11101100 /**< Sensor address */
mitea1 0:f2815503561f 16 #define BME280_SENSOR_ID 0xD0 /**< ID of BMP280 */
mitea1 0:f2815503561f 17 #define BME280_SENSOR_RESET 0xE0 /**< Reset sensor */
mitea1 0:f2815503561f 18 #define BME280_SENSOR_CTRL_HUM 0xF2 /**< */
mitea1 0:f2815503561f 19 #define BME280_SENSOR_STATUS 0xF3 /**< */
mitea1 0:f2815503561f 20 #define BME280_SENSOR_CTRL_MEAS 0xF4 /**< */
mitea1 0:f2815503561f 21 #define BME280_SENSOR_CONFIG 0xF5 /**< */
mitea1 0:f2815503561f 22 #define BME280_SENSOR_PRESS_MSB 0xF7 /**< MSB of pressure value */
mitea1 0:f2815503561f 23 #define BME280_SENSOR_PRESS_LSB 0xF8 /**< LSB of pressure value */
mitea1 0:f2815503561f 24 #define BME280_SENSOR_PRESS_XLSB 0xF9 /**< xtra-LSB of pressure value */
mitea1 0:f2815503561f 25 #define BME280_SENSOR_TEMP_MSB 0x00FA /**< MSB of temperature value */
mitea1 0:f2815503561f 26 #define BME280_SENSOR_TEMP_LSB 0x00FB /**< LSB of temperature value */
mitea1 0:f2815503561f 27 #define BME280_SENSOR_TEMP_XLSB 0x00FC /**< xtra-LSB of temperature value */
mitea1 0:f2815503561f 28 #define BME280_SENSOR_HUM_MSB 0xFD /**< MSB of humidity value */
mitea1 0:f2815503561f 29 #define BME280_SENSOR_HUM_LSB 0xFE /**< xtra-LSB of humidity value */
mitea1 0:f2815503561f 30
mitea1 0:f2815503561f 31
mitea1 0:f2815503561f 32 #define BME280_digT1_LSB 0x88 /**< Trimming parameter for temperature */
mitea1 0:f2815503561f 33 #define BME280_digT1_MSB 0x89 /**< Trimming parameter for temperature */
mitea1 0:f2815503561f 34 #define BME280_digT2_LSB 0x8A /**< Trimming parameter for temperature */
mitea1 0:f2815503561f 35 #define BME280_digT2_MSB 0x8B /**< Trimming parameter for temperature */
mitea1 0:f2815503561f 36 #define BME280_digT3_LSB 0x8C /**< Trimming parameter for temperature */
mitea1 0:f2815503561f 37 #define BME280_digT3_MSB 0x8D /**< Trimming parameter for temperature */
mitea1 0:f2815503561f 38
mitea1 0:f2815503561f 39 #define BME280_digP1_LSB 0x8E /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 40 #define BME280_digP1_MSB 0x8F /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 41 #define BME280_digP2_LSB 0x90 /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 42 #define BME280_digP2_MSB 0x91 /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 43 #define BME280_digP3_LSB 0x92 /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 44 #define BME280_digP3_MSB 0x93 /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 45 #define BME280_digP4_LSB 0x94 /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 46 #define BME280_digP4_MSB 0x95 /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 47 #define BME280_digP5_LSB 0x96 /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 48 #define BME280_digP5_MSB 0x97 /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 49 #define BME280_digP6_LSB 0x98 /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 50 #define BME280_digP6_MSB 0x99 /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 51 #define BME280_digP7_LSB 0x9A /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 52 #define BME280_digP7_MSB 0x9B /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 53 #define BME280_digP8_LSB 0x9C /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 54 #define BME280_digP8_MSB 0x9D /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 55 #define BME280_digP9_LSB 0x9E /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 56 #define BME280_digP9_MSB 0x9F /**< Trimming parameter for pressure */
mitea1 0:f2815503561f 57
mitea1 0:f2815503561f 58 #define BME280_digH1_LSB 0xA1 /**< Trimming parameter for humidity */
mitea1 0:f2815503561f 59 #define BME280_digH2_LSB 0xE1 /**< Trimming parameter for humidity */
mitea1 0:f2815503561f 60 #define BME280_digH2_MSB 0xE2 /**< Trimming parameter for humidity */
mitea1 0:f2815503561f 61 #define BME280_digH3_LSB 0xE3 /**< Trimming parameter for humidity */
mitea1 0:f2815503561f 62 #define BME280_digH4_MSB 0xE4 /**< Trimming parameter for humidity */
mitea1 0:f2815503561f 63 #define BME280_digH4_LSB 0xE5 /**< Trimming parameter for humidity */
mitea1 0:f2815503561f 64 #define BME280_digH5_LSB 0xE6 /**< Trimming parameter for humidity */
mitea1 0:f2815503561f 65 #define BME280_digH5_MSB 0xE5 /**< Trimming parameter for humidity */
mitea1 0:f2815503561f 66 #define BME280_digH6_LSB 0xE7 /**< Trimming parameter for humidity */
mitea1 0:f2815503561f 67
mitea1 0:f2815503561f 68 class BME280 {
mitea1 0:f2815503561f 69 public:
mitea1 0:f2815503561f 70 BME280(I2C_RT*);
mitea1 0:f2815503561f 71 virtual ~BME280();
mitea1 0:f2815503561f 72 void init(BME280_MODE);
mitea1 0:f2815503561f 73 void setI2C(I2C_RT*);
mitea1 0:f2815503561f 74
mitea1 0:f2815503561f 75
mitea1 0:f2815503561f 76 /**
mitea1 0:f2815503561f 77 * @brief Gets the temperature in �C
mitea1 0:f2815503561f 78 * @return temperature in �C
mitea1 0:f2815503561f 79 */
mitea1 0:f2815503561f 80 float getTemperatureFloat();
mitea1 0:f2815503561f 81
mitea1 0:f2815503561f 82 /**
mitea1 0:f2815503561f 83 * @brief Gets the pressure in hPa
mitea1 0:f2815503561f 84 * @return pressure in hPa
mitea1 0:f2815503561f 85 */
mitea1 0:f2815503561f 86 float getPressureFloat();
mitea1 0:f2815503561f 87
mitea1 0:f2815503561f 88 /**
mitea1 0:f2815503561f 89 * @brief Gets the humidity in %
mitea1 0:f2815503561f 90 * @return humidity in %
mitea1 0:f2815503561f 91 */
mitea1 0:f2815503561f 92 float getHumidityFloat();
mitea1 0:f2815503561f 93
mitea1 0:f2815503561f 94 private:
mitea1 0:f2815503561f 95 I2C_RT* i2c;
mitea1 0:f2815503561f 96 BME280Config* config;
mitea1 0:f2815503561f 97
mitea1 0:f2815503561f 98 uint16_t digT1;
mitea1 0:f2815503561f 99 int16_t digT2;
mitea1 0:f2815503561f 100 int16_t digT3;
mitea1 0:f2815503561f 101 uint8_t digH1;
mitea1 0:f2815503561f 102 int16_t digH2;
mitea1 0:f2815503561f 103 uint8_t digH3;
mitea1 0:f2815503561f 104 int16_t digH4;
mitea1 0:f2815503561f 105 int16_t digH5;
mitea1 0:f2815503561f 106 int8_t digH6;
mitea1 0:f2815503561f 107 uint16_t digP1;
mitea1 0:f2815503561f 108 int16_t digP2;
mitea1 0:f2815503561f 109 int16_t digP3;
mitea1 0:f2815503561f 110 int16_t digP4;
mitea1 0:f2815503561f 111 int16_t digP5;
mitea1 0:f2815503561f 112 int16_t digP6;
mitea1 0:f2815503561f 113 int16_t digP7;
mitea1 0:f2815503561f 114 int16_t digP8;
mitea1 0:f2815503561f 115 int16_t digP9;
mitea1 0:f2815503561f 116
mitea1 0:f2815503561f 117 /**
mitea1 0:f2815503561f 118 * Converts a raw measured humidity value in to an exact humidity value. The algorithm
mitea1 0:f2815503561f 119 * was defined by Bosch itself
mitea1 0:f2815503561f 120 * @param humidity_raw the raw measured humidity value
mitea1 0:f2815503561f 121 * @param temperature_fine the exact temperature value
mitea1 0:f2815503561f 122 * @return an exact humidity value
mitea1 0:f2815503561f 123 */
mitea1 0:f2815503561f 124 int32_t compensateHumidity(int32_t humidity_raw, int32_t temperature_fine);
mitea1 0:f2815503561f 125
mitea1 0:f2815503561f 126 /**
mitea1 0:f2815503561f 127 * Converts a raw measured pressure value in to an exact pressure value. The algorithm
mitea1 0:f2815503561f 128 * was defined by Bosch itself
mitea1 0:f2815503561f 129 * @param pressure_raw the raw measured pressure value
mitea1 0:f2815503561f 130 * @param temperature_fine the exact temperature value
mitea1 0:f2815503561f 131 * @return an exact pressure value
mitea1 0:f2815503561f 132 */
mitea1 0:f2815503561f 133 int64_t compensatePressure(int32_t pressure_raw, int32_t temperature_fine);
mitea1 0:f2815503561f 134
mitea1 0:f2815503561f 135 /**
mitea1 0:f2815503561f 136 * Converts a raw measured temperature value in to an exact temperature value. The algorithm
mitea1 0:f2815503561f 137 * was defined by Bosch itself
mitea1 0:f2815503561f 138 * @param temperatur_raw the raw measured temperature value
mitea1 0:f2815503561f 139 * @return an exact temperature value
mitea1 0:f2815503561f 140 */
mitea1 0:f2815503561f 141 int32_t compensateTemperature(int32_t temperature_raw);
mitea1 0:f2815503561f 142
mitea1 0:f2815503561f 143
mitea1 0:f2815503561f 144 /**
mitea1 0:f2815503561f 145 * @brief Reads the trim Values that are used for calculation the exact Humidity by the compensateHumidity() Method from
mitea1 0:f2815503561f 146 * the Sensor Registers and stores them
mitea1 0:f2815503561f 147 */
mitea1 0:f2815503561f 148 void getTrimValuesHumidity();
mitea1 0:f2815503561f 149
mitea1 0:f2815503561f 150 /**
mitea1 0:f2815503561f 151 * @brief Reads the trim Values that are used for calculation the exact Pressure by the compensatePressure() Method from
mitea1 0:f2815503561f 152 * the Sensor Registers and stores them
mitea1 0:f2815503561f 153 */
mitea1 0:f2815503561f 154 void getTrimValuesPressure();
mitea1 0:f2815503561f 155
mitea1 0:f2815503561f 156 /**
mitea1 0:f2815503561f 157 * @brief Reads the trim Values that are used for calculation the exact Temperature by the compensateTemperature() Method from
mitea1 0:f2815503561f 158 * the Sensor Registers and stores them
mitea1 0:f2815503561f 159 */
mitea1 0:f2815503561f 160 void getTrimValuesTemperature();
mitea1 0:f2815503561f 161
mitea1 0:f2815503561f 162
mitea1 0:f2815503561f 163 /**
mitea1 0:f2815503561f 164 * @brief sets the Sensor in a special low Power Mode that is optimized for wheater Monitoring
mitea1 0:f2815503561f 165 */
mitea1 0:f2815503561f 166 void setWeatherMonitoringMode();
mitea1 0:f2815503561f 167
mitea1 0:f2815503561f 168 /**
mitea1 0:f2815503561f 169 * @brief sets the Oversampling for Temperature Measurements
mitea1 0:f2815503561f 170 */
mitea1 0:f2815503561f 171 void setOversamplingTemperature(uint8_t overSamplingTemperature);
mitea1 0:f2815503561f 172
mitea1 0:f2815503561f 173 /**
mitea1 0:f2815503561f 174 * @brief sets the Oversampling for Pressure Measurements
mitea1 0:f2815503561f 175 */
mitea1 0:f2815503561f 176 void setOversamplingPressure(uint8_t overSamplingPressure);
mitea1 0:f2815503561f 177
mitea1 0:f2815503561f 178 /**
mitea1 0:f2815503561f 179 * @brief sets the Oversampling for Humidity Measurements
mitea1 0:f2815503561f 180 */
mitea1 0:f2815503561f 181 void setOversamplingHumidity(uint8_t overSamplingHumidity);
mitea1 0:f2815503561f 182
mitea1 0:f2815503561f 183 /**
mitea1 0:f2815503561f 184 * @brief sets the internal Sensor Mode inside the CTRL_MEAS Register
mitea1 0:f2815503561f 185 */
mitea1 0:f2815503561f 186 void setMode(uint8_t desiredMode);
mitea1 0:f2815503561f 187
mitea1 0:f2815503561f 188
mitea1 0:f2815503561f 189 /**
mitea1 0:f2815503561f 190 * Get the raw Value of Humidity from the registers. This Value later needs to be processed
mitea1 0:f2815503561f 191 * by the compensateHumidity() Method to get the exact Humidity
mitea1 0:f2815503561f 192 * @return raw Humidity Value
mitea1 0:f2815503561f 193 */
mitea1 0:f2815503561f 194 uint32_t getHumidity();
mitea1 0:f2815503561f 195
mitea1 0:f2815503561f 196 /**
mitea1 0:f2815503561f 197 * Get the raw Value of Pressure from the registers. This Value later needs to be processed
mitea1 0:f2815503561f 198 * by the compensatePressure() Method to get the exact Pressure
mitea1 0:f2815503561f 199 * @return raw Pressure Value
mitea1 0:f2815503561f 200 */
mitea1 0:f2815503561f 201 uint32_t getPressure();
mitea1 0:f2815503561f 202
mitea1 0:f2815503561f 203 /**
mitea1 0:f2815503561f 204 * Get the raw Value of Temperature from the registers. This Value later needs to be processed
mitea1 0:f2815503561f 205 * by the compensateTemperature() Method to get the exact Temperature
mitea1 0:f2815503561f 206 * @return raw Temperature Value
mitea1 0:f2815503561f 207 */
mitea1 0:f2815503561f 208 int32_t getTemperature();
mitea1 0:f2815503561f 209
mitea1 0:f2815503561f 210 };
mitea1 0:f2815503561f 211
mitea1 0:f2815503561f 212 #endif /* APP_BME280_H_ */