Coder Social home page Coder Social logo

narioinc / node-rgb-matrix Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 1.26 MB

A nodejs express server to control RGB Matrix based on HUB75 connector using JS Canvas APIs. Advanced Layers and Animation support available OOB

License: Apache License 2.0

JavaScript 100.00%
canvas canvas2d hub75 hub75e javascript led nodejs raspberry-pi raspi3 rgb

node-rgb-matrix's Introduction

alt text

node-rgb-matrix

A nodejs express server to control RGB Matrix based on HUB75 connector

The project uses the excellent library by Alex Eden here: https://github.com/alexeden/rpi-led-matrix with a MAJOR addition.

I have found a way to easily use the JS Canvas APIs to write clamped arrays to the matrix. By exporting canvas to clamped arrays and then writing the array to the matrix, we now HAVE THE FULL POWER OF THE JS CANVAS APIS at our disposale.

Whats new !!

  • Uses the JS canvas APIs from Konva and Node Canvas package to create powerful drawing APis for the RGB matrix

  • Allows handling 2 or more canvas elements to create layers. Max 3 canvases work OK on a rpi 2 and 3B +. Rpi 4 and 5 may support more layers but not tested yet

  • Shapes and Animation only limited to your imagination. Have examples showing how to integrate with GSAP APIs for advances tweens and Easing

  • Still tries to maintain 60 fps as much as possible. Further Optimization are still possible if someone is willing to guide me.

  • Works great from RPi 2 and above. Tested with RPi Zero W 2, see the specific section on Rpi Zero 2W below. Other Linux boards may need a rebuild of the Node Canvas lib.

  • Integrates with Matterjs for cool physics stuff..see Demos

Dependencies

Before running the node installation, please ensure the following packages are installed (this is on any debian system, for your package manager, please adjust the command accordingly

sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

Run the demo

  • git clone https://github.com/narioinc/node-rgb-matrix
  • run npm install --save --build-from-source
  • RUN sudo npm start to start the server on port 3000 on all network interfaces.

Note for Rpi Zero 2W users

  • Change the version of the rpi-rgb-matrix library to v 1.11.1. tested on rpi zero 2w to work. v1.12, 1.13 and 1.14 get stuck for a long time during compilation. Change to "rpi-led-matrix": "1.11.1" in package.json. You can try v1.12.2 or above if you feel brave !!
  • Ensure that you can run npm install like so npm install --foreground-scripts --loglevel verbose
  • Something about the --foreground-scripts option makes the nodegyp steps work without getting stuck on the zero 2w. Thanks to @riffnshred for bringing this to my notice.
  • Compilation on the zero 2w does take a lot of time. Please be patient !! It took me excess of > 20 minutes to compile the nodejs c bindings. No issues on Rpi 3 and newer.

REST APIs

The express routes are evolving and currently we have the following endpoints

  • /mode: allows you to change different modes
  • /demo: allows you to play some demos

TBD

  • Improve diplay FPS further with the way frames are dispatched
  • P5.JS Support in demo soon !! once i wrap my head around their Canvas wrapper.

node-rgb-matrix's People

Contributors

narioinc avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

riffnshred

node-rgb-matrix's Issues

Error: Could not locate the bindings file

Following your instructions and I'm getting this error

Error: Could not locate the bindings file.

Running Node.js v20.12.2 on the latest raspberry pi OS on a Pi Zero 2W

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.