can not get Johnny5 node (node-red-contrib-gpio) in Node-Red

740 views
Skip to first unread message

teacher mips

unread,
Sep 20, 2016, 3:22:49 AM9/20/16
to Node-RED
Hi all,

I recently installed nodered on my Win8.1pro 64bit pc, i got a bunch of errors in red (ERR!) but OK nodered is working,

I want to use Arduino with nodered so i installed node-red-node-arduino and i got it working, two nodes in my nodered nodes palette,

but after it i installed Johnny 5 by
npm install node-red-contrib-gpio but i could not get Johnny5 node in my nodered nodes palette

i also tried to install
npm install johnny-five but no luck

i checked my pc and i got johnny-five folder in C:\Users\MIPSECDeptt\.node-red\node_modules


pls help me
thanks in advance

Dave C-J

unread,
Sep 20, 2016, 3:36:42 AM9/20/16
to node...@googlegroups.com
were there any messages or warning on the install ? 
or in the console when you run ?
Are all three nodes missing ? (all yellow - two called gpio and one called johnny 5)
Which version of node.js are you using and which version of Node-RED ?

teacher mips

unread,
Sep 22, 2016, 12:55:54 AM9/22/16
to Node-RED
great thanks for reply and sorry for my late reply actually i can not find a way to completely uninstall node.js, npm nodes i installed, so that i reinstall all and post the error messages etc to you all, pls tell me how to completely uninstall nodered, node.js, npm nodes i installed.

one thing more i tried nodered that comes preinstalled in raspbian jesse on my Rasp pi board, nodered runs ok but i when i give npm it says bash : command not found so how can i install new nodes to it

i tried installing npm by sudo apt-get install npm but at the end it could not fetch some packages and broken.

pls help me thanks

teacher mips

unread,
Sep 22, 2016, 1:00:12 AM9/22/16
to Node-RED
I am using node v4.5.0

yes all three nodes missing (all yellow - two called gpio and one called johnny 5)

node-red v0.14.6

also a problem in using serial node, it always says error opening \\. \COM3 File not found, it is my arduino port

pls help me i am totally in dark, can't use arduino and can't use rasp pi

i want to use johny5 on arduino and on rasp pi also

thanks

Dave C-J

unread,
Sep 22, 2016, 2:09:28 AM9/22/16
to node...@googlegroups.com
Hi
ok - on PI - you didn't follow all the instructions... if you read the docs at http://nodered.org/docs/hardware/raspberrypi
you will see there are more steps..
sudo apt-get install npm
sudo npm install -g npm@2.x
hash -r
cd ~/.node-red
npm install node-red-{example node name}
Or instead to clean up completely and get latest node.js and npm and node-red you can use the upgrade script
update-nodejs-and-nodered
That will get you node.js 4.5 and Node-RED 0.14.6 and npm.

On Windows - where are  you running the install for the nodes ?
When you start node-red it will tell you what the user directory is... - you need to be in that directory before running npm install node-red-contrib-gpio .



Mark Setrem

unread,
Sep 22, 2016, 2:20:25 AM9/22/16
to Node-RED
The easiest way might be to start with a new download of raspbian to the SDcard.

If your were using the preinstalled version of nodered you can follow the instructions on the RaspberryPi page in the documentation to install the correct version of npm (see the part on adding nodes http://nodered.org/docs/hardware/raspberrypi)

teacher mips

unread,
Sep 24, 2016, 2:06:55 AM9/24/16
to Node-RED

Hi GOOOOOOOD NEWS :

I installed node, npm, node-red on Ubuntu and i got no errors,

i then installed arduino (node-red-node-arduino) and i got it working too, two nodes in my nodered nodes palette

i also installed
node-red-contrib-gpio and all yellow - two called gpio and one called johnny 5 nodes are comming in my nodered nodes palette

i also tested johnny5 node with a blink function and my arduino -------- working well

but now i want to learn node-red from scratch, suppose if i want to connect inject node to johnny5 and control my led, i am really in complete dark on "how to write functions in nodered"

is there any book or some resource pls suggest

and using nodered in my Rasp pi  board is still pending, should i remove the pre-installed nodered completely and install a fresh and latest one? pls guide me how

thanks reply soon
thanks

Mark Setrem

unread,
Sep 24, 2016, 3:29:36 AM9/24/16
to Node-RED
If you use your choice of internet search engine and search for "node red course" you should find a couple of tutorials that should help you get started on using node-red and writing functions.

If you download the latest version of Rasbian for your raspberrypi it contains a version of node-red that is great to get started with.

If you want to add new nodes you will need to update the version of npm.  Please follow the instructions on the following page 

http://nodered.org/docs/hardware/raspberrypi (see section on adding nodes)

Tha page also contains the instructions to update to the very latest version if you so desire 

teacher mips

unread,
Sep 25, 2016, 3:57:27 PM9/25/16
to Node-RED
I flashed my arduino uno with std. Firmata and connected to nodered used johnny5 well ok

But now I want to use serial node to receive serial string from arduino, so I refreshed my arduino with my custom sketch which sends our a string (firmata erased)

Now always when I plug my board/or not plug-i.e., without board connected to my pc and start nodered it says firmware error check your board firmware and nodered stops not start even

Pls helps to resolve this eror
Thanks

Mark Setrem

unread,
Sep 25, 2016, 4:42:55 PM9/25/16
to Node-RED
Can you paste the exact error message you see?

Dave C-J

unread,
Sep 25, 2016, 6:00:45 PM9/25/16
to node...@googlegroups.com

The arduino nodes ONLY talk firmata. So wiping it out means it won't talk to those nodes. Instead just use the standard serial nodes to talk to the serial data coming out of your sketch.

teacher mips

unread,
Oct 1, 2016, 3:21:39 AM10/1/16
to Node-RED
I am using nodered on Raspberry pi and using httpRequest node

We use internet behind a proxy in our college, i have added the following

export http_proxy="http://192.168.1.1:3128/"
export https_proxy="http://192.168.1.1:3128/"
export ftp_proxy="http://192.168.1.1:3128/"
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
export HTTP_PROXY="http://192.168.1.1:3128/"
export HTTPS_PROXY="http://192.168.1.1:3128/"
export FTP_PROXY="http://192.168.1.1:3128/"
export NO_PROXY="localhost,127.0.0.1,localaddress,.localdomain.com"



to the following files,
/etc/bash.bashrc
~/.bashrc
~/
.profile



added the following
 
http_proxy="http://192.168.1.1:3128/"
https_proxy
="http://192.168.1.1:3128/"
ftp_proxy
="http://192.168.1.1:3128/"
no_proxy
="localhost,127.0.0.1,localaddress,.localdomain.com"
HTTP_PROXY
="http://192.168.1.1:3128/"
HTTPS_PROXY
="http://192.168.1.1:3128/"
FTP_PROXY
="http://192.168.1.1:3128/"
NO_PROXY
="localhost,127.0.0.1,localaddress,.localdomain.com"

to /etc/environment

added the following

Acquire::http::proxy "http://192.168.1.1:3128/";
Acquire::ftp::proxy "ftp://192.168.1.1:3128/";
Acquire::https::proxy "https://192.168.1.1:3128/";

to /etc/apt/apt.conf.d/00proxies

and added the following,

static ip_address=192.168.0.121/22
static routers=192.168.1.1
static domain_name_servers=8.8.8.8 8.8.4.4

to /etc/dhcpcd.conf

everything is working fine, like web browsing, email etc

but when i use my flow containing httpRequest it don't connect, it says Error: getaddrinfo ENOTFOUND

on Ubuntu PC i only added the following
 
http_proxy="http://192.168.1.1:3128/"
https_proxy
="http://192.168.1.1:3128/"
ftp_proxy
="http://192.168.1.1:3128/"
no_proxy
="localhost,127.0.0.1,localaddress,.localdomain.com"
HTTP_PROXY
="http://192.168.1.1:3128/"
HTTPS_PROXY
="http://192.168.1.1:3128/"
FTP_PROXY
="http://192.168.1.1:3128/"
NO_PROXY
="localhost,127.0.0.1,localaddress,.localdomain.com"

to /etc/environment

and added the following

Acquire::http::proxy "http://192.168.1.1:3128/";
Acquire::ftp::proxy "ftp://192.168.1.1:3128/";
Acquire::https::proxy "https://192.168.1.1:3128/";


to /etc/apt/apt.conf.d/00proxies

and my same flow containing httpRequest works fine

I am unable to resolve the problem pls help me

Dave C-J

unread,
Oct 1, 2016, 5:08:28 AM10/1/16
to node...@googlegroups.com
Hi

if you want to dig deeper for us ... then if you edit around line 158 of 21-httprequest.js
insert a line just before    var req = ...
add     console.log("OPTS",opts);
and then stop and restart Node-RED. on every http request you should now see the complete options being used to request data...  
Feel free to post here (removing any security tokens/passwords etc) so we can help look at it.

teacher mips

unread,
Oct 3, 2016, 3:52:44 PM10/3/16
to Node-RED
Hi thanks for your reply but pls tell me the location of 21-httprequest.js file

I also tried in terminal by 'whereis 21-httprequest.js' but it ended no results.

Thanks

teacher mips

unread,
Oct 4, 2016, 3:50:53 AM10/4/16
to Node-RED
Hi I got the location of 21-httprequest.js and working soon I will send you the output

teacher mips

unread,
Oct 5, 2016, 3:28:20 PM10/5/16
to Node-RED

Hi I worked on it and edited 21-httprequest.js and write console.log("OPTS",opts); as you told, pls look at the edited file here [https://drive.google.com/open?id=0B5NYQC3oiHcHU1Zab2YxRXQ5cnc]

pls take a look of the flow here : [https://drive.google.com/open?id=0B5NYQC3oiHcHN200YjdjMFhlMWM]

and pls take a look of the console log here : [https://drive.google.com/open?id=0B5NYQC3oiHcHWDBDTzZqX3ZNWm8]

here is the console log in text

Start Node-RED
 
Once Node-RED has started, point a browser at http://192.168.0.121:1880
On Pi Node-RED works better with the Firefox browser
 
Use   node-red-stop                          to stop Node-RED
Use   node-red-start                         to start Node-RED again
Use   node-red-log                           to view the recent log output
Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot
 
To find more nodes and example flows - go to http://flows.nodered.org
You may also need to install and upgrade npm
      sudo apt
-get install npm
      sudo npm i
-g npm@2.x
 
Started Node-RED graphical event wiring tool..
Welcome to Node-RED
===================
5 Oct 12:01:47 - [info] Node-RED version: v0.14.6
5 Oct 12:01:47 - [info] Node.js  version: v0.10.29
5 Oct 12:01:47 - [info] Linux 4.4.21+ arm LE
5 Oct 12:01:47 - [info] Loading palette nodes
pi
: TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/python -u /usr/lib/node_modules/node-red/nodes/core/hardware/nrgpio.py info
pam_unix
(sudo:session): session opened for user root by (uid=0)
pam_unix
(sudo:session): session closed for user root
5 Oct 12:02:23 - [info] Settings file  : /usr/lib/node_modules/node-red/settings.js
5 Oct 12:02:23 - [info] User directory : /home/pi/.node-red
5 Oct 12:02:24 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
5 Oct 12:02:24 - [info] Server now running at http://127.0.0.1:1880/
5 Oct 12:02:24 - [info] Starting flows
5 Oct 12:02:25 - [info] Started flows
5 Oct 12:03:57 - [info] Stopping flows
5 Oct 12:03:57 - [info] Stopped flows
5 Oct 12:03:57 - [info] Starting flows
5 Oct 12:03:58 - [info] Started flows
OPTS { protocol: 'http:',
slashes
: true,
auth
: null,
host
: 'ashutestweb.netai.net',
port
: null,
hostname
: 'ashutestweb.netai.net',
hash
: null,
search
: null,
query
: null,
pathname
: '/testWAN/read.php',
path
: '/testWAN/read.php',
href
: 'http://ashutestweb.netai.net/testWAN/read.php',
method
: 'GET',
headers
: {} }
5 Oct 12:04:44 - [error] [http request:61402810.9ebfd8] Error: getaddrinfo ENOTFOUND

Dave C-J

unread,
Oct 5, 2016, 3:48:46 PM10/5/16
to node...@googlegroups.com
I would expect the opts.headers not to be blank if it was using a proxy... so for some reason it's not using the proxy...
can you change (or add another line after) that console.log we added to be
console.log("prox",prox,"noprox",noprox,"noproxy",noproxy);
and report that bit back ... 

Thanks

teacher mips

unread,
Oct 6, 2016, 12:02:19 AM10/6/16
to Node-RED

Great thanks sir, I will post you the updated logs as you told very soon, actually my college is closed for two days, i apologize for the delay.

Actually I am quite sure my node-red is not picking up the proxy settings, becoz i tested it with a non-proxy internet line in my college server lab and everything works fine, like a charm.

So it is just the problem of proxy, i think we have to sort-out from where (which system file) it pics-up the proxy settings, we than have to add all the proxy settings to that file/location in the Rasp pi system

Dave C-J

unread,
Oct 6, 2016, 3:41:07 AM10/6/16
to node...@googlegroups.com
Hi

Node-RED picks up the proxy from the environment variable HTTP_PROXY
so that should be the only thing that needs to be set for it to work.

teacher mips

unread,
Oct 7, 2016, 5:50:31 AM10/7/16
to Node-RED

Hi I added console.log("prox",prox,"noprox",noprox,"noproxy",noproxy);

and now the log is this,
OPTS { protocol: 'http:',
slashes
: true,
auth
: null,
host
: 'ashutestweb.netai.net',
port
: null,
hostname
: 'ashutestweb.netai.net',
hash
: null,
search
: null,
query
: null,
pathname
: '/testWAN/read.php',
path
: '/testWAN/read.php',
href
: 'http://ashutestweb.netai.net/testWAN/read.php',
method
: 'GET',
headers
: {} }
prox undefined noprox undefined noproxy undefined
7 Oct 10:21:47 - [error] [http request:61402810.9ebfd8] Error: getaddrinfo ENOTFOUND

I know that Node-RED picks up the proxy from the environment variable HTTP_PROXY but where to set this env var, if you look at my previous post I tried adding HTTP_PROXY to the files.
/etc/bash.bashrc
~/.bashrc
~/
.profile
/etc/environment
/etc/apt/apt.conf.d/00proxies

but none worked

Dave C-J

unread,
Oct 7, 2016, 7:44:33 AM10/7/16
to node...@googlegroups.com
so indeed the proxy is not actually set :-)....
assuming you are using node-red-start command to start it.. I think we need to edit the nodered.service file
which is  /lib/systemd/system/nodered.service   and will need sudo/root permissions to edit...
and add another Environment line.... eg where it has

    Nice=5

    Environment="NODE_OPTIONS=--max-old-space-size=128"

    #Environment="NODE_RED_OPTIONS=-v"

add

    Environment="HTTP_PROXY=your_proxy_address"

then stop Node-RED - then run ... sudo systemctl daemon-reload ... to reload the new config file

then restart Node-RED... finger crossed.

teacher mips

unread,
Oct 15, 2016, 2:49:03 PM10/15/16
to Node-RED
Very sorry Dave C-J for my late reply, actually i was busy for my mid-semester exams.

Any very very great thanks, your trick works like a charm,

but still I have problem with the twitter and email nodes ---- they are still not working.

I think I have to add https and ftp proxys also ---- then they work, i will check it and let you know

mean while great thanks pls suggest me what do you thanks may be happing with
the twitter and email nodes ---- they are still not working.

teacher mips

unread,
Oct 22, 2016, 5:21:04 PM10/22/16
to Node-RED

Hi I tested twitter, httprequest, email nodes without proxy add all is working like a charm, but with proxy twitter node not authenticate even, i not tested  email node with proxy yet.

teacher mips

unread,
Oct 24, 2016, 3:01:34 AM10/24/16
to Node-RED
Hi I tested twitter and email nodes with proxy in my college but no luck, I also added the proxy as you said in nodered.service, pls have a look at the nodered.service file for 'Environment=' lines

# systemd service file to start Node-RED

[Unit]
Description=Node-RED graphical event wiring tool.
Wants=network.target
Documentation=http://nodered.org/docs/hardware/raspberrypi.html

[Service]
Type=simple
# Run as normal pi user - feel free to change...
User=pi
Group=pi
Nice=5
Environment="NODE_OPTIONS=--max-old-space-size=128"
#Environment="NODE_RED_OPTIONS=-v"

Environment="http_proxy=http://192.168.1.1:3128/"
Environment="https_proxy=http://192.168.1.1:3128/"
Environment="ftp_proxy=http://192.168.1.1:3128/"
Environment="no_proxy=localhost,127.0.0.1,localaddress,.localdomain.com"
Environment="HTTP_PROXY=http://192.168.1.1:3128/"
Environment="HTTPS_PROXY=http://192.168.1.1:3128/"
Environment="FTP_PROXY=http://192.168.1.1:3128/"
Environment="NO_PROXY=localhost,127.0.0.1,localaddress,.localdomain.com"

#WorkingDirectory=/usr/lib/node_modules/node-red/
#ExecStart=/usr/bin/env node $NODE_OPTIONS red.js $NODE_RED_OPTIONS
ExecStart=/usr/bin/env node-red-pi $NODE_OPTIONS $NODE_RED_OPTIONS
# Use SIGINT to stop
KillSignal=SIGINT
# Auto restart on crash
Restart=on-failure
# Tag things in the log
SyslogIdentifier=Node-RED
#StandardOutput=syslog

[Install]
WantedBy=multi-user.target


now using email node gives the same error as before,
24 Oct 10:57:29 - [error] [e-mail:acadamic.mips@gmail.com] Error: getaddrinfo ENOTFOUND

and using twitter node : I can not even authenticate, It says it happens when the system clock is wrong but as you can see in the images (2.png) the clock is well correct,

1.png : https://drive.google.com/file/d/0B5NYQC3oiHcHTzdzQVpsaDVfMDA/view?usp=sharing
2.png : https://drive.google.com/file/d/0B5NYQC3oiHcHWmJ1OE53ejVUV0k/view?usp=sharing

pls tell em how to set proxy

Dave C-J

unread,
Oct 24, 2016, 4:39:25 AM10/24/16
to node...@googlegroups.com
I don't think the Twitter node nor Email are proxy enabled at present.

teacher mips

unread,
Oct 24, 2016, 4:02:26 PM10/24/16
to Node-RED
Thanks again your your quick reply

You mean I can not use Twitter and email nodes with proxy, pls clarify

Thanks

Dave C-J

unread,
Oct 24, 2016, 4:52:35 PM10/24/16
to node...@googlegroups.com
correct - they aren't designed to work with a proxy yet.

teacher mips

unread,
Oct 25, 2016, 2:57:58 AM10/25/16
to Node-RED
Thanks now I am planning to digging the code of these nodes and trying to manage that they can work with proxy.

Sir pls tell me the loc and file name of twitter and email nodes as you told me for the httprequest node .

Thanks

Mark Setrem

unread,
Oct 25, 2016, 3:33:17 AM10/25/16
to Node-RED
The two nodes are in the GitHub node-red-nodes repository on the node-red GitHub site. I'm sure you can work out/find what they are called ;-) But given that they both use libraries it could well be that the libraries don't support proxies. Good luck with your digging

teacher mips

unread,
Oct 26, 2016, 2:00:02 AM10/26/16
to Node-RED
Thanks
Reply all
Reply to author
Forward
0 new messages