https://github.com/markroland/dotstar-sequences
This project contains scripts that perform lighting effect sequences for Adafruit Dotstar LED strips
https://github.com/markroland/dotstar-sequences
dotstar led shader threejs
Last synced: 4 months ago
JSON representation
This project contains scripts that perform lighting effect sequences for Adafruit Dotstar LED strips
- Host: GitHub
- URL: https://github.com/markroland/dotstar-sequences
- Owner: markroland
- Created: 2019-04-12T05:44:39.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2025-01-23T22:52:41.000Z (over 1 year ago)
- Last Synced: 2025-10-13T10:33:57.680Z (8 months ago)
- Topics: dotstar, led, shader, threejs
- Language: Python
- Homepage: https://markroland.github.io/dotstar-sequences/
- Size: 13.4 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Adafruit Dotstar Sequence Scripts
This project contains scripts that perform lighting effect sequences for Adafruit Dotstar LED strips.
## "Cuttlefish" Sequence Video

[See more video on YouTube](https://www.youtube.com/watch?v=jlwEHKuH5io)
## Sequence Simulations
### Acceleration

### Breathe

### Clock

### Crossing

### Read from CSV file (Blink)

### Cuttlefish

### Fade

### Read from PNG image file (Fire)

### Points

### Random

### Sparkle

### Spectrum Fade

### Spectrum Slide

### Spectrum Wipe

### Stripes

## Hardware Recommendations
- [Raspberry Pi 3](https://www.adafruit.com/category/105)
- [Adafruit Dotstar LED Strip](https://learn.adafruit.com/adafruit-dotstar-leds)
- [Breadboard](https://www.adafruit.com/product/239)
- [Jumper Wires](https://www.adafruit.com/category/306)
- [5V Power Supply](https://www.adafruit.com/product/1466) (2-4 Amps recommended)
## Software Recommendations
- Python 3.5+
- [Adafruit CircuitPython](https://github.com/adafruit/circuitpython)
## 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](https://learn.adafruit.com/adafruit-dotstar-leds/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](https://packaging.python.org/en/latest/guides/tool-recommendations/).
```
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](https://threejs.org)
##### 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)

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

This code includes a browser-based simulator to display the lighting sequences. It uses [Node](https://nodejs.org/)
and [Three.js](https://threejs.org/). 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](https://vitejs.dev/) and provide a locally hosted URL to load in your browser to view the simulation.
## Resources
- [Adafruit DotStar LEDs](https://learn.adafruit.com/adafruit-dotstar-leds/overview)
- [CircuitPython DotStar](https://learn.adafruit.com/circuitpython-essentials/circuitpython-dotstar)
- [Blinka Test Script](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/installing-circuitpython-on-raspberry-pi)
- [Gradient Generator Tool](https://learnui.design/tools/gradient-generator.html)
## License
[](https://creativecommons.org/licenses/by-nc-sa/4.0/)
This work is licensed under a [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/) License.
This project makes use of the [Adafruit CircuitPython DotStar](https://github.com/adafruit/Adafruit_CircuitPython_DotStar) library, Three.js and other third party code. When using this project,
please adhere to their respective licenses as necessary.