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.
Supported Sensors
- MAX44009 (Lux Measurment) http://www.ebay.ie/itm/MAX44009-Ambient-Light-Sensor-Module-for-Arduino-with-4P-Pin-Header-/381676089124?hash=item58ddaaef24:g:-ecAAOSwzJ5XZm5E
- BME280 (Temperature, Pressure and Humdity Measurment) At the moment there are some known problem using this. https://www.adafruit.com/product/2652 https://www.amazon.com/Diymall-Pressure-Temperature-Sensor-Arduino/dp/B0118XCKTG
- MPU9250 (Acceleration, Gyroscope and Magnetometer) http://www.watterott.com/de/9-DOF-IMU-Module-With-MPU-9250
- Si1143 (Proximity up to 50cm) https://moderndevice.com/product/si1143-proximity-sensors/
- uBlox M8Q (GPS Position) http://www.dx.com/de/p/gygpsv3-m8n-u-blox-neo-m8n-001-flight-controller-gps-module-blue-394557#.V4lFW-uLRhE
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
Diff: app/Application.cpp
- Revision:
- 9:c4e378f4801d
- Parent:
- 7:87cbeafdba06
--- a/app/Application.cpp Tue Nov 01 19:42:40 2016 +0000 +++ b/app/Application.cpp Fri Nov 02 16:58:23 2018 +0000 @@ -74,15 +74,15 @@ if(taskGps->getState() == RUNNING){ taskGps->stop(); } + if(taskFlowMeter->getState() == RUNNING){ + taskFlowMeter->stop(); + } if(taskLoRaMeasurement->getState() == RUNNING){ taskLoRaMeasurement->stop(); } if(taskDataHandler->getState() == RUNNING){ taskDataHandler->stop(); } - if(taskCommandHandler->getState() == RUNNING){ - taskCommandHandler->stop(); - } osDelay(100); } @@ -91,6 +91,7 @@ uart = new RawSerial(XBEE_DOUT,XBEE_DIN); debugSerial = new RawSerial(USBTX,USBRX); i2c_rt = new I2C_RT(); + pulseInput = new InterruptIn(XBEE_DIO0); dot = mDot::getInstance(); lora = new LoRa(dot,debugSerial); @@ -106,6 +107,7 @@ bme280 = new BME280(i2c_rt); mpu9250 = new MPU9250(i2c_rt); si1143 = new SI1143(i2c_rt); + flowMeter = new FlowMeter(pulseInput); } void Application::initTasks(){ @@ -118,11 +120,10 @@ taskTesla = new TaskTesla(mpu9250,mutexI2C,&queueTesla,osPriorityNormal,DEFAULT_STACK_SIZE,NULL); taskProximity = new TaskProximity(si1143,mutexI2C,&queueProximity,osPriorityNormal,DEFAULT_STACK_SIZE,NULL); taskGps = new TaskGPS(gpsSensor,mutexUART1,&queueGps,osPriorityNormal,DEFAULT_STACK_SIZE,NULL); + taskFlowMeter = new TaskFlowMeter(flowMeter,mutexFlowMeter, &queueFlowMeter, osPriorityNormal,DEFAULT_STACK_SIZE, NULL); taskLoRaMeasurement = new TaskLoRaMeasurement(lora,mutexLoRa,&queueLoRaMeasurements,osPriorityNormal,DEFAULT_STACK_SIZE,NULL); taskDataHandler = new TaskDatahandler(lora,mutexLoRa,queueBundle,osPriorityNormal,DEFAULT_STACK_SIZE,NULL); - taskCommandHandler = new TaskCommandHandler(&queueCommands,osPriorityNormal,DEFAULT_STACK_SIZE,NULL); taskDataHandler->setDebugSerial(debugSerial); - taskCommandHandler->setDebugSerial(debugSerial); } void Application::startRunnableSensorTasks(){ @@ -153,20 +154,23 @@ if(config->getStateTaskGPS() == RUNNING){ taskGps->start(); } + if(config->getStateTaskFlowMeter() == RUNNING){ + taskFlowMeter->start(); + } if(config->getStateTaskLoRaMeasurement() == RUNNING){ taskLoRaMeasurement->start(); } taskDataHandler->start(); - taskCommandHandler->start(); } void Application::configureSensors(){ max44009->init(config->getMAX44009_MODE()); bme280->init(config->getBME280_MODE()); mpu9250->init(config->getMPU9250_MODE()); -// si1143->init(config->getSI1143_MODE()); + //si1143->init(config->getSI1143_MODE()); gpsSensor->init(config->getuBlox_MODE()); + //todo configure FlowMeter } void Application::configureLora(){ @@ -177,6 +181,7 @@ this->mutexI2C = new Mutex(); this->mutexUART1 = new Mutex(); this->mutexLoRa = new Mutex(); + this->mutexFlowMeter = new Mutex(); } void Application::initApplicationConfig(){ @@ -195,4 +200,5 @@ this->queueBundle.queueProximity = &queueProximity; this->queueBundle.queueTemperature = &queueTemperature; this->queueBundle.queueTesla = &queueTesla; + this->queueBundle.queueFlowMeter = &queueFlowMeter; }