Teensy 3.1 + WS2812B + Node.js

Status
Not open for further replies.

Killermen

New member
Good afternoon everyone!

For a school project I want to make a ledcurtain with WS2812B strips. The ledcurtain would be 1m x 1m70. (90m of ledstrip in total)
I think i'm going to use a Teensy 3.1 with OctoWS2811 Adapter board. Also I think 2 power adapters of 5v 60A will be enough to supply power.

Also, I have some questions about how the OctoWS2811 library must receive its information. I looked to the processing project and I saw you take every frame, make it an image and send it to the Teensy. But I see some bit operations, but I don't see where you send the data or how the data is saved.

I ask this because I would want to rewrite this entire thing to a Node.js module so I can interact with the ledscreen from an internet page. Also would be usefull to know if anybody has some experience in this.

If anybody can me, you will be praised by me for your whole life :p

Kind regards,

Davy
Howest Kortrijk (Belgium)
 
The OctoWS2811 streams video to the one or more Teensys via serial port in movieEvent using the line

ledSerial.write(ledData);

So first question, can you write serial data from whatever Node.JS package you are using?

Suggest setting up an echo routine on an Arduino and explore the complexities there as a first stop.

The step from there is streaming a static image on a subset of say 8 strips of 4 pixels (32 can be powered from USB with care for a very simple low cost design), which means recreating the movieEvent block of the processing code but just sending a fixed pattern. I normally test with R values driven from the X axis values and Green driven from the Y to verify orientation etc is correct.

Looking at the code there and in the Arduino serial receive section you start with a '*' follwed by two bytes for the timing of the frame.

the remainder of the data is 3 bytes per LED broken up into chunks of 8. Most of the complexity in the image2data routine is due to allowing for multiple orientations. If you are electing to fix your layout the only if statement you will need is for even numbered strips running the wrong way (unless you plan to loop the signal wires so all strips run the same way). The bit rotation operations are to elegantly package up the Bytes and for the moment can be skipped because you are sending fixed values.

If you can get a static image to work then start the bigger adventure of packaging animations which will involve you in bit stuffing adventures. You will also need to investigate gamma correction since while the pixels take a range of 0-255 in each colour the difference between 0 and 1 is much more marked than 254-255 so the actual number of effective levels is between 8 and 16.

If you have not already brought the parts for this strongly suggest the first step of node.JS+any arduino, then buy the Teensy3+Octo board and 1 meter of strip. Only once you have rock solid code to a baby display start the process of purchasing and engineering the full size rig.
 
Node.js can write serial data, that's not an issue. I already worked with it to control a driving robot.

In Node.js I've found a module to screenshot a video and a module to get the colour of the pixels in a picture. I've looked in the Arduino-file (didn't know it was that well documented) and now I see what the symbols mean and what you do with the data.

The gamma correction that is in the Processing-example will normally also work in Node.js. But still, thx to mention it!

Also, a new question arised: I see you guys recommend to use 120 leds per line. But I think this is for Teensy 3.0. I'm going to work with Teensy 3.1. Can I double this? Because otherwise I would need to get lik 6 Teensy's.
 
I'm not sure where the 120 LEDs came from but the library page
https://www.pjrc.com/teensy/td_libs_OctoWS2811.html

gives 4000 per T3.1, along with links for project guidance. My largest project was only 8 by 12 LEDs so you can't say much more on your project since it looks like this ain't your first rodeo other than to echo the various posts about double checking power and grounds, and working to minimise noise in the data runs.

Should be an impressive project when it's done.
 
Well, in the example-folder you find the Arduino-file for VideoDisplay. In the documentation there it says that it's recommended to have 120 leds per line (otherwise framerate would drop).
 
Ah oops. so that's based around the physical time it takes to jamb data down the strands rather than the fact that one Teensy can happily managed 4000 LEDs worth of memory.

I guess at this point you decide what sort of video quality will be acceptable for you, which is not how you want to start a project off.

On the upside it would be possible to say start with 2 or 4 teensy's and upgrade to 6 if needed without to much hacking around of the actual LED display. Though given the bill for the LEDs and PSUs an extra 2 Teensy's aren't going to be a huge addition.

Will also tediously complicate your data channels since you will end up with a plethora of Teensy's on a USB hub to keep track of.
 
Yeah, I'm going to start with 4 Teensy's, then I can see what the FPS will be. I've already started coding to get the pixels out of an image and into an array (small start).
 
Bear in mind, WS2812B's are limited to the data rate (800kHz), which makes them less desirable for operations that need fast refresh like POV. Other light technologies like APA102 (that Adafruit calls Dotstars) might be more useful in those cases, though these technologies have their own set of trade-offs (APA102 is a 2 wire protocol, where one wire is clock, and the other data, plus APA102's tend to be more expensive).
 
Status
Not open for further replies.
Back
Top