mDot LoRa Sensornode Firmware based on ARM mBed
I’ve developed 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 specific Sensornode that measures specific data with its sensors and sends it via LoRaWAN
Supported Sensors are:
- MAX44009 (Light)
- BME280 (Temperature,Humidity,Pressure)
- MPU9250 (Acceleration,Gyroscop,Magnetometer)
- SI1143 (Proximity)
- uBlox M8Q (GPS)
for more detailed Information and the whole Firmware visit mBed Project Page
Firmware might be interesting for quick “proof of concept” and people who would like to have a Codefoundation to build their own Sensornode using Multitech mDot.
The Firmware provides a basic set of Functionality which can be used and adapted by the user.
Theres also a doxygen Documentation documenting the whole Firmware.
The Firmware is tested and will be optimized and extended in the Future. Also the Documentation for the Firmware will be extended in the Future.
If anybody has Questions, Ideas, Additions or Critique about the Firmware just let me know.
3 Likes
This is awesome! Will definitely take a deeper look into this project. Thanks for sharing it!
Glad you like it ! Would appreciate your feedback.
Do you take into account deep sleeping in your FW?
At the actual stage of the Firmware not. But it’s something I want to implement soon. At the moment I don’t have the possibility to change the code and test it on the mDot Hardware.
But it’s very easy to implement at this stage by your own.
Inside the start() Method of each Task-Class after their thread member objects are built call thread.attach_idle_hook(NULL).
In rtos_idle.c inside default_idle_hook(void) function write deepsleep() instead of sleep().
As you might see sleep() is already inside default_idle_hook(void) but I forgot to declare the default_idle_hook of each thread object thats wrapped by the Task-Classes.
halfbrain… AMAZING Work…
Q:
a) Where do we configure ‘Application_Modes’?
b) I will build one with these three sensors…
b1) MAX44009
b2) BME280
b3) MPU9250
What configuration options should be created?
Thank you in advance…
Hi skramer,
I added some information to the Application Mode Wiki
Hope this will help you.
General Idea was the seperation of each measurement into different Tasks. And the APPLICATION_MODE is just an abstraction tool that defines wich measurements will be taken.
Depends on what are you planning to measure with this sensors
Lets say you want to measure Acceleration,Gyroscope and Telsa with the MPU9250 then make sure that the ApplicationConfig::build() sets the States of the TaskAcceleration, TaskGyroscope and TaskTesla RUNNING. How you should do that is explained in the Application Mode Wiki I linked above.
Let me know if that helped you.
Yes your wiki is wonderful… Sorry I did not think to look there as most do not take the time to provide
documentation as you have … Thank you … so very nice…
Ok now I have in stock a Adafruit Ultimate GPS Breakout based on MTK339
and would like to use it in place of the uBlox M8Q
It seems there are MTK339 Libraries available for mBed . …
and (I think,looks like, set me straight if otherwise… smiles…) it uses the same pin connections.
A basic library for the Adafruit Ultimate GPS module. (MTK3339) http://www.adafruit.com/products/746
How might one go about adding this MTK3339 to your Firmware… ?
I took a look into the code. It seems as if you can choose the tx and rx pin for serial communication by yourself. So i would say yes you can connect them to the same serial rx and tx pins as I connected the uBlox.
I don’t know how experienced you are at programming.
One way to include your code and keep my structure would be to wrap your codes functions with my uBlox functions.
Lets say you have a function that returns you the Latitude then you wrap it with my uBlox::getLatitude().
float uBlox::getLatitude(){ return (float) yourGps.getLatitude(); }
and so on for other functionality. You would at least need to implement getLongitude() and getLatidude() as these are the ones that I use inside my TaskGPS. Afterwards you could refactor uBlox Name to yourGps for a clean looking Code.
But one problem might be that the library you mentioned not uses any interrupts when receiving data. So I assume it will block other Task the whole Time because it’s waiting for new Data.
Other possibility would be to create your own new TaskGPS using the same scheme I coded my Tasks. But this would be much more work for you as you would have to change a Lot more. I don’t recommend you this way.
But I can’t guarantee 100% that your Library will work with my Firmware because I’m not able to test it.
You mentioned you will use MAX44009 BME280 MPU9250. If you have one of this in Stock I recommend you to start with them. Connenct them to the mDot and play a little bit with my Firmware to get familiar with it. If you like it and get an understanding of using it I would recommend you to buy the uBlox M8Q. It cost you something but you won’t have a Lot of additional work.
It often is better to start with things that work and get familiar with the code before adding new stuff because it’s often the details that generates a lot of additional work and pain
Makes perfectly good sense to save the time and purchase the ‘supported’ item when the ‘unsupported’ items fate is unknown.
I am taking your recommendation and purchasing the exact model uBlox in your writeup.
Thank you!
@Halfbrain I am starting to put together a node based on your Firmware.
I have mDot in mDot develpment board with BME280
I set your code to APPLICATION_MODE_3
I have compiled and added to mDot
When I run I get an error:
“RTC error: RTC initialization failed.”
Then I remove the BME280 and add in the MPU9250
Change the code to APPLICATION_MODE_5
and compile
When running I get the same error “RTC error: RTC initialization failed”
hmmmm What do you think?
What might the issue be?
@skramer I assume you only changed the APPLICATION_MODE Parameter of the Application.init() function and are using the mDot-udk? I never used the mDot-udk but i don’t think thats a problem.
Did you also take a Look at this wiki
The chosen Application_Modes you mentioned looks good this also shouldn’t be the Problem.
I googled and found this Post about the same issue. It seems like it’s a problem of Multitechs mDot Library thats used.
One writes:
This error seems to come and go in different builds. I haven’t been able to track it down.
Only started happening after I did some updates to the mdot, mbed libmdot libraries
Another guy suggests:
I have seen it as well occasionally after flashing the unit with new firmware. A power cycle rather than reset will allow the RTC to be initialized.
Hope this will help you.
It’s strange I cant remeber getting the same error.
Another great thing (Tool) that helped me sometimes if I had problems with the mDot is the STM32 ST-Link Utility
With this Tool you are able to properly erease the whole Flash-Memory where the Firmware is saved. I had some problems when this helped me. Just connect your mDot with the UDK USB port to your Computer open the ST-Link Utility and press Full Chip Erease. After that compile again.
I’ve been involved with developing something similar for mDot but the code is not yet freely available and is still having its ‘killer features’ developed. It also uses the BME280 Adafruit module which is really good, but a little expensive in this form, the Adafruit Ultimate GPS module, DS18B20 temperature probe, DHT22 temp/humidity module for a cheaper solution to the BME280, option for water quality probes, soil moisture, people counting and air quality.
This is all on a compact custom designed PCB that fits into a number of different enclosures depending on the application being used.
I have found there are issues with the mDots getting corrupted flash chips that may stop things working. The fix requires the flash chip to be erased via the bootloader and the UID being reset using a custom firmware image provided by Multitech.
Cheers
Andrew
As you mentioned it sounds familiar for me. I remeber having a Problem with the mDot-EVB running some Code. After I ereased the Flash and loaded the AT_Command-Firmware to the mDot I was able to put my Code on it.
Thank you This was resolved with a fresh download and install of sensornode…
1 Like
Thanks for project.
Looks very interesting. This project open? Can i download deisgn files (sch/brd) ?
Thanks in advance
Mitek
Hi Mitek,
I dont know if I have the rights to publish design files but I will check that.
But basically it’s not very hard to connect the Sensors to the mDot as you see in my Installation of the Sensor Wiki
Firmware Update:
I’ve added OTAA join mode possibility to the Firmware. It’s now possible to connect to the Network via ABP or OTAA depending on the chosen LORA_MODE.
For detailed Information about Join Mode possibilities and LORA_MODES in general take a Look at my LoRa Wiki Page
I compile and see 250 warnings. It’s normal ?
Also after Update All to latest version project not compile with error. Look strange.
The Code should be able to compile and run even if there are some warnings. You were able to compile and run the code on your mDot?
I took a deeper look into the warnings and made some housekeeping to eliminate them. I’ve uploaded my newest version wich compiles in my mBed Compiler without any Error.