EDGE Technology EDGE Components

System Requirements

Device Operating System Linux
Device CPU Architectures ARM, X86 (both 32 and 64-bit)
Memory Recommended: 256 MB RAM, 64 MB Flash (64 MB RAM without JavaScript engine)
Network Ethernet or Wi-Fi, Cellular
Compiler Toolchain (C++14 required) GCC 5.0 or newer, Clang 3.4 or newer
Host Operating System Linux or macOS


Web User Interface EDGE comes with a built-in web server providing different web apps for device management, testing and getting started with JavaScript development. These can be modified or replaced with a device-specific interface and apps. In any case, the web server is just another plug-in, so it can even be removed entirely if not needed.



Sensors and other devices are presented as services that can be searched for based on various properties. In the following sample, we look for an ambient light (luminance) and a temperature sensor. The code that looks for sensors is implemented as a module and can be imported using the familiar require() function.

const sensors = {};

const ambientLightRefs = serviceRegistry.find('io.macchina.physicalQuantity == "luminance"');
if (ambientLightRefs.length > 0)
    sensors.ambientLight = ambientLightRefs[0].instance();
    logger.information('Ambient Light: %s', sensors.ambientLight.getPropertyString('name'));

const temperatureRefs = serviceRegistry.find('io.macchina.physicalQuantity == "temperature"');
if (temperatureRefs.length > 0)
    sensors.temperature = temperatureRefs[0].instance();
    logger.information('Temperature: %s', sensors.temperature.getPropertyString('name'));

module.exports = sensors;


Once we have a sensor object, we can get a callback whenever the measured value changes. In the following example, we write the current sensor value into a SQLite database, together with a timestamp.

var data = require('data');
const sensors = require('sensors.js');

const dbPath = application.config.getString('datalogger.database');
const dbSession = new data.DBSession('SQLite', dbPath);

sensors.temperature.on('valueChanged', event => {
        dbSession.execute('INSERT INTO datalog VALUES (?, ?)',

Serial Port

Many devices provide a serial (UART) interface and support a simple text-based protocol. It's easy to process data received from such devices.

var serial = null;
const serialRef = serviceRegistry.findByName('io.macchina.serialport#0');
if (serialRef)
    serial = serialRef.instance();
    logger.notice('SerialDevice found: %s', serial.getPropertyString("device"));

serial.setFeature('events', true);
serial.setPropertyString('delimiters', '\n');
serial.setPropertyDouble('timeout', 0.1);
serial.on('lineReceived', (line) => {
        logger.notice('Received: %s',;

Cloud Services

The following example shows how to send data to a cloud service providing a REST interface. We periodically obtain temperature and ambient light measurements and send them to the AirVantage M2M Cloud service.

const net = require('net');
const sensors = require('sensors.js');

const username = application.config.getString("airvantage.username");
const password = application.config.getString("airvantage.password");

        const httpRequest = new net.HTTPRequest('POST', '');
        const epoch = 1000*DateTime().epoch; // seconds to milliseconds
        httpRequest.timeout = 10.0;
        httpRequest.authenticate(username, password);
        httpRequest.content = JSON.stringify(
                                "timestamp": epoch,
                                "value": sensors.temperature.value()
                                "timestamp": epoch,
                                "value": sensors.ambientLight.value()
        const httpResponse = httpRequest.send();
        if (httpResponse.status != 200)
            logger.error('Failed sending data to AirVantage: %s', httpResponse.reason);

The above sample blocks in send() until the HTTP request has been completed. HTTP requests can also be sent asynchronously. In this case, a callback function will be called when the request has completed.

// ...
            function (result)
                if (result.error)
                else if (result.response.status != 200)
                    logger.error('HTTP request failed: %s', result.response.reason);
        // ...


The following example shows how to implement a servlet in JavaScript that reads sensor data from the SQLite database and formats it as JSON.

const data = require('data');

const dbPath = application.config.getString('logger.database');
const dbSession = new data.DBSession('SQLite', dbPath);
dbSession.pageSize = 20;

const recordSet = dbSession.execute('SELECT timestamp, temperature FROM datalog ORDER BY timestamp DESC');
response.contentType = 'application/json';

Get Started with EDGE

Get started with EDGE by running the Docker image or downloading the open source (GPL) distribution on GitHub.

Frequently Asked Questions

What sensors and devices are supported? EDGE currently supports the following sensors and devices:

  • Tinkerforge bricklets: Ambient Light, Barometer, Dual Button, GPS, Humidity, IO-4, Motion Detector, Rotary Encoder, Temperature.
  • XBee® ZB Sensors (combined temperature, humidity and light).
  • GPS/GNSS receivers via serial port NMEA 0183 protocol.
  • Devices connected via UART/RS-232 ports.
  • GPIO ports (via Linux sysfs interface).
  • Temperature, humidity, light and other environmental sensors.
  • 3-Axis accelerometers, magnetometers, gyroscopes.
  • Multi-sensor devices like Bosch XDK (via Bluetooth® LE) and CISS (via USB), as well as TI SensorTag (via Bluetooth® LE).

Support for additional devices is added on an ongoing basis.

What OS platforms are supported? EDGE currently supports Linux (ARM and Intel) and macOS. Most of the code is platform independent and compiles on all platforms supported by the POCO C++ Libraries (including Windows and Windows Embedded Compact). However, the build system currently only supports Linux and macOS, specifically when it comes to building the V8 engine. Android should work as well, but is currently untested.

What features require a commercial license?

The following features are not part of the open source version and require a commercial license:

  • REST, SOAP, JSON-RPC and HTTP support for C++ Remoting framework.
  • WSDL/XML Schema (XSD) C++ code generator.
  • Connectors (automatic mapping of datapoints to various protocols)
  • OPC-UA and CANopen support.
  • Cryptographically signed bundles for secure software updates and implementation of device specific app stores.
  • Advanced, database-based user authentication and authorization with optional LDAP integration and support for two-factor authentication based on TOTPs.
  • An extensible command line interface framework.

Here is a full list of open-source and commercial features.

How is EDGE different from node.js?

While both EDGE and node.js/io.js use the same underlying JavaScript engine (V8), there are significant differences:

  • EDGE supports multiple concurrent, but independent scripts, each one running in its own thread.
  • The EDGE JavaScript programming model is not strictly asynchronous. To keep things simple (and avoid callback spaghetti), many calls are blocking, although for lengthier I/O operations callback/event-based interfaces are also available. IoT devices don't have to deal with thousands of concurrent requests, so the focus has been on easy of use rather than ultimate scalability.
  • EDGE is entirely implemented in C++.
  • EDGE has a generic C++-to-JavaScript bridging mechanism (based on a code generator) that makes it very easy to make C++ objects available to JavaScript.
  • EDGE has module system (somewhat inspired by OSGi) that can be used for both C++ and JavaScript code.

What does stand for?

Macchina is the italian word for machine (it's pronounced 'makkina). therefore means machines that input/output information, or machines/devices that communicate.