Categories
TUTORIALS

Data Stream input to NeoPixel LED Strip

Introduction

This tutorial is an overview of how to use a NeoPixel LED strip in conjunction with a feed of data such that specific numeric inputs result in corresponding lights on the strip being turned on. The sketch uses a random number generator to create a stream of inputs, but in practice, the stream of randomly selected integers can be replaced by any similar live data. The integers in the data stream represent individual LEDs on the strip to be activated. The random number generator in the sketch creates up to five integers per second, but the stream can include up to 60 integers—one for each LED on the strip.

Parts List

  1. Arduino UNO Board & Starter Kit
  2. Adafruit NeoPixel Digital RGBW LED Strip (with at least 60 LEDs)
  3. Adafruit Female DC Power Adapter
  4. Adafruit 5V 2A wall charger

Also recommended: Radial Leaded 1000uF 10volts Electrolytic Capacitor

Wiring and Circuit Diagram

This sketch requires two different power sources. The Arduino board itself is powered by the USB connection to the computer being used to run the sketch, but the LED strip itself needs a current level beyond what the Arduino board is capable of supplying.

First, connect the wall charger to the Female DC Power Adapter. Then, connect the front end of the LED strip (the side from which the small black arrows on strip flow away) to the female adapter by inserting the red 5V Power wire into the square hole marked “+” and the black ground wire into the square hole marked “-“. By untightening the screws on the adapter, inserting the wires, then re-tightening the screws, the wires can be securely connected to the adapter without the need for soldering.

Before retightening, you may also wish to insert the Electrolytic Capacitor to the female power adapter. This is recommended, as the capacitor helps to reduce voltage pulsation from the 5V 2A power source coming from the wall outlet, providing a more consistent charge to the LED strip. Connect the capacitor to the female adapter such that its (longer) positive end is inserted into the square hole marked “+” and the negative end is inserted into the square hole marked “-“.

In addition to the 5V power wire and ground wire, there are connected white and black wires coming from the front of the LED strip. Connect these to the Arduino board such that the black one is connected to the GND Pin and the white one is connected to PIN 6.

See the diagram below for a breadboard circuit diagram:

See the image below for an image of the setup:

Code

Run the sketch below with the Arduino board and LED strip powered as described in the previous section.

Use Cases

The tutorial and accompanying sketch may be useful for anyone wanting to take on a project involving LEDs reacting to a real-time flow of data. One could imagine a wide variety of projects involving sensors in conjunction with an LED strip involving real-time data. An interactive art piece made of LED lights could change based on the location of individual people in a public space. Motion detectors could light up specific parts of an LED strip to match the location of individuals to brighten a space while conserving energy. The data stream could also come from real-time, regularly updating, publicly available databases such as weather forecasts, creating the opportunity for the presentation of useful information with the added visual flair of LEDs.

Citations

https://github.com/adafruit/Adafruit_NeoPixel

Shae Erisson, 2013

Leave a Reply

Your email address will not be published. Required fields are marked *