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:
1:fe242f3e341b
initial commit;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mitea1 0:f2815503561f 1 /**
mitea1 0:f2815503561f 2 * @file LoRaConfig.h
mitea1 0:f2815503561f 3 *
mitea1 0:f2815503561f 4 * @author Adrian
mitea1 0:f2815503561f 5 * @date Jun 11, 2016
mitea1 0:f2815503561f 6 *
mitea1 0:f2815503561f 7 */
mitea1 0:f2815503561f 8
mitea1 0:f2815503561f 9 #include <string>
mitea1 0:f2815503561f 10 #include <stdint.h>
mitea1 0:f2815503561f 11 #ifndef LORACONFIG_H_
mitea1 0:f2815503561f 12 #define LORACONFIG_H_
mitea1 0:f2815503561f 13
mitea1 0:f2815503561f 14 #define LORA_NETWORK_NAME "conduitgwy"
mitea1 0:f2815503561f 15 #define LORA_NETWORK_PASSPHRASE "conduitgwy"
mitea1 0:f2815503561f 16
mitea1 0:f2815503561f 17 #define LORA_SUBBAND_0 0
mitea1 0:f2815503561f 18 #define LORA_SUBBAND_1 1
mitea1 0:f2815503561f 19 #define LORA_SUBBAND_2 2
mitea1 0:f2815503561f 20 #define LORA_SUBBAND_3 3
mitea1 0:f2815503561f 21 #define LORA_SUBBAND_4 4
mitea1 0:f2815503561f 22 #define LORA_SUBBAND_5 5
mitea1 0:f2815503561f 23 #define LORA_SUBBAND_6 6
mitea1 0:f2815503561f 24 #define LORA_SUBBAND_7 7
mitea1 0:f2815503561f 25 #define LORA_SUBBAND_8 8
mitea1 0:f2815503561f 26
mitea1 0:f2815503561f 27 #define LORA_SPREADING_FACTOR_7 7
mitea1 0:f2815503561f 28 #define LORA_SPREADING_FACTOR_8 8
mitea1 0:f2815503561f 29 #define LORA_SPREADING_FACTOR_9 9
mitea1 0:f2815503561f 30 #define LORA_SPREADING_FACTOR_10 10
mitea1 0:f2815503561f 31 #define LORA_SPREADING_FACTOR_11 11
mitea1 0:f2815503561f 32 #define LORA_SPREADING_FACTOR_12 12
mitea1 0:f2815503561f 33
mitea1 0:f2815503561f 34 #define LORA_TX_POWER_2_DBM 2
mitea1 0:f2815503561f 35 #define LORA_TX_POWER_4_DBM 4
mitea1 0:f2815503561f 36 #define LORA_TX_POWER_8_DBM 8
mitea1 0:f2815503561f 37 #define LORA_TX_POWER_16_DBM 16
mitea1 0:f2815503561f 38 #define LORA_TX_POWER_20_DBM 20
mitea1 0:f2815503561f 39
mitea1 0:f2815503561f 40 #define LORA_ACKNOWLEDGE_RETRIES_0 0
mitea1 0:f2815503561f 41 #define LORA_ACKNOWLEDGE_RETRIES_1 1
mitea1 0:f2815503561f 42 #define LORA_ACKNOWLEDGE_RETRIES_2 2
mitea1 0:f2815503561f 43
mitea1 0:f2815503561f 44 /**
mitea1 0:f2815503561f 45 * LoRa Modes.
mitea1 0:f2815503561f 46 */
mitea1 0:f2815503561f 47 enum LORA_MODE{
mitea1 0:f2815503561f 48 LORA_MODE_0_OFF = 0,//!< LORA_MODE_0
mitea1 0:f2815503561f 49 LORA_MODE_1 = 1,//!< LORA_MODE_1
mitea1 0:f2815503561f 50 LORA_MODE_2 = 2,//!< LORA_MODE_2
mitea1 0:f2815503561f 51 LORA_MODE_3 = 3,//!< LORA_MODE_3
mitea1 0:f2815503561f 52 LORA_MODE_4 = 4,//!< LORA_MODE_4
mitea1 0:f2815503561f 53 LORA_MODE_5 = 5,//!< LORA_MODE_5
mitea1 0:f2815503561f 54 };
mitea1 0:f2815503561f 55
mitea1 0:f2815503561f 56 /**
mitea1 0:f2815503561f 57 * @class LoRaConfig
mitea1 0:f2815503561f 58 * @brief A configuration container for the LoRa Module.
mitea1 0:f2815503561f 59 * All its configuration values are stored an held inside
mitea1 0:f2815503561f 60 * this Class. Depending on the LORA_MODE it sets all the configuration values.
mitea1 0:f2815503561f 61 */
mitea1 0:f2815503561f 62 class LoRaConfig {
mitea1 0:f2815503561f 63 public:
mitea1 0:f2815503561f 64 LoRaConfig();
mitea1 0:f2815503561f 65 virtual ~LoRaConfig();
mitea1 0:f2815503561f 66
mitea1 0:f2815503561f 67 /**
mitea1 0:f2815503561f 68 * @brief Generates a configuration according to the chosen LORA_MODE
mitea1 0:f2815503561f 69 * by setting all LoRa Module specific configuration values depending on the chosen LORA_MODE
mitea1 0:f2815503561f 70 * @param desiredMode the mode to build the configuration according to
mitea1 0:f2815503561f 71 */
mitea1 0:f2815503561f 72 void build(LORA_MODE desiredMode);
mitea1 0:f2815503561f 73
mitea1 0:f2815503561f 74 /**
mitea1 0:f2815503561f 75 * @brief Gets info if the Network to which the LoRa Module sings up
mitea1 0:f2815503561f 76 * is public or not from its Configuration
mitea1 0:f2815503561f 77 */
mitea1 0:f2815503561f 78 bool isPublic();
mitea1 0:f2815503561f 79
mitea1 0:f2815503561f 80 /**
mitea1 0:f2815503561f 81 * @brief Gets info if LoRa Module will be active and run or not
mitea1 0:f2815503561f 82 * from its Configuration
mitea1 0:f2815503561f 83 * @return
mitea1 0:f2815503561f 84 */
mitea1 0:f2815503561f 85 bool isActiv();
mitea1 0:f2815503561f 86
mitea1 0:f2815503561f 87 /**
mitea1 0:f2815503561f 88 * @brief Gets the name of the Network to which the LoRa Module sings up
mitea1 0:f2815503561f 89 * from its Configuration
mitea1 0:f2815503561f 90 * @return
mitea1 0:f2815503561f 91 */
mitea1 0:f2815503561f 92 std::string getNetworkName();
mitea1 0:f2815503561f 93
mitea1 0:f2815503561f 94 /**
mitea1 0:f2815503561f 95 * @brief Gets the Passphrase of the Network to which the LoRa Module sings up
mitea1 0:f2815503561f 96 * from its Configuration
mitea1 0:f2815503561f 97 * @return
mitea1 0:f2815503561f 98 */
mitea1 0:f2815503561f 99 std::string getNetworkPassphrase();
mitea1 0:f2815503561f 100
mitea1 0:f2815503561f 101 /**
mitea1 0:f2815503561f 102 * @brief Gets the frequency SubBand that will be used by the LoRa Module to
mitea1 0:f2815503561f 103 * send and receive its data from its Configuration
mitea1 0:f2815503561f 104 * @return
mitea1 0:f2815503561f 105 */
mitea1 0:f2815503561f 106 uint8_t getFrequencySubBand();
mitea1 0:f2815503561f 107
mitea1 0:f2815503561f 108 /**
mitea1 0:f2815503561f 109 * @brief Gets the spreading Factor that the LoRa Module will us for data transmission
mitea1 0:f2815503561f 110 * from its Configuration
mitea1 0:f2815503561f 111 * @return
mitea1 0:f2815503561f 112 */
mitea1 0:f2815503561f 113 uint8_t getSpreadingFactor();
mitea1 0:f2815503561f 114
mitea1 0:f2815503561f 115 /**
mitea1 0:f2815503561f 116 * @brief Gets the transmission Power of the LoRa Module from its Configuration
mitea1 0:f2815503561f 117 * @return
mitea1 0:f2815503561f 118 */
mitea1 0:f2815503561f 119 uint8_t getTxPowerdBm();
mitea1 0:f2815503561f 120
mitea1 0:f2815503561f 121 /**
mitea1 0:f2815503561f 122 * @brief Gets the number of Acknowledgment Retries that will be made
mitea1 0:f2815503561f 123 * from its Configuration
mitea1 0:f2815503561f 124 * @return
mitea1 0:f2815503561f 125 */
mitea1 0:f2815503561f 126 uint8_t getAcknowledgeRetries();
mitea1 0:f2815503561f 127
mitea1 0:f2815503561f 128 /**
mitea1 0:f2815503561f 129 * @brief Gets the Actual LORA_MODE of the built LoRaConfiguration
mitea1 0:f2815503561f 130 * from its Configuration
mitea1 0:f2815503561f 131 * @return
mitea1 0:f2815503561f 132 */
mitea1 0:f2815503561f 133 LORA_MODE getLORA_MODE();
mitea1 0:f2815503561f 134
mitea1 0:f2815503561f 135
mitea1 0:f2815503561f 136 private:
mitea1 0:f2815503561f 137 std::string* networkName;
mitea1 0:f2815503561f 138 std::string* networkPassphrase;
mitea1 0:f2815503561f 139 bool publicity;
mitea1 0:f2815503561f 140 bool activity;
mitea1 0:f2815503561f 141 uint8_t frequencySubBand;
mitea1 0:f2815503561f 142 uint8_t spreadingFactor;
mitea1 0:f2815503561f 143 uint8_t txPowerdBm;
mitea1 0:f2815503561f 144 uint8_t acknowledgeRetries;
mitea1 0:f2815503561f 145
mitea1 0:f2815503561f 146 LORA_MODE loraMode;
mitea1 0:f2815503561f 147
mitea1 0:f2815503561f 148
mitea1 0:f2815503561f 149 /**
mitea1 0:f2815503561f 150 * @brief Sets the Network publicity of the network that will be used in the Configuration
mitea1 0:f2815503561f 151 * @param
mitea1 0:f2815503561f 152 */
mitea1 0:f2815503561f 153 void setNetworkPublicity(bool publicity);
mitea1 0:f2815503561f 154
mitea1 0:f2815503561f 155 /**
mitea1 0:f2815503561f 156 * @brief Sets the Activity of the LoRa module for the Configuration
mitea1 0:f2815503561f 157 * @param activity true = module will be active false = module will not be active
mitea1 0:f2815503561f 158 */
mitea1 0:f2815503561f 159 void setActivity(bool activity);
mitea1 0:f2815503561f 160
mitea1 0:f2815503561f 161 /**
mitea1 0:f2815503561f 162 * @brief Sets the Name of the Network that will be used in the Configuration
mitea1 0:f2815503561f 163 * @param networkName the name of the network
mitea1 0:f2815503561f 164 */
mitea1 0:f2815503561f 165 void setNetworkName(char* networkName);
mitea1 0:f2815503561f 166
mitea1 0:f2815503561f 167 /**
mitea1 0:f2815503561f 168 * @brief Sets the Passphrase of the Network that will be used in the Configuration
mitea1 0:f2815503561f 169 * @param networkPassphrase passphrase of the Network
mitea1 0:f2815503561f 170 */
mitea1 0:f2815503561f 171 void setNetworkPassphrase(char* networkPassphrase);
mitea1 0:f2815503561f 172
mitea1 0:f2815503561f 173 /**
mitea1 0:f2815503561f 174 * @brief Sets the SubBand that will be used in by the LoRa Module in the Configuration
mitea1 0:f2815503561f 175 * @param subBand the SubBand that will be used
mitea1 0:f2815503561f 176 */
mitea1 0:f2815503561f 177 void setFrequencySubBand(uint8_t subBand);
mitea1 0:f2815503561f 178
mitea1 0:f2815503561f 179 /**
mitea1 0:f2815503561f 180 * @brief Sets the spreading Factor of a LoRa Data Transmission in the Configuration
mitea1 0:f2815503561f 181 * @param spreadingFactor
mitea1 0:f2815503561f 182 */
mitea1 0:f2815503561f 183 void setSpreadingFactor(uint8_t spreadingFactor);
mitea1 0:f2815503561f 184
mitea1 0:f2815503561f 185 /**
mitea1 0:f2815503561f 186 * @brief Sets the Data transmission Power via LoRa in the Configuration
mitea1 0:f2815503561f 187 * @param
mitea1 0:f2815503561f 188 */
mitea1 0:f2815503561f 189 void setTxPowerdBm(uint8_t );
mitea1 0:f2815503561f 190
mitea1 0:f2815503561f 191 /**
mitea1 0:f2815503561f 192 * @brief Set the Acknowledgment Retries in the Configuration
mitea1 0:f2815503561f 193 * @param
mitea1 0:f2815503561f 194 */
mitea1 0:f2815503561f 195 void setAcknowledgeRetries(uint8_t);
mitea1 0:f2815503561f 196
mitea1 0:f2815503561f 197 /**
mitea1 0:f2815503561f 198 * @brief Sets the LORA_MODE of the Configuration
mitea1 0:f2815503561f 199 * @param
mitea1 0:f2815503561f 200 */
mitea1 0:f2815503561f 201 void setLORA_MODE(LORA_MODE);
mitea1 0:f2815503561f 202
mitea1 0:f2815503561f 203 };
mitea1 0:f2815503561f 204
mitea1 0:f2815503561f 205 #endif /* LORACONFIG_H_ */