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.
User avatar
larscee
 
Posts: 12
Joined: Thu Oct 17, 2013 2:44 pm

Raspberry Pi - Digital output

Post by larscee »

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- ... spberry-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

  "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"
    }
  ]
}

User avatar
jwcooper
 
Posts: 1004
Joined: Tue May 01, 2012 9:08 pm

Re: Raspberry Pi - Digital output

Post by jwcooper »

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

Code: Select all

node -v

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

Re: Raspberry Pi - Digital output

Post by larscee »

Code: Select all

~/adafruit-io-basics/raspberry_pi $ node -v
v0.12.6

User avatar
jwcooper
 
Posts: 1004
Joined: Tue May 01, 2012 9:08 pm

Re: Raspberry Pi - Digital output

Post by jwcooper »

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.

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

Re: Raspberry Pi - Digital output

Post by larscee »

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

Code: Select all

npm install gpio-stream
npm WARN package.json [email protected] No README data
/
> [email protected] 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'
[email protected] node_modules/gpio-stream
âââ [email protected] ([email protected])

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

Re: Raspberry Pi - Digital output

Post by larscee »

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?

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

Re: Raspberry Pi - Digital output

Post by uniontownlabs »

Give this a shot:

Code: Select all

$ cd ~/adafruit-io-basics/raspberry_pi/
$ rm -rf node_modules
$ npm install
You should get [email protected] & [email protected] 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.

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

Re: Raspberry Pi - Digital output

Post by larscee »

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

Code: Select all

sudo npm install
npm WARN package.json [email protected] No README data
\
> [email protected] 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

> [email protected] 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 [email protected]

> [email protected] 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 [email protected]
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! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the [email protected] 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.

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

Re: Raspberry Pi - Digital output

Post by uniontownlabs »

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

$ 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

$ cd ~/adafruit-io-basics/raspberry_pi/
$ rm -rf node_modules
$ npm install

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

Re: Raspberry Pi - Digital output

Post by larscee »

Ok, I thought that might be the case.

Code: Select all

$ sudo npm install -g n
/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n
[email protected] /usr/local/lib/node_modules/n
$ sudo n stable

     install : node-v4.2.0

  Error: invalid version 4.2.0

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

Re: Raspberry Pi - Digital output

Post by uniontownlabs »

could you give me the output of this:

Code: Select all

$ uname -a

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

Re: Raspberry Pi - Digital output

Post by larscee »

Code: Select all

Linux raspberrypi 4.1.10+ #820 PREEMPT Sun Oct 4 15:33:59 BST 2015 armv6l GNU/Linux

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

Re: Raspberry Pi - Digital output

Post by uniontownlabs »

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

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

Re: Raspberry Pi - Digital output

Post by larscee »

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

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

Re: Raspberry Pi - Digital output

Post by larscee »

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.

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”