Skip to content

Commit 4aefc2c

Browse files
author
Martin Schuhfuss
committed
update readme
1 parent 768f206 commit 4aefc2c

File tree

1 file changed

+40
-11
lines changed

1 file changed

+40
-11
lines changed

README.md

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# control ws281x-LEDs with node.js
22

3-
> if you happen to know C++ and node/V8, I would really appreciate any help and feedback on this module.
3+
> if you happen to know C++ and node/iojs/V8, I would really appreciate any help
4+
> and feedback on this module.
45
> There is certainly lots of room for improvement.
56
67
This module provides native bindings to the [rpi_ws281x](https://github.com/jgarff/rpi_ws281x)
@@ -23,7 +24,7 @@ if you prefer installing from source:
2324

2425
## usage
2526

26-
this module exports only three functions to send data to the LED-String.
27+
this module mainly exports four functions to send data to the LED-String.
2728

2829
```javascript
2930
exports = {
@@ -61,6 +62,23 @@ exports = {
6162
};
6263
```
6364

65+
### Index-Mapping
66+
67+
As the wiring of the LEDs not neccessarily corresponds to the pixel-ordering in the
68+
data-array, this module supports index-remapping. So, if you are building a grid of LEDs you can just use an alternating, top-to-bottom or mirrored wiring and use the remapping in order to use a unified structure in the incoming data-arrays.
69+
70+
### Events
71+
72+
In Addition to that, the exported object is an `EventEmitter` that will emit the following Events:
73+
74+
* `beforeRender`: emitted just before the data is prepared and sent to the LED-driver.
75+
The handler will receive the pixel-data array (an `Uint32Array`) as single argument.
76+
As this event is handled synchronously, you can use this to manipulate the data before
77+
it is sent to the LED-Strip.
78+
* `render`: emitted after the data has been sent to the LED-Strip. The single argument
79+
passed to the handler is the final pixel-data array, after index-remapping and
80+
gamma-correction.
81+
6482
## testing basic functionality
6583

6684
connect the WS2812-strip to the raspberry-pi as described [here](https://learn.adafruit.com/neopixels-on-raspberry-pi/wiring)
@@ -70,15 +88,26 @@ You should now see some rainbow-colors animation on the LED-strip.
7088

7189
## hardware
7290

73-
There is a guide [over at adafruit.com](https://learn.adafruit.com/neopixels-on-raspberry-pi) on how
74-
to get the hardware up and running. Essentially, you need the Raspberry Pi, a logic-level converter
75-
to shift the output-voltage of the GPIO from 3.3V up to 5V (should be fast enough to handle 800kHz,
76-
the guide mentions the 74AHCT125, mine is an 74HCT125N) and of course an LED-Strip or other types of WS2812-LEDs.
91+
There is a guide [over at adafruit.com](https://learn.adafruit.com/neopixels-on-raspberry-pi)
92+
on how to get the hardware up and running. I followed these instructions by the word and had a working LED-strip.
93+
94+
Essentially, you need the Raspberry Pi, a logic-level converter to shift the output-voltage of the GPIO from 3.3V up to 5V (the guide mentions the 74AHCT125, mine is an 74HCT125N which works just as well) and of course a LED-Strip or other types of WS2812-LEDs.
7795

7896
To connect all that together, I'd recommend buying a small breadboard and some jumper-wires.
79-
Also, consider buing a 5V power-supply that can deliver up to 60mA per LED (so you'll need 6A to fully power 100 LEDs).
80-
For smaller applications, a decent USB-charger should do.
97+
Also, consider buying a 5V power-supply that can deliver up to 60mA per LED (so you'll need
98+
up to 6A to fully power 100 LEDs). For smaller applications, a decent USB-charger should do.
99+
100+
### Buying stuff
101+
102+
A short checklist of what you will need:
103+
104+
* Raspberry-PI and SD-Card
105+
* 5V power-supply (Meanwell for instance builds really good ones)
106+
* LED-Strip with WS2811/WS2812 Controllers (there are several other controller-variations
107+
that are not supported)
108+
* a breadboard and some jumper-wires (m/m as well as at least two f/m to connect the GPIO-Pins)
109+
* a 3.3V to 5V logic-level converter (74AHCT125 or 74HCT125N, others will probably also work)
110+
* more wire to connect the LED-strips
81111

82-
You can buy everything you need at adafruit or any other electronics reseller
83-
(germany: check [conrad electronic](http://www.conrad.de) or [watterott](http://watterott.com) – this is
84-
where i bought most of my stuff).
112+
You can buy everything at [adafruit.com](https://adafruit.com), [sparkfun](https://sparkfun.com), on ebay or your favourite electronics retailer (germany: check [conrad electronic](http://www.conrad.de) or [watterott](http://watterott.com)
113+
where i bought most of my stuff).

0 commit comments

Comments
 (0)