Skip to content

[UNMAINTAINED] The library for running Neopixels on Tessel 1

Notifications You must be signed in to change notification settings

tessel/t1-neopixels

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[UNMAINTAINED] This library does not have a maintainer. The source code and repository will be kept at this URL indefinitely. If you'd like to help maintain this codebase, create an issue on this repo explaining why you'd like to become a maintainer and tag @tessel/maintainers in the body.

#Neopixels

Neopixels are strands of individually addressable RGB LEDs, made by Adafruit. Neopixels consist of individual WS2812B chips which are also sold by other vendors like SeeedStudio They're fantastic for creating light shows, art installations, mood lighting, and a ton of other applications.

This library is rather sparse at the moment and most of the functionality lies within a driver written in the firmware. It assumes a single strand of LEDs connected to pin G4 on the GPIO bank and RGB leds with a 800kHz signal.

##Installation If you are running firmware build 0.1.19 or later (tessel --version board), this library is already baked into the firmware. No need to install anything.

If you have firmware build 0.1.16 or later (tessel --version board) installed on Tessel, then you should install this library with npm: npm install neopixels

Then connect the circuit. You'll need a separate power source because these LEDs require a lot of juice. Check out Adafruit's Powering Guide for the best advice. Best practice is to power the neopixels with 3.7V when using Tessel (since it is a 3.3V MCU) but 5V has worked fine in practice. Connect the data wire to G4 on Tessel's GPIO bank and connect GND on Tessel to both GND wires from the neopixels.

##Usage

Example:

// Import the neopixels library
var Neopixels = require('../');

// Make an instance of the strip
var neopixels = new Neopixels();

// When an animation completes
neopixels.on('end', function() {
  // Start the animation again
  neopixels.animate(100, Buffer.concat(tracer(100)));
});

/* 
* Start an animation!
* First argument is number of pixels per animation frame (usually the number of pixels in your strip)
* The second argument is the animation data
* The third optional argument is a callback on completion

* The library will automatically split the animation up
* into the appropriate number of animation frames
* based on the size of each frame (first argument)
*/
neopixels.animate(100, Buffer.concat(tracer(100)));


// An example animation
function tracer(numLEDs) {
  var trail = 5;
  var arr = new Array(numLEDs);
  for (var i = 0; i < numLEDs; i++) {
    var buf = new Buffer(numLEDs * 3);
    buf.fill(0);
    for (var col = 0; col < 3; col++){
      for (var k = 0; k < trail; k++) {
        buf[(3*(i+numLEDs*col/3)+col+1 +3*k)] = 0xFF*(trail-k)/trail;
      }
    }
    arr[i] = buf;
  }
  return arr;
}

##Contributions

This library could use a ton of help! If you're going to help, you'll need to get your hands dirty with some C in our firmware. Check out the firmware and you'll need to be able to compile your own firmware.

Email me at jon@technical.io if you're interested.

Things that need doing:

  • {EASY} Making it possible to configure to run with a 400kHz signal as well.
  • {EASY} Making it possible to configure which pwm pin (G4, G5, or G6) the data is output on.
  • {MEDIUM [Non-firmware]} Add more example animations to the node module.
  • {HARD} Enable 3x the frame rate by allowing 3 animations to be passed in and outputting animations on all 3 pwm pins (G4, G5, and G6 on the GPIO bank).

About

[UNMAINTAINED] The library for running Neopixels on Tessel 1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published