0

Raspberry Pi - Digital output
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

Raspberry Pi - Digital output

by larscee on Thu Oct 08, 2015 7:25 pm

So I'm attempting to get my Pi to work with the powertail, but I'm assuming the Adafruit IO isn't talking to the Raspberry Pi or vice versa. Is there a way to tell?

Trying to follow this
https://learn.adafruit.com/adafruit-io-basics-digital-output/raspberry-pi

I have my dashboard/feed setup. I copied my AIO key and plugged my username into the node.js script. I've double checked and I have the gpio 17 and ground connected to the power tail. The only thing I can figure is that I don't have this GPIO admin installed?

The next step will be to install the latest version of Node.js and GPIO Admin. We have created a short guide that covers installing Node.js if you need help with the install process. You can check the version of node you have installed by running node -v from the command line on your Pi. You should have v0.12.0 or higher installed.


I've scoured the docs and unable to find the actual package name to see if its installed. I did however install the Occidentalis tools manually.

Using a Raspberry Pi model A+ over wifi connected to a powered USB hub. Running the latest version of Raspbian. Boots directly to the terminal.

If anyone has any tips to get me moving in the right direction, that would be awesome. I feel like I'm just not seeing it, but it's right in the front of my face.

Code: Select all | TOGGLE FULL SIZE
  "feeds":[
    {
      "id":2461,
      "key":"relay",
      "name":"Relay",
      "description":"",
      "unit_type":null,
      "unit_symbol":null,
      "last_value":"OFF",
      "status":"online",
      "visibility":"public",
      "enabled":true,
      "license":null,
      "created_at":"2015-10-08T22:56:14.526Z",
      "updated_at":"2015-10-08T23:11:37.669Z",
      "streams":[
        {
          "id":8718015,
          "value":"ON",
          "created_at":"2015-10-08T23:02:09.573Z",
          "updated_at":"2015-10-08T23:02:09.573Z",
          "completed_at":null
        },
        {
          "id":8718017,
          "value":"OFF",
          "created_at":"2015-10-08T23:02:11.560Z",
          "updated_at":"2015-10-08T23:02:11.560Z",
          "completed_at":null
        },
        {
          "id":8718043,
          "value":"ON",
          "created_at":"2015-10-08T23:02:29.064Z",
          "updated_at":"2015-10-08T23:02:29.064Z",
          "completed_at":null
        },
        {
          "id":8718055,
          "value":"OFF",
          "created_at":"2015-10-08T23:02:31.691Z",
          "updated_at":"2015-10-08T23:02:31.691Z",
          "completed_at":null
        },
        {
          "id":8718059,
          "value":"ON",
          "created_at":"2015-10-08T23:02:32.778Z",
          "updated_at":"2015-10-08T23:02:32.778Z",
          "completed_at":null
        },
        {
          "id":8718060,
          "value":"OFF",
          "created_at":"2015-10-08T23:02:33.777Z",
          "updated_at":"2015-10-08T23:02:33.777Z",
          "completed_at":null
        },
        {
          "id":8718912,
          "value":"OFF",
          "created_at":"2015-10-08T23:11:37.666Z",
          "updated_at":"2015-10-08T23:11:37.666Z",
          "completed_at":null
        },
        {
          "id":8718903,
          "value":"ON",
          "created_at":"2015-10-08T23:11:33.322Z",
          "updated_at":"2015-10-08T23:11:33.322Z",
          "completed_at":null
        }
      ]
    }
  ],
  "dashboards":[
    {
      "id":1067,
      "name":"rPi-Relay",
      "key":"rpi-relay",
      "description":null,
      "visibility":"private",
      "created_at":"2015-10-08T22:56:48.942Z",
      "updated_at":"2015-10-08T22:56:48.942Z"
    }
  ]
}

larscee
 
Posts: 12
Joined: Thu Oct 17, 2013 2:44 pm

Re: Raspberry Pi - Digital output

by jwcooper on Fri Oct 09, 2015 12:05 pm

What's the output from running the following from the terminal command line?

Code: Select all | TOGGLE FULL SIZE
node -v

jwcooper
 
Posts: 677
Joined: Tue May 01, 2012 9:08 pm

Re: Raspberry Pi - Digital output

by larscee on Fri Oct 09, 2015 12:08 pm

Code: Select all | TOGGLE FULL SIZE
~/adafruit-io-basics/raspberry_pi $ node -v
v0.12.6

larscee
 
Posts: 12
Joined: Thu Oct 17, 2013 2:44 pm

Re: Raspberry Pi - Digital output

by jwcooper on Fri Oct 09, 2015 12:17 pm

I believe the GPIO admin that the guide references is this repository: https://www.npmjs.com/package/gpio-stream

You can verify it's installed by trying to light an LED or something similar from that npmjs link.

Also, navigate to the adafruit-io-basics directory you cloned from GitHub, and look for the node_modules folder. You should be able to find the gpio-stream package in there.

jwcooper
 
Posts: 677
Joined: Tue May 01, 2012 9:08 pm

Re: Raspberry Pi - Digital output

by larscee on Fri Oct 09, 2015 12:46 pm

Same issue after installing the gpio stream. I'll look at setting up the LED

Code: Select all | TOGGLE FULL SIZE
npm install gpio-stream
npm WARN package.json adafruit-io-basics@1.0.3 No README data
/
> epoll@0.1.15 install /home/ricky5/adafruit-io-basics/raspberry_pi/node_modules/gpio-stream/node_modules/onoff/node_modules/epoll
> node-gyp rebuild

make: Entering directory '/home/ricky5/adafruit-io-basics/raspberry_pi/node_modules/gpio-stream/node_modules/onoff/node_modules/epoll/build'
  CXX(target) Release/obj.target/epoll/src/epoll.o
  SOLINK_MODULE(target) Release/obj.target/epoll.node
  COPY Release/epoll.node
make: Leaving directory '/home/ricky5/adafruit-io-basics/raspberry_pi/node_modules/gpio-stream/node_modules/onoff/node_modules/epoll/build'
gpio-stream@1.0.16 node_modules/gpio-stream
âââ onoff@1.0.2 (epoll@0.1.15)

larscee
 
Posts: 12
Joined: Thu Oct 17, 2013 2:44 pm

Re: Raspberry Pi - Digital output

by larscee on Mon Oct 12, 2015 12:56 pm

Setup the LED and button, and they work fine. Any suggestions?

The only thing I can think of is reloading/bootstrapping a rPi B model and see if it has the same issues. Defeats my purpose since I want to use the model A+, but I don't know what else to do to get this working. Bug?

larscee
 
Posts: 12
Joined: Thu Oct 17, 2013 2:44 pm

Re: Raspberry Pi - Digital output

by uniontownlabs on Mon Oct 12, 2015 3:04 pm

Give this a shot:

Code: Select all | TOGGLE FULL SIZE
$ cd ~/adafruit-io-basics/raspberry_pi/
$ rm -rf node_modules
$ npm install

You should get gpio-stream@1.0.17 & onoff@1.0.3 during the install. If the install works as expected, try running the example again. If not, try posting the output from npm and I'll take a look.

uniontownlabs
 
Posts: 112
Joined: Wed Dec 17, 2014 10:56 pm

Re: Raspberry Pi - Digital output

by larscee on Mon Oct 12, 2015 4:42 pm

Thank you. Haven't gotten this many errors in the past.

Code: Select all | TOGGLE FULL SIZE
sudo npm install
npm WARN package.json adafruit-io-basics@1.0.3 No README data
\
> utf-8-validate@1.2.1 install /home/pi/adafruit-io-basics/raspberry_pi/node_modules/adafruit-io/node_modules/mqtt/node_modules/websocket-stream/node_modules/ws/node_modules/utf-8-validate
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.12.6"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/adafruit-io-basics/raspberry_pi/node_modules/adafruit-io/node_modules/mqtt/node_modules/websocket-stream/node_modules/ws/node_modules/utf-8-validate/.node-gyp"

gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: read ECONNRESET
gyp ERR! stack     at exports._errnoException (util.js:746:11)
gyp ERR! stack     at TCP.onread (net.js:559:26)
gyp ERR! System Linux 4.1.10+
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/adafruit-io-basics/raspberry_pi/node_modules/adafruit-io/node_modules/mqtt/node_modules/websocket-stream/node_modules/ws/node_modules/utf-8-validate
gyp ERR! node -v v0.12.6
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok

> bufferutil@1.2.1 install /home/pi/adafruit-io-basics/raspberry_pi/node_modules/adafruit-io/node_modules/mqtt/node_modules/websocket-stream/node_modules/ws/node_modules/bufferutil
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.12.6"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/adafruit-io-basics/raspberry_pi/node_modules/adafruit-io/node_modules/mqtt/node_modules/websocket-stream/node_modules/ws/node_modules/bufferutil/.node-gyp"
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn ENOMEM
gyp ERR! stack     at exports._errnoException (util.js:746:11)
gyp ERR! stack     at ChildProcess.spawn (child_process.js:1162:11)
gyp ERR! stack     at Object.exports.spawn (child_process.js:995:9)
gyp ERR! stack     at Gyp.spawn (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js:186:26)
gyp ERR! stack     at runGyp (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:18)
gyp ERR! stack     at findConfigs (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:258:23)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:264:11
gyp ERR! stack     at FSReqWrap.oncomplete (evalmachine.<anonymous>:95:15)
gyp ERR! System Linux 4.1.10+
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/adafruit-io-basics/raspberry_pi/node_modules/adafruit-io/node_modules/mqtt/node_modules/websocket-stream/node_modules/ws/node_modules/bufferutil
gyp ERR! node -v v0.12.6
gyp ERR! node-gyp -v v2.0.1
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR!     <https://github.com/TooTallNate/node-gyp/issues>
npm WARN optional dep failed, continuing utf-8-validate@1.2.1

> epoll@0.1.16 install /home/pi/adafruit-io-basics/raspberry_pi/node_modules/gpio-stream/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/0.12.6"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/adafruit-io-basics/raspberry_pi/node_modules/gpio-stream/node_modules/onoff/node_modules/epoll/.node-gyp"

gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn ENOMEM
gyp ERR! stack     at exports._errnoException (util.js:746:11)
gyp ERR! stack     at ChildProcess.spawn (child_process.js:1162:11)
gyp ERR! stack     at Object.exports.spawn (child_process.js:995:9)
gyp ERR! stack     at Gyp.spawn (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js:186:26)
gyp ERR! stack     at runGyp (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:18)
gyp ERR! stack     at findConfigs (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:258:23)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:264:11
gyp ERR! stack     at FSReqWrap.oncomplete (evalmachine.<anonymous>:95:15)
gyp ERR! System Linux 4.1.10+
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/adafruit-io-basics/raspberry_pi/node_modules/gpio-stream/node_modules/onoff/node_modules/epoll
gyp ERR! node -v v0.12.6
gyp ERR! node-gyp -v v2.0.1
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR!     <https://github.com/TooTallNate/node-gyp/issues>
npm WARN optional dep failed, continuing bufferutil@1.2.1
npm ERR! Linux 4.1.10+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v0.12.6
npm ERR! npm  v2.11.2
npm ERR! code ELIFECYCLE

npm ERR! epoll@0.1.16 install: `node-gyp rebuild`
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the epoll@0.1.16 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the epoll package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls epoll
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/pi/adafruit-io-basics/raspberry_pi/npm-debug.log


I'm wondering if it's an issue with the newest version of Raspbian (jessie). I've been attempting to bootstrap it on the Raspberry Pi B all afternoon. Downloading wheezy now to give that a shot. Maybe this is noted somewhere, but I haven't seen anything specific.

larscee
 
Posts: 12
Joined: Thu Oct 17, 2013 2:44 pm

Re: Raspberry Pi - Digital output

by uniontownlabs on Mon Oct 12, 2015 5:20 pm

you shouldn't need to do sudo for the npm install of the adafruit-io-basics dependencies, but i don't think that's the issue. i don't have jessie on a pi to test right now, but give this a shot.

Code: Select all | TOGGLE FULL SIZE
$ sudo npm install -g n
$ sudo n stable
$ node -v
v4.2.0

then, follow this guide to make sure you have the proper version of gcc:
https://github.com/fivdi/onoff/wiki/Nod ... ive-addons

then, try this again without the sudo on the npm install step:
Code: Select all | TOGGLE FULL SIZE
$ cd ~/adafruit-io-basics/raspberry_pi/
$ rm -rf node_modules
$ npm install

uniontownlabs
 
Posts: 112
Joined: Wed Dec 17, 2014 10:56 pm

Re: Raspberry Pi - Digital output

by larscee on Mon Oct 12, 2015 5:27 pm

Ok, I thought that might be the case.

Code: Select all | TOGGLE FULL SIZE
$ sudo npm install -g n
/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n
n@2.0.2 /usr/local/lib/node_modules/n
$ sudo n stable

     install : node-v4.2.0

  Error: invalid version 4.2.0

larscee
 
Posts: 12
Joined: Thu Oct 17, 2013 2:44 pm

Re: Raspberry Pi - Digital output

by uniontownlabs on Mon Oct 12, 2015 5:36 pm

could you give me the output of this:
Code: Select all | TOGGLE FULL SIZE
$ uname -a

uniontownlabs
 
Posts: 112
Joined: Wed Dec 17, 2014 10:56 pm

Re: Raspberry Pi - Digital output

by larscee on Mon Oct 12, 2015 8:19 pm

Code: Select all | TOGGLE FULL SIZE
Linux raspberrypi 4.1.10+ #820 PREEMPT Sun Oct 4 15:33:59 BST 2015 armv6l GNU/Linux

larscee
 
Posts: 12
Joined: Thu Oct 17, 2013 2:44 pm

Re: Raspberry Pi - Digital output

by uniontownlabs on Tue Oct 13, 2015 10:47 am

thanks. i'll spin up a pi with jessie, get it working, and get back to you.

uniontownlabs
 
Posts: 112
Joined: Wed Dec 17, 2014 10:56 pm

Re: Raspberry Pi - Digital output

by larscee on Tue Oct 13, 2015 11:00 am

Awesome, thank you. I'll continue working on it on my end and see if I can get anything going.

larscee
 
Posts: 12
Joined: Thu Oct 17, 2013 2:44 pm

Re: Raspberry Pi - Digital output

by larscee on Tue Oct 13, 2015 2:03 pm

I can't get Node.js to work at all on the Pi. I've tried installing wheezy, jessie, updating the installations, trying to bootstrap with Adafruit Occidentilis, etc etc and can not get Node v4 installed nor get Adafruit IO working.

Hoping you can find something. I'm going to try moving to Python, since it's something I'm more familiar with and see if that works.

larscee
 
Posts: 12
Joined: Thu Oct 17, 2013 2:44 pm

Please be positive and constructive with your questions and comments.