npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

hooloovoo

v1.0.7

Published

Control APA102 RGB LEDs via SPI

Readme

Hooloovoo

A superintelligent shade of the color blue.

This is a node.js library to control a APA102 RGB LED strip via SPI with your Raspberry Pi.

Control APA102 programmable LEDs with node.js

Installation

npm install hooloovoo

This module is located on npm as hooloovoo

Initialization

var hooloovoo = require('hooloovoo');
hooloovoo.setup(54); // The number of LEDs 

Parameters:

  • the number of LEDs your apa102 strip has (32,60,...)
  • (optional) the SPI clock (must be a power of 2). Default is 128

Fill strip with one color

hooloovoo.fill_hex("FF0000");

Set the whole strip the same color with a Hex value.

Parameters:

  • A hex value. Between 000000 and FFFFFF

This example sets the all the LEDs in the strip red (FF0000)

hooloovoo.fill_RGB(255,0,0);

Set the whole strip the same color with RGB values.

Parameters:

  • red value (0 to 255)
  • green value (0 to 255)
  • blue value (0 to 255)

This example sets the all the LEDs in the strip red (255,0,0)

hooloovoo.fill_BGR(0,0,255);

Since APA102 LED strips are BRG, there is an option to set them in their native format.

Parameters:

  • blue value (0 to 255)
  • green value (0 to 255)
  • red value (0 to 255)

This example sets the all the LEDs in the strip red (0,0,255)

Set LED color individually

hooloovoo.set_pixel_hex(0,FF0000);  // set LED1 to red

Parameters:

  • Select an LED(0 to number of LEDs -1)
  • A hex value. Between 000000 and FFFFFF

This example sets LED 0 (first LED) red. (FF0000)

hooloovoo.set_pixel_RGB(0,255,0,0); // set LED1 to red

Parameters:

  • Select an LED(0 to number of LEDs -1)
  • blue value (0 to 255)
  • green value (0 to 255)
  • red value (0 to 255)

This example sets LED 0 (first LED) red. (255,0,0)

hooloovoo.set_pixel_BGR(0,0,0,255); // set LED1 to red

Since APA102 LED strips are BRG, there is an option to set them in their native format. Parameters:

  • Select an LED(0 to number of LEDs -1)
  • blue value (0 to 255)
  • green value (0 to 255)
  • red value (0 to 255)

This example sets LED 0 (first LED) red. (0,0,255)

Get the RGB value of a pixel

hooloovoo.get_pixel_RGB(0);

Returns an array of the RGB value of the targeted pixel

Parameters:

  • the LED you want to know the RGB value of
hooloovoo.get_pixel_RGB(0); // if the LED was red, would return [255,0,0]

Turn off all the LEDs

hooloovoo.clear();

This turns off all the LEDs

Set the SPI clock

hooloovoo.set_clock(128);

Parameters: The SPI clock (must be a power of 2). Default is 128

Send buffer to SPI

hooloovoo.write_strip();

Sends all stored colors to the APA102 strip.
Not normally needed, but exposed for reasons.

Example

var hooloovoo = require('hooloovoo');

// connecting to Raspberry Pi 
hooloovoo.setup(10, 16); // assign number of APA102 LEDs, assign SPI clock
hooloovoo.set_clock(16); // OPTIONAL - Assign SPI clock - same as 2nd value of setup(), so unnecessary if you set it in setup(). Set this individually if you like.

var led_count = 10;

// set all colors to red 
console.log('fill all red');
hooloovoo.fill_RGB(255,0,0);

// after 2 seconds set first 6 LEDs to (red, green, blue, red, green, blue) 
setTimeout(function(){
  console.log("red green blue red green blue");
  // set_pixel_RGB(ledIndex,r,g,b); 
  // ledIndex: 0 = LED1, 1 = LED2, … 
  // red: (0-255), green: (0-255), blue: (0-255)
  hooloovoo.set_pixel_RGB(0,255,0,0);   // set LED1 to red 

  // set_pixel_hex(ledIndex, hexColor); 
  // ledIndex: 0 = LED1, 1 = LED2, … 
  // hexColor: '#FF0000' = red, '#00FF00' = green, ... 
  hooloovoo.set_pixel_hex(1,'00FF00');  // set LED2 to green 
    
  // set_pixel_BGR(ledIndex,b,g,r); 
  // ledIndex: 0 = LED1, 1 = LED2, … 
  // blue: (0-255), green: (0-255), red: (0-255)
  hooloovoo.set_pixel_BGR(2,255,0,0);   // set LED3 to blue 
  
  hooloovoo.set_pixel_hex(3,'FF0000');  // set LED4 to red 
  hooloovoo.set_pixel_hex(4,'00FF00');  // set LED5 to green 
  hooloovoo.set_pixel_hex(5,'0000FF');  // set LED6 to blue 
}, 2000);

When running this example the LED strip will first fill all LEDs with red.
After 2 seconds it sets the color of the first 6 LEDs to (red, green, blue, red, green, blue).

Wiring the Raspberry Pi

Connect your Pi like this to the LED driver:

| Raspberry Pi | led driver | |:------------:|:----------:| | GND | GND | | 5V | input V+ | | SCLK | input CLK | | MOSI | input DIN |

I am not responsible for any damages to your hardware. Use this at your own risk.