The Blog

The Internet of things is a buzzword today. More and more platforms and solutions exist with different levels of complexity. In its essence a device needs to have an Internet connection and be able to receive and respond to commands in some predefined protocol.

The Wattmon device has everything required to get started with your Internet of things project. An integrated file manager, code editor and simple php compatible language makes it the ideal tool for beginners, but powerful enough to be useful for real world projectsas well.

The microchip, a pic32 chip, is an amazing little device that has 128k of RAM and 512k of flash, enough to fit the Wattmon kernel and interpreter. About 64k of ram is available to run applications once all core buffers and tasks have been allocated.

Wattmon runs on a FreeRTOS kernel and modified microchip stack. Background tasks take care of the various IO operations such as serial, modbus polling and Ethernet. A web server task handles incoming requests and spawns Interpreter tasks that produce the actual content. The uPHP interpreter was written from scratch and is designed to run with minimal RAM. It compiles code into tokens which it then writes back into a separate file on the sd card. This happens only when it detects a newer date on the original .cgi file and therefore the overhead is minimal and every task has a small token buffer making it possible to run scripts that are larger than what fit into RAM.

In addition to the web interface, a task scheduler lets you run scripts at predefined times defined in a crontab style file but with an accuracy of 1 second. Inter process communication can be achieved using the $_GLOBALS array. Multiple tasks can run in parallel and memory is automatically managed to ensure that when resources run low some scripts are paused until others complete. A script can be executed at startup to initialise the system and can either terminate or run continuously in the background.

A telnet interface allows you to log in remotely and execute scripts from the shell. Scripts run via a shell take their input from the keyboard and send their output back to the terminal allowing you to develop sophisticated applications such as a file editor similar to vi.

And that is just the core set of features. An action manager lets you configure triggers that will perform an action based on a set of conditions that can involve system variables, device variables and global variables and can even be enabled only during a certain time of the day! These triggers can then automatically perform actions such as switching on or off relay devices, setting global variables, sending an email or accessing a web page, or executing a script without writing a single line of code. The action processor runs from within the kernel, ensuring a minimal latency of up to 100ms to process.

This combination of features makes Wattmon a powerful yet easy to use multi-purpose embedded computer that I developed with purpose of managing DC energy but which has turned out to be so much more. Wattmon is more than capable of taking on the Internet of things!

Comments | Add yours
  • No comments found
Add comment