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

Revision:
0:f2815503561f
Child:
4:2674bd4168f8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/TaskLoRaMeasurement.cpp	Wed Jul 06 20:40:36 2016 +0000
@@ -0,0 +1,94 @@
+/**
+ * @file TaskLoRaMeasurement.cpp
+ *
+ * @author Adrian
+ * @date 13.06.2016
+ */
+
+#include "TaskLoRaMeasurement.h"
+
+TaskLoRaMeasurement::TaskLoRaMeasurement(LoRa* lora,Mutex* mutexLoRa,
+		Queue<LoRaMeasurementMessage,LORA_MEASUREMENT_QUEUE_LENGHT>* queue){
+	this->lora = lora;
+	setMutex(mutexLoRa);
+	setQueue(queue);
+}
+
+TaskLoRaMeasurement::TaskLoRaMeasurement(LoRa* lora,Mutex* mutexLoRa,
+		rtos::Queue<LoRaMeasurementMessage,LORA_MEASUREMENT_QUEUE_LENGHT>* queue,
+		osPriority priority, uint32_t stackSize, unsigned char *stackPointer){
+	setPriority(priority);
+	setStackSize(stackSize);
+	setStackPointer(stackPointer);
+	setState(SLEEPING);
+}
+
+TaskLoRaMeasurement::~TaskLoRaMeasurement() {
+	// TODO Auto-generated destructor stub
+}
+
+osStatus TaskLoRaMeasurement::start(){
+	setState(RUNNING);
+	this->thread = new rtos::Thread(callBack,this);
+}
+
+osStatus TaskLoRaMeasurement::stop(){
+	thread->terminate();
+	setState(SLEEPING);
+	delete this->thread;
+}
+
+void TaskLoRaMeasurement::callBack(void const* data){
+	// WOODHAMMER METHOD of Casting!
+	const TaskLoRaMeasurement* constInstance = static_cast<const TaskLoRaMeasurement* >(data);
+	TaskLoRaMeasurement* instance = const_cast<TaskLoRaMeasurement*>(constInstance);
+
+	instance->measureSignal();
+}
+
+void TaskLoRaMeasurement::measureSignal(){
+	LoRaMeasurementMessage* loraMeasurementMessage = new LoRaMeasurementMessage();
+
+	while(true){
+		mutexLoRa->lock(osWaitForever);
+		loraMeasurementMessage->setRssi(lora->getLastRssi());
+		loraMeasurementMessage->setSnr(lora->getLastSnr());
+		loraMeasurementMessage->setSpreadingFactor(lora->getSpreadingFactor());
+		loraMeasurementMessage->setTxPowerdBm(lora->getTxPowerdBm());
+		mutexLoRa->unlock();
+
+		queue->put(loraMeasurementMessage,osWaitForever);
+		osDelay(LORA_MEASUREMENT_TASK_DELAY_MS);
+	}
+
+
+}
+
+void TaskLoRaMeasurement::setQueue(Queue<LoRaMeasurementMessage,LORA_MEASUREMENT_QUEUE_LENGHT>* queue){
+	this->queue = queue;
+}
+
+void TaskLoRaMeasurement::setMutex(Mutex* mutex){
+	this->mutexLoRa = mutex;
+}
+
+void TaskLoRaMeasurement::setPriority(osPriority priority){
+	this->priority = priority;
+}
+
+void TaskLoRaMeasurement::setStackSize(uint32_t stacksize){
+	this->stack_size = stacksize;
+}
+
+void TaskLoRaMeasurement::setStackPointer(unsigned char* stackPointer){
+	this->stack_pointer = stackPointer;
+}
+
+void TaskLoRaMeasurement::setState(TASK_STATE state){
+	this->state = state;
+}
+
+TASK_STATE TaskLoRaMeasurement::getState(){
+	return state;
+}
+