in IOT, Linux

Samsung ARTIK 530 test on Node-RED


Tested Node-RED on Samsung ARTIK 530 with successful result.

Install Node.js JavaScript environment

Follow this Link to install Node.js JavaScript environment, saw some errors, but it’s working properly for subsequent testing.

[root@artik ~]# python --version
Python 2.7.13
[root@artik ~]# dnf update 
[root@artik ~]# dnf install node
Fedora 24 - armhfp - Updates                              2.0 MB/s |  20 MB     00:09    

Last metadata expiration check: 0:00:53 ago on Mon Jun 19 04:00:35 2017.
Dependencies resolved.
 Package           Arch              Version                       Repository        Size
 libax25           armv7hl           1.0.5-2.fc24                  fedora            41 k
 node              armv7hl           0.3.2-19.fc24                 fedora            66 k
 xinetd            armv7hl           2:2.3.15-17.fc24              fedora           124 k

Transaction Summary
Install  3 Packages

Total download size: 232 k
Installed size: 434 k
Is this ok [y/N]: Operation aborted.
[root@artik ~]# 

[root@artik ~]# dnf install npm
Last metadata expiration check: 0:02:26 ago on Mon Jun 19 04:00:35 2017.
Package npm-1:2.15.11-4.fc24.armv7hl is already installed, skipping.
Dependencies resolved.
Nothing to do.
[root@artik ~]# 

[root@artik ~]# npm -g install node-red
npm WARN deprecated nodemailer@1.11.0: All versions below 4.0.1 of Nodemailer are deprecated. See
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated i18next-client@1.10.3: you can use npm install i18next from version 2.0.0
> bcrypt@1.0.2 install /usr/lib/node_modules/node-red/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): 
node-pre-gyp ERR! Pre-built binaries not found for bcrypt@1.0.2 and node@4.7.3 (node-v46 ABI) (falling back to source compile with node-gyp) 
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/4.7.3"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/node-red/node_modules/bcrypt/.node-gyp"
make: Entering directory '/usr/lib/node_modules/node-red/node_modules/bcrypt/build'
make: *** No rule to make target '../.node-gyp/4.7.3/include/node/common.gypi', needed by 'Makefile'.  Stop.
make: Leaving directory '/usr/lib/node_modules/node-red/node_modules/bcrypt/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:12)
gyp ERR! System Linux 4.4.19-0530GC0F-44F-01Q3
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/usr/lib/node_modules/node-red/node_modules/bcrypt/lib/binding"
gyp ERR! cwd /usr/lib/node_modules/node-red/node_modules/bcrypt
gyp ERR! node -v v4.7.3
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/lib/node_modules/node-red/node_modules/bcrypt/lib/binding' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/node-red/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:854:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)
node-pre-gyp ERR! System Linux 4.4.19-0530GC0F-44F-01Q3
node-pre-gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/node-red/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/lib/node_modules/node-red/node_modules/bcrypt
node-pre-gyp ERR! node -v v4.7.3
node-pre-gyp ERR! node-pre-gyp -v v0.6.32
node-pre-gyp ERR! not ok 
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/usr/lib/node_modules/node-red/node_modules/bcrypt/lib/binding' (1)
npm WARN optional dep failed, continuing bcrypt@1.0.2
/usr/bin/node-red -> /usr/lib/node_modules/node-red/red.js
/usr/bin/node-red-pi -> /usr/lib/node_modules/node-red/bin/node-red-pi
node-red@0.16.2 /usr/lib/node_modules/node-red
├── is-utf8@0.2.1
├── media-typer@0.3.0
├── on-headers@1.0.1
├── basic-auth@1.1.0
├── clone@2.1.0
├── semver@5.3.0
├── node-red-node-rbe@0.1.11
├── json-stringify-safe@5.0.1
├── mustache@2.3.0
├── jsonata@1.0.10
├── passport-http-bearer@1.0.1 (passport-strategy@1.0.0)
├── cookie-parser@1.4.3 (cookie-signature@1.0.6, cookie@0.3.1)
├── passport-oauth2-client-password@0.1.2 (passport-strategy@1.0.0)
├── passport@0.3.2 (passport-strategy@1.0.0, pause@0.0.1)
├── nopt@3.0.6 (abbrev@1.1.0)
├── sentiment@2.1.0
├── bcryptjs@2.4.0
├── fs.notify@0.0.4 (async@0.1.22, retry@0.6.1)
├── cors@2.8.1 (vary@1.1.1)
├── ws@1.1.1 (options@0.0.6, ultron@1.0.2)
├── raw-body@2.2.0 (unpipe@1.0.0, bytes@2.4.0, iconv-lite@0.4.15)
├── follow-redirects@1.2.1 (debug@2.6.8)
├── fs-extra@1.0.0 (jsonfile@2.4.0, graceful-fs@4.1.11, klaw@1.3.1)
├── oauth2orize@1.7.0 (uid2@0.0.3, utils-merge@1.0.0, debug@2.6.8)
├── when@3.7.7
├── body-parser@1.15.2 (bytes@2.4.0, content-type@1.0.2, depd@1.1.0, qs@6.2.0, raw-body@2.1.7, on-finished@2.3.0, http-errors@1.5.1, debug@2.2.0, iconv-lite@0.4.13, type-is@1.6.15)
├── express@4.14.0 (cookie-signature@1.0.6, content-type@1.0.2, cookie@0.3.1, escape-html@1.0.3, array-flatten@1.1.1, utils-merge@1.0.0, merge-descriptors@1.0.1, encodeurl@1.0.1, methods@1.1.2, parseurl@1.3.1, range-parser@1.2.0, vary@1.1.1, fresh@0.3.0, etag@1.7.0, path-to-regexp@0.1.7, content-disposition@0.5.1, depd@1.1.0, qs@6.2.0, on-finished@2.3.0, finalhandler@0.5.0, debug@2.2.0, proxy-addr@1.1.4, send@0.14.1, type-is@1.6.15, accepts@1.3.3, serve-static@1.11.2)
├── cheerio@0.22.0 (lodash.foreach@4.5.0, lodash.assignin@4.2.0, lodash.flatten@4.4.0, lodash.pick@4.4.0, lodash.defaults@4.2.0, lodash.bind@4.2.1, lodash.reduce@4.6.0, lodash.filter@4.6.0, lodash.some@4.6.0, lodash.reject@4.6.0, lodash.merge@4.6.0,, entities@1.1.1, dom-serializer@0.1.0, css-select@1.2.0, htmlparser2@3.9.2)
├── js-yaml@3.7.0 (esprima@2.7.3, argparse@1.0.9)
├── uglify-js@2.7.5 (async@0.2.10, uglify-to-browserify@1.0.2, source-map@0.5.6, yargs@3.10.0)
├── node-red-node-email@0.1.23 (mailparser@0.6.2, imap@0.8.19, poplib@0.1.7, nodemailer@1.11.0)
├── mqtt@2.2.1 (inherits@2.0.3, reinterval@1.1.0, xtend@4.0.1, minimist@1.2.0, concat-stream@1.6.0, commist@1.0.0, split2@2.1.1, readable-stream@2.2.11, end-of-stream@1.4.0, pump@1.0.2, mqtt-packet@5.3.0, websocket-stream@3.3.3, help-me@1.1.0)
├── node-red-node-twitter@0.1.11 (twitter-ng@0.6.2, oauth@0.9.14, request@2.81.0)
├── i18next@1.10.6 (cookies@0.7.0, json5@0.2.0, i18next-client@1.10.3)
├── cron@1.2.1 (moment-timezone@0.5.13)
├── xml2js@0.4.17 (sax@1.2.2, xmlbuilder@4.2.1)
└── node-red-node-feedparser@0.1.8 (feedparser@1.1.3, request@2.74.0)

[root@artik pem]# npm -g install node-red-contrib-artik
> epoll@0.1.22 install /usr/lib/node_modules/node-red-contrib-artik/node_modules/onoff/node_modules/epoll
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/4.7.3"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/node-red-contrib-artik/node_modules/onoff/node_modules/epoll/.node-gyp"
make: Entering directory '/usr/lib/node_modules/node-red-contrib-artik/node_modules/onoff/node_modules/epoll/build'
  CXX(target) Release/
  SOLINK_MODULE(target) Release/
  COPY Release/epoll.node
make: Leaving directory '/usr/lib/node_modules/node-red-contrib-artik/node_modules/onoff/node_modules/epoll/build'
node-red-contrib-artik@0.0.12 /usr/lib/node_modules/node-red-contrib-artik
├── when@3.7.5
└── onoff@1.1.1 (epoll@0.1.22)
[root@artik pem]# 

[root@artik pem]# npm -g install node-red-contrib-artik-cloud
node-red-contrib-artik-cloud@0.2.2 /usr/lib/node_modules/node-red-contrib-artik-cloud
├── ws@1.1.1 (options@0.0.6, ultron@1.0.2)
└── node-rest-client@2.0.1 (debug@2.2.0, xml2js@0.4.17)
[root@artik pem]# 

NPM means, Node package management (npm) tool

Test on ARTIK 530 LED

Start Node-RED

[root@artik ~]# node-red &
[1] 2263
[root@artik ~]# 
22 Jun 01:57:34 - [info] 

Welcome to Node-RED

22 Jun 01:57:34 - [info] Node-RED version: v0.16.2
22 Jun 01:57:34 - [info] Node.js  version: v4.7.3
22 Jun 01:57:34 - [info] Linux 4.4.19-0530GC0F-44F-01Q3 arm LE
22 Jun 01:57:36 - [info] Loading palette nodes
22 Jun 01:57:45 - [warn] ------------------------------------------------------
22 Jun 01:57:45 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
22 Jun 01:57:45 - [warn] ------------------------------------------------------
22 Jun 01:57:45 - [info] Settings file  : /root/.node-red/settings.js
22 Jun 01:57:46 - [info] User directory : /root/.node-red
22 Jun 01:57:46 - [info] Flows file     : /root/.node-red/flows_artik.json
22 Jun 01:57:46 - [info] Server now running at
22 Jun 01:57:46 - [info] Starting flows
22 Jun 01:57:46 - [info] Started flows

Open the web page through the wi-fi, the interface is as below,

Control LED On and OFF

The flow is as below,
Control LED
The ARTIK530_Red_LED_off node configured is as below,
LED off
The ARTIK530_Red_LED_on node is configured as below,
LED on
The result is as below video shows.

Blink LED

For "timestamp", Set Repeat to 'Interval', and make it repeat the flow every 1 second as below pic shows,
For function, put the below code

var state = global.get('state')||0;
if (state === 0) {
} else {
msg.payload = {};
msg.payload.state = state;
return msg;

As below pic shows,


For the ARTIK530_BlueLED node, configure as below,


The working result is as below video shows,


Samsung ARTIK Introduction to Node-RED
Proxy Servers and Certificates

Write a Comment


one × 5 =