Node-RED on WRTnode

03Dec14

TL;DR – it runs – now I need to put together some GPIO nodes.

Updated 5 Dec 2014 – In my original post Node-RED was so slow it was unusable. Using Michal Vondráček’s node-ws package fixed that.

Background

The WRTnode website features a screenshot of Node-RED, so I thought it would be fun to make it come true.

Node.js on WRTnode

My first hurdle was to get Node.js running on the WRTnode. Node has previously been run on OpenWRT, but that implementation was old and specifically targeted to a big endian MIPS architecture. Luckily Michal Vondráček published a working WRTnode implementation of Node.js the day before the ThinkMonk hack day.

Installation

I next struggled with installation, as ‘npm install –production’ was first running out of memory and then complaining about a lack of filesystem locks. Thankfully Node-RED creator Nick O’Leary was on hand to point out that I could simply copy an installed Node-RED from another system (like a VM on my laptop).

It runs

With Node.js installed (mostly onto a USB stick) and Node-RED also copied onto the USB stick I was able to start Node-RED, see it coming up on port 1880 and browse to it.

NodeRED_WRTnode

Having installed Michal’s node-ws and deleted the ws package from the Node-RED node_modules directory everything works:

NodeRED_WRTnode_working

Todo

I now need to get the GPIO mapped so that I can get Node-RED to blink some lights etc.

Too slow

Sadly running interpreted JavaScript on a low end MIPS CPU doesn’t result in a development environment that anybody would want to use. After half an hour or so of waiting I didn’t even see the tool palette load. I squashed any ideas of moving on to GPIO mapping for the WRTnode.

Can it be made to work?

Possibly – more of the code needs to be compiled to native MIPS. I don’t really know whether this is an issue that can only be addressed in the core V8 runtime, or whether some smart cross compilation of modules might help. Since Nick told me that most of the modules are now pure JavaScript, implying that the clever optimisation has moved from the edge to the core.



One Response to “Node-RED on WRTnode”

  1. Hi Chris… I have some “generic” gpio hack code that I am using with Hummingboard… maybe re-useable if they use sysfs for gpio ?


Leave a reply to DC-J Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.