Festo Didactic EasyPort - node.js using ftdi-d2xx

Calum Knott - Mar 27 - - Dev Community

AnimationExample

Example of a Simbox - Connected to an Easyport working with OSX - No ActiveX/Windows driver needed :)

Why?

Festo Didactic EasyPort is a GPIO device designed and manufactured by Festo Didactic, for connection to Festo Products using Syslink or Sub-D Connectors.

There is an ActiveX component for use in windows applications, but i wanted a node.js implementation for an ongoing project - So I have created a Cross Platform Library for using EasyPort in Node.js

GitHub logo calumk / easyport-node-d2xx

Library for using EasyPort in Node.js

easyport-node-d2xx

Cross Platform Library for using EasyPort in Node.js

https://ip.festo-didactic.com/InfoPortal/MPS/EasyPort/EN/index.html

Description

EasyPort is a GPIO device designed and manufactured by Festo Didactic, for connection to Festo Products using Syslink or Sub-D Connectors.

This library is designed to be cross-platform (osx/windows/linux) way to read & write data from the Easyport.

It will also form the basis for another project -> @calumk/easyport-webusb

Note

This specific library uses FTDI-D2XX library.

This Library does NOT require the ActiveX Driver from Festo Didactic - This is a "standalone" re-implemmentation

Important

This library is designed for educational purposes, and should not be used for saftey-critical systems.

Tip

At the moment, Only Digital is supported Analog will be supported soon.


## Simple Use

This outlines simple use of the library

Setup

import { EasyPort } from "@calumk/easyport-node-d2xx";
let easyport = new EasyPort({
    timeouts : {
        tx : 100,
        rx : 100
    }
}
Enter fullscreen mode Exit fullscreen mode

How?

Thankfully the device is well documented, and the official manual details the serial port commands well.

API

The Library simply wraps these commands, in a friendly API.

Sending the following command via serial, would turn bit 4 on.

MA1.0.4=1\n
Enter fullscreen mode Exit fullscreen mode

The library wraps this as

easyport.write_output_bit({
   bit : 4,
   value : true
})
Enter fullscreen mode Exit fullscreen mode

Likewise, we can read, for example to read a whole word

DEW1.0\n
Enter fullscreen mode Exit fullscreen mode

The library wraps this as

easyport.read_input_word()
Enter fullscreen mode Exit fullscreen mode

There is also a monitoring mode avaliable to get interupt-style data from the device.

// Enable the Monitoring Mode
easyport.enableMonitoringMode()

// disable Monitoring Mode
easyport.disableMonitoringMode()

// this will tell you when the monitoring mode has changed
// This is useful, because if you try to write data while monitoring mode is on, it will be automatically disabled, and then re-endabled.
easyport.registerNewMonitoringModeEnabledListener((data) => {
    console.log("Monitoring Mode: ", data)
});

// This will log all monitored data (the value of the whole word 0)
easyport.registerNewMonitoringModeListener((data) => {
    console.log(data)
});

Enter fullscreen mode Exit fullscreen mode

What Next?

This Library is still under development, and It will also form the basis for 2 other [upcoming unreleased] projects

@calumk/easyport-webusb

A re-implementation of the library using webusb to allow for driverless use in a web browser

@calumk/node-red-contrib-easyport-node-d2xx

A node-red implimentation of the library to allow for easy prototyping

. . . . . . . . . . . . . . . .