show all comments


Modeling for Internet of Things devices

September 18, 2015 15:32:58 +0300 (EEST)

I've been working a bit on the area of Internet of Things, and lately related with IoT device Thingsee. This device provides a wide variety of sensors (location, temperature, humindity, pressure, light, speed, etc.) along with wireless connectivity. For my purpose the size and complexity of the applications grew quickly so it felt natural for me that raising the level of abstraction from the code is needed. I also needed full access to device API like displays, handling multiple apps (called purposes) and linking between purposes available only in coding manually.

I've created during a weekend a language that covered most of the sensors along with code generator producing jsn code. The benefits of this become quickly visible: from a model shown below (harbor monitoring) 370 lines of code is generated to be run in the device. So far for the larger apps created over thousand lines of code is the generated.

Winter docking Internet of Things application

The video below tries to show you the idea: in 2 minutes an application for speed tracking is created and about 100 lines of code been generated.

Video on Internet of Things example

I then extended the language to cover more details and also add there features that are useful also for other purposes than for plain code generation. For example,

  • Safety issue: language warns me when creating application that is dangerous, leads to loss of property or similar (e.g. temperature is set so high that device should not be used there)
  • Language also prevents from generating apps that are illegal or incomplete (e.g. conflicting triggers, entering values for pressure, luminance etc. not possible)
  • Language also warns if something is not complete (e.g. unconnected states, no start state)

If you want to play with this language feel free to download it along with the example models (mec) and (mxs). To use it you need MetaEdit+ modeling and code generation tool, available at: After you start and login to MetaEdit+ import the .mec and .mxs files there and you should see sample apps too. Now you can start creating IoT apps pretty quickly and easily.

I included there also my applications for monitoring boat in harbor, during winter docking and while sailing. You may also freely extend the language and generator with other services and connections with other tools.