Computing stuff tied to the physical world

Inside JeeMon

In Software on Apr 14, 2009 at 00:01

I thought I’d share a bit here how JeeMon works and what it’s made of.

One of the main goals for JeeMon, is that it should support two modes of operation:

  • running on a personal computer as one of many processes, launched and stopped at will
  • running on a dedicated system which is always running, possibly with quite limited resources

There is not that much difference between these two modes, but it does mean JeeMon should present itself as a webserver and that its processing demands have to be low. Being portable to different platforms also helps.

JeeMon is essentially a webserver plus database, both embedded and combined into a single process. It also contains all the logic to collect readings from – and send commands to – a JeeHub via a USB or serial port.

I picked the technology I know well, some of which I have helped develop or developed myself over the past years:

  • the code is written in two languages: Tcl on the server and JavaScript in the browser
  • the Tcl runtime uses a highly portable and self-contained system called Tclkit
  • the web server is my own design, using a highly modular Mason-like system called Mavrig
  • the embedded database is Metakit, for very compact and efficient storage of data
  • the JavaScript code uses jQuery as library to simplify many tasks
  • interactive plots are generated in the browser using the Flot package
  • the JeeMon application is packaged as a Starpack into a single installation-free runtime
  • similarly, all Tcl code, Javascript code, and website content is wrapped up into a Starkit

[more details below…]

A fully installed JeeMon configuration will contain the following files next to each other:

  • JeeMon.exe (or JeeMon-macosx, Jee-linux, etc) – this is the platform specific runtime, packaged as a Starpack. It does not contain application-specific code, other than the URL where to get the latest version of the “Jee-library” file. That little bit of app-specific code can be browsed here. It rarely changes – the latest versions of JeeMon are always online.
  • Jee-library is the actual implementation, packaged as a single file starkit. This contains the Tcl code, Javascript code, website pages, images, etc. It’s automatically downloaded from here and kept up to date by JeeMon. The full content of this file can be browsed online, as it is used to create the starkit.
  • Jee-library.update is a tiny administrative file to track the version of “Jee-library”. If you delete this file, JeeMon will stop looking for “Jee-library” updates.
  • Jee-settings.txt stores the configuration info and determines the behavior of JeeMon for this particular installation. This isn’t being used yet – it will be managed through JeeMon’s web interface, but it’s plain text so you can easily see what all the settings are.
  • Jee-database is the Metakit database. It’s actually a cache, and can be reconstructed from the raw log files and the configuration settings. The database schema is stored in one of the Tcl source files (seeĀ proc setup).

In the case of a demo installation, “Jee-database” is replaced by Jee-demodata, with content downloaded from another URL. The “Jee-demodata” file is ignored if there is a “Jee-database” file.

Both “Jee-library” and “Jee-demodata” are fetched from URLs which redirect to files in my Dropbox account.

The “Jee-library” Starkit can be inspected (and unpacked) using the SDX utility:

Picture 2.png


Apart from JeeMon, which you need to launch it all, you can delete any of these files, with predictable results:

  • if you delete “Jee-library”, JeeMon will fetch the latest version again
  • if you delete “Jee-library-update”, JeeMon will stop updating “Jee-library”
  • if you delete “Jee-settings.txt”, JeeMon will start up with default settings
  • if you delete “Jee-database”, JeeMon will fetch “Jee-demodata” and start up in demo mode

There are no other files, unless specifically configured through the web interface. For an active setup, you will need to specify a directory where the log files with readings obtained from the JeeHub are saved, for example. As well as other minor details, such as how to connect to the JeeHub to collect data …

There is no installation.There are no registry settings, hidden files, etc. Remove all the above and JeeMon is gone from your system.

You can probably tell that I don’t like systems which take over your machine …

There are some nice software development features, such as being able to piggy-back one JeeMon system on another through “Tequila” – this lets me run a permanent JeeHub + MMnet1001 setup, while testing and developing JeeMon itself on my own laptop as if it were connected directly to the central JeeNode. The other one I couldn’t live without anymore, is Mavrig’s ability to automatically pick up code changes in a running JeeMon process by simply doing a refresh in the browser.

Anyway. I don’t actually expect anyone to dive into all this, but that’s how JeeMon is made and how it is set up to work. On Windows, Mac OS X, Linux, embedded – whatever!

  1. Apologies for messing up the “[more…]” link. Should be ok now.

Comments are closed.