Code Monkey home page Code Monkey logo

Comments (28)

kyle-ssg avatar kyle-ssg commented on September 27, 2024

Hey @chunk100, thanks for letting us know about Raspberry Pi weekly - that's pretty cool! Apologies for the late reply, a lot of us were out at SXSW.

Would be glad to help you out here, I'm pretty keen to see what people can build with this. Are you looking for more of a guide on the hardware side or software? Anything that isn't obvious I'll write up and add to the Read me.

If you've run rio node server on your pi hooked up to your monitor (or anything else if that's more convinient) you will notice that the console starts showing a grid of leds, there's configuration here to output everything you see on the console to a pi that is running rio-server and server.py.

If you want to output to the pi you set sendToPi:true and connect your LEDS up to the GPIO pins 18 and 19 and run python ./firmware/rpi/server.py alongside your node server. The firmware and PIN configuration can be found Here. Assuming you can run a strand test it should all work fine!

edit: Glediator software looks pretty cool! This seems to be a good fit as a custom client - we're concentrating on other things internally on this project however I'd be happy to accept a PR that added this integration.

from rio.

chunk100 avatar chunk100 commented on September 27, 2024

from rio.

kyle-ssg avatar kyle-ssg commented on September 27, 2024

No problem for the reply. The software side is something I can definitely help with πŸ˜„ . Getting the strand test working is a good start, that way we can concentrate on getting the python firmware and rio-server all configured to your matrix. You won't really have to do that much to get this up and running.

Assuming you have ran the commands in the installation section of the readme, here's what you need to do:

Step 1 - configure your matrix dimensions
Change matrix in rio-server/config/index.js to your width and height.

Step 2 - verify that the output is correct
Running rio-server (npm run server) will output a gif to the console at 10x15px. You can change the gif by editing rio-server/index.js.

Step 3 - configure firmware and set server to send to pi
Set sendToPi: true in rio-server/config/index.js. (This will basically write all pixel data seen in the console to a stream which is picked up by the python firmware).

Change the firmware to output to the correct number of pixels
rio-server/firmware/rpi/server.py

  • set conn.recv(6120) to conn.recv(450) (the number of LEDs x3 - r,g,b)
  • set LED_COUNT = 1020 to LED_COUNT = 150 (the number of LEDs)

Step 4 - run node server and python firmware on the pi
npm run server
python ./firmware/rpi/server.py

from rio.

chunk100 avatar chunk100 commented on September 27, 2024

from rio.

lukefanning avatar lukefanning commented on September 27, 2024

Hi @chunk100, I am another engineer who worked on rio. Yep you shouldn't need Linuxbrew to install those packages. Instead run apt-get install pkg-config cairo libpng jpeg giflib and it should pick them up. You might need to upgrade your pi from Wheezy to Jessie if you start running into GCC compiler errors when installing those packages. I'm fairly certain I was forced to do so for either those packages or ffmpeg codecs support but can't remember which. Perhaps let me know the error before embarking on any sort of OS upgrade.

from rio.

chunk100 avatar chunk100 commented on September 27, 2024

from rio.

lukefanning avatar lukefanning commented on September 27, 2024

Ok great nearly there! You aren't actually running the server with that command npm i but you are attempting to install rio-server's dependencies with it. You're running a very old version of Node (+ npm). You'll need to upgrade to at least version 6. I now recall this can be a cause for needing an OS upgrade to Jessie. Try the following:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install nodejs

then run node -v and see whether it gives you back a version number starting with 6. If you get a nasty looking GCC error it looks like you'll be needing to upgrade the OS unfortunately.

from rio.

chunk100 avatar chunk100 commented on September 27, 2024

from rio.

lukefanning avatar lukefanning commented on September 27, 2024

As long as its at least version 6 then it should be fine. I recommend v6 simply because it is very stable and contains all the ES6 features etc required for rio-server to run.

Regarding the node-canvas dependencies, I don't remember it being that complicated.. I think its just that the package names are different on the apt repo. Would appreciate any documentation you're willing to give once you have it running. I didn't write enough down!

from rio.

chunk100 avatar chunk100 commented on September 27, 2024

from rio.

chunk100 avatar chunk100 commented on September 27, 2024

Turns out I also needed
sudo apt-get giflib-dbg
Installed all the prerequisites and everything else seemed to be OK. If I then run npm run server, I get the following error messages. Just wondered if you managed to get this running on a pi????!

pi@mypi:~/rio $ npm run server

[email protected] server /home/pi/rio
cd ./rio-server && npm start

[email protected] start /home/pi/rio/rio-server
node index.js

[SECURITY] node-uuid: crypto not usable, falling back to insecure Math.random()
/home/pi/rio/rio-server/node_modules/units-css/lib/utilities.js:114
return utilities.getCreatedElementWidth(document.body, {
^

ReferenceError: document is not defined
at /home/pi/rio/rio-server/node_modules/units-css/lib/utilities.js:114:43
at Object. (/home/pi/rio/rio-server/node_modules/units-css/lib/utilities.js:117:2)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/home/pi/rio/rio-server/node_modules/units-css/lib/conversions/length.js:6:17)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)

npm ERR! Linux 4.4.50-v7+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v6.10.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node index.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the rio-server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node index.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs rio-server
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls rio-server
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/pi/rio/rio-server/npm-debug.log

npm ERR! Linux 4.4.50-v7+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "server"
npm ERR! node v6.10.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] server: cd ./rio-server && npm start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] server script 'cd ./rio-server && npm start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the rio package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cd ./rio-server && npm start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs rio
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls rio
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

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

from rio.

lukefanning avatar lukefanning commented on September 27, 2024

Yep another dependency needed for node-canvas to install correctly. You need to run sudo apt-get install libgif-dev and then re-run npm i. As for the error you're getting on running the server with npm run start I am actually seeing the same thing. I think there's been a change in the latest version of node-canvas. Will get back to you on a solution

from rio.

lukefanning avatar lukefanning commented on September 27, 2024

If you do a pull on rio-server, I have frozen the canvas version to 1.6.3 which is the last version that actually works. Try again with that. Also the node-canvas README did have a list of the Linux based dependencies sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++.

from rio.

chunk100 avatar chunk100 commented on September 27, 2024

Tried again, it took a long time but seemed to work without any errors. I took lots of notes so hope to write it all up sometime. I then edited the matrix size as above.

I then ran the server (using sudo) and got a few error messages but the screen then came to life as a flickering fragment of the gif. However.... (see below!)

pi@mypi:~/rio $sudo npm run server

[email protected] server /home/pi/rio
cd ./rio-server && npm start

[email protected] start /home/pi/rio/rio-server
node index.js

[SECURITY] node-uuid: crypto not usable, falling back to insecure Math.random()
error: not_authed
error: unrecoverable failure connecting to the RTM API: not_authed

I edited the server.py file to my 10x15 grid and also got rid of strip2 as not required. For infor, suspect also need to edit the line:

Check whether end of frame has been reached and if so reset pixel index and show pixels
if index == 10 * 15:#

Then run the server.py in a different Terminal window
sudo python server.py
Opening socket...
Listening...
accepted connection

And thats where it stops. I tested the grid using a simple strandtest program and it works, however, dont appear to be lighting any lights :(

from rio.

lukefanning avatar lukefanning commented on September 27, 2024

Hi @chunk100 Have you enabled sendToPi in config/index.js in rio-server? And while you're in there update the matrix size as well if you haven't done so already. Make sure to start the python script before running the node side. At some point we plan to change rio-server so that it starts the python script from within the node process.

As for that error, its probably coming from the initialisation of the Twitter integration. It would normally need to be configured in config/index.js. It should be optional and we'll look into that. I don't think it prevents the server from sending image data though.

from rio.

chunk100 avatar chunk100 commented on September 27, 2024

I had another look at this today but still cant make progress. The index.js file has sendToPi set to true and all else works but still get stuck on the 'accepted connection'.

Looking at the server.py file, it seems to be getting stuck on the line data = conn.recv(450) line. I used 450 as assumed this is3x the total number of pixels to cover R G and B.

Is there any way to see what the server.py file is receiving if anything?

PS
By the way, the server.py file and the rio server are run on the same Raspberry Pi. Assume this i OK??

from rio.

lukefanning avatar lukefanning commented on September 27, 2024

Yep its actually a requirement to run both on the same RPi as they use a IPC socket to communicate. You could add in a print "Calling show on strips" before strip.show() in server.py to make sure that the script is receiving pixel data from rio-server. Its expected that Accepted connection is the last thing you'll see before it starts lighting up LEDs. Try running singlestrandtest.py after editing the values at the top for your LED grid. If that works as expected then send me your server.py so I can double check it. I know that you would have had to have edited it for your single strip.

from rio.

chunk100 avatar chunk100 commented on September 27, 2024

Thanks for the reply. I did try what you suggested and even added some other troubleshooting including a quick test of the pixels prior to any of the 'Open socket' lines. I also added a line print("received") just after the 'data = conn.recv(450)' which is never displayed so it is getting stuck on this 'data = conn.recv(450)' line. Is there any way to tell if the data is being transmitted in the first place?

Note I also have to run the server.py file as sudo otherwise the pixels dont work.

Interestingly when I close the npm server by selecting ctrl-C, the server.py file then moves on and prints "received".

Im happy to send the server.py file if it will help, just let me know where

from rio.

lukefanning avatar lukefanning commented on September 27, 2024

Yep to tell if data is being sent in the first place you will need to add some console logging to outputs/pi-output.js. In drawFrame() add console.log(channel ? 'Connected to RPi and drawing frame' : 'Not connected to RPi. Cannot draw frame'). Yes I would expect that both rio-server and the python script would both be run as root. If you aren't running the former as root that might be why it's not working as both sides require access to the /tmp folder on your RPi. Will make sure to add that to the rio instructions if it solves your issue. I'll have a think about why the python script seems to move on after stopping rio. Sounds like rio-server is holding up the pipe hopefully because its not being run as root.

from rio.

chunk100 avatar chunk100 commented on September 27, 2024

I have been running it all as root, one of the first things tried actually - it makes a difference for the server.py but not the rio server. Its worth adding to the instructions anyway.

I edited pi-output.js and drawFrame() now looks like this:

drawFrame: function(frame, cb) {
    callback = cb;
    channel && channel.emit(frame);
    console.log(channel ? 'Connected to RPi and drawing frame' : 'Not connected to RPi. Cannot draw frame');
},

I ran everything again and nothing changed, have I done it right?

Just out of curiosity, have you tried installing this on a Pi from a fresh install?!!

from rio.

lukefanning avatar lukefanning commented on September 27, 2024

We haven't installed rio on a fresh RPi yet. Looks like it is worth doing :).

Ok so you don't see that console.log() message at all in rio-server's output? That either indicates nothing is actually being sent to the pi-output or its locking up on the IPC stuff which would be unexpected. Can you confirm that you've left the current startup GIF in rio-server/index.js as the default i.e. the rio GIF. Does your RPi have internet access? That would be required for download of the GIF. Can you run ls /tmp on your RPi and confirm whether you see a app.main file in there?

from rio.

chunk100 avatar chunk100 commented on September 27, 2024

Havnt touched the gif, its the same one. Pi is also attached to internet

app.main is in the /tmp directory.

Still nothing coming through on server.py

from rio.

lukefanning avatar lukefanning commented on September 27, 2024

Can you put a console.log('Drawing frame'); at the top of the drawFrame() func in pi-output.js and re run rio-server? Leave the other logging message in there. Need to be sure about whether rio-server ever calls this function or not. I think its failing on the channel.emit() line (but I don't know why) and Node.js doesn't necessarily always produce error output unless capturing all uncaught exceptions. I wouldn't mind taking a direct look at your RPi over SSH if you were willing to give me appropriate credentials (i.e. with superuser privileges). Just send me a PM if you're comfortable doing that.

from rio.

chunk100 avatar chunk100 commented on September 27, 2024

I added that line but it didnt change anything. Im not sure what else to try, maybe a fresh install all round?!!

from rio.

Chilus avatar Chilus commented on September 27, 2024

I'm having similar issues as chunk100, where running the command: npm run server and npm install in subfolders won't properly execute as many dependencies are missing. Especially the canvas module is giving a false path.

@kyle-ssg Could you have a look at this by trying to run your library on a fresh Pi3 install?

from rio.

kyle-ssg avatar kyle-ssg commented on September 27, 2024

@Chilus @chunk100 Sorry for the late reply, we've added some Pi specific installation instructions here
https://github.com/SolidStateGroup/rio/tree/master/rio-server. Doing this we were able to install on a fresh Pi and Raspbian VM within a couple minutes.

This topic has deviated to a few different things, I'm going to close this in the hope that the added instructions are of help. If you still face the same issue as the original description then reopen this issue, otherwise, it'd probably be less convoluted to open a new one with your specific query.

from rio.

vettorazi avatar vettorazi commented on September 27, 2024

hey guys. same probs here =/
i tried in a rpi 3 and in my zero w. the problem is the same.

from rio.

lukefanning avatar lukefanning commented on September 27, 2024

@chunk100 I think i may have spotted the extra step that has been preventing people from driving the LEDs in some cases. Did you have a /tmp folder on your RPi?

from rio.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.