Skip to content

This project contains scripts that perform lighting effect sequences for Adafruit Dotstar LED strips

Notifications You must be signed in to change notification settings

markroland/dotstar-sequences

Repository files navigation

Adafruit Dotstar Sequence Scripts

This project contains scripts that perform lighting effect sequences for Adafruit Dotstar LED strips.

"Cuttlefish" Sequence Video

Demo Video

See more video on YouTube

Sequence Simulations

Acceleration

Cuttlefish

Breathe

Cuttlefish

Clock

Clock

Crossing

Crossing

Read from CSV file (Blink)

CSV

Cuttlefish

Cuttlefish

Fade

Fade

Read from PNG image file (Fire)

Fire

Points

Points

Random

Random

Sparkle

Sparkle

Spectrum Fade

Spectrum Fade

Spectrum Slide

Spectrum Slide

Spectrum Wipe

Spectrum Wipe

Stripes

Stripes

Hardware Recommendations

Software Recommendations

Circuit

The Dotstar has four connections:

  1. Ground - Connect this to the common ground for the power supply and Raspberry Pi (i.e. ground rail of a breadboard)
  2. Power - Connect this to a +5V power supply. Make sure your supply has enough current for your LED strip.
  3. Clock Input (CI) - Connect this to Raspberry Pi's SPI SCLK Pin
  4. Data Input (DI) - Connect this to Raspberry Pi's SPI MOSI Pin

See Adafruit's Power and Connections guide for more information.

Usage

Setup

Copy and set the .env Environment file for your configuration

cp .env.example .env

Install

The Python scripts will likely need packages installed using a Python package manager like PIP.

pip install -r requirements.txt

Run

Run the sequence on an LED strip.

python play.py cuttlefish

Folder Descriptions

2d-simulator

Run a browser-based 2D simulation of the Sequence with WebGL shader

3d-simulator

Run a browser-based 3D simulation of the Sequence using Three.js

data

Contains static data to be read in for rendering a sequence

demo

Contains project documentation resources

pattern

Python modules for static lighting patterns

renderings

Contain images created by render-sequence.py

sequence

Python modules for animated lighting sequences

server

A web server for controller lighting sequences remotely

python ./server/index.py
shows

Contains show definitions in JSON format. Used by schedule.py.

Script Descriptions

demo.py

Run a demonstration show on the LED strip. This will go through several sequences as defined in a JSON file.

play.py

Run a single sequence on an LED strip.

render-sequence.py

Render a Sequence to a static PNG image where each line represents a frame of the Sequence, and each column represents a single LED in the strand.

schedule.py

Run this script continuously with different sequences scheduled for each day. This should generally be run as a background process.

simulate.py

Simulate and save a Sequence as an animated GIF (as displayed in this readme file).

2D Simulator (Shader)

Browser 2D Simulator

This code runs a local webserver that will read a Sequence represented as a PNG image and render it as a WebGL shader.

From the 2d-simulator directory:

Install Once:

npm install

Run:

npm run dev

3D Simulator

Browser 3D Simulator

This code includes a browser-based simulator to display the lighting sequences. It uses Node and Three.js. This reads sequences as PNG images, where each column of the image represents a single LED in the strand, and each row represents a frame of the animated sequence.

From the 3d-simulator directory:

Install Once:

npm install

Run:

npm run dev

Running npm run dev will start a server using Vite and provide a locally hosted URL to load in your browser to view the simulation.

Resources

License

Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)

This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) License.

This project makes use of the Adafruit CircuitPython DotStar library, Three.js and other third party code. When using this project, please adhere to their respective licenses as necessary.