Skip to content

stewartadam/netl3d

Repository files navigation

netl3d

A small project that lets you control the 8x8x8 L3D cube over the network.

Rainbow Gradient (graph mode) Audio FFT

Optionally, pair it with a Novation Launchpad and use it to play light on the cube.

Features

  • Works on Linux, OS X (High Sierra) and Windows
  • Graphing mode (8x 8x8 LED frames, so 1 current frame with 7 frames of history)
  • Launchpad control mode, tested with Launchpad MK1
  • Several bundled examples including FFT analysis ('beat sync'), rainbow loop, animations, and a simulator for compositing multiple effects

Planned "soon":

  • Aurora Nanoleaf support
  • Lighting effect / animation library
  • Scripted animations (e.g. synced to music)

Setup

  1. Setup the Photon device embedded in your L3D cube and connect it to wifi. If you're not sure how to do this, see the official L3D Cube or Particle Photon documentation respectively.
  2. Upload the included netl3d.ino firmware to your Photon device.
  3. Determine the local IP address of your Particle by plugging it into your computer over USB and monitor the serial output. The netl3d firmware will print the Photon's local IP address once it connects to a network.
  4. Recommended: configure a static DHCP reservation for your Particle to ensure it has a predicable IP address.

Your L3D cube is now ready to accept network instructions.

Running the examples

Examples for netl3d read from the YAML configuration file, located at ~/.netl3d (on Windows, ~ is %USERPROFILE%).

Create this file with the following contents:

debug: false

hardware:
  l3dcube:
    ip: 192.168.1.101
    port: 65506
  aurora:
    ip: 192.168.1.102
    auth_token: token_here

Replace the hardware.l3dcube.ip key with your L3D cube's photon IP address, then run any of the examples directly.

If you need to install dependencies (see below), I strongly recommend you do so in a venv, and via pip

python3 -m venv --system-site-packages netl3d
pip install -r requirements.txt

To activate the environment again later, run:

source netl3d/bin/activate
python examples/netl3d/foo.py

The examples noted below have additional dependencies:

audio_fft_pygame.py

Note: On OS X, you may receive an error installing pyaudio if you have installed its portaudio dependency with Homebrew. It can be installed easily like this:

brew install portaudio
CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" pip install pyaudio

launchpad_control.py

Note: pygame can be installed easily with pip on Linux/Windows, but I have had better luck with brew install homebrew/python/pygame on OS X (via Homebrew).

For now, use my fork of lauchpad.py which has a fix for issue #10 and allows launchpad.py to be used as a Python module. Run python setup.py install to install it to your site-packages folder.

If you have issues running the scripts, check the Novation website for drivers, if necessary. The launchpad needs to be recognized as a MIDI device when plugged in.

  • On OS X, this can be verified by opening Applications > Utilities > Audio MIDI Setup and then selecting Window > Show MIDI Studio

Sometimes the Launchpad will glitch and stop responding. If that happens, press any one of the automap buttons (topmost 8 buttons) and try again. See documentation in the FMMT666/lauchpad.py for additional known Launchpad-related compatibility issues and bugs.

LP Button mappings

Currently, supported buttons and their corresponding actions are:

  • Up/Down: Control brightness (1/8 increments)
  • Left/Right: Cycle colors (8-bit RGB color mask)
  • Top right: Force-on all LEDs (takes precedence over others)
  • Bottom right: Force-off all LEDs (takes precedence over others)
  • Row 1: Produce a 8x8 pixel wall (zy-plane), offset on the L3D cube equal to the button index
  • Row 2: Produce a 8x8 pixel slice (xz-plane), offset on the L3D cube equal to the button index
  • row 3: Produce a 8x8 pixel sheet (xy-plane), offset on the L3D cube equal to the button index

Resources

For added fun, you can also use software such as Soundflower to virtualize an input audio device that 'captures' the system's current audio out stream (you will need to configure a merged Speaker+Soundflower device in MIDI Setup).

I found these resources helpful while writing this project:

About

Network-based control for the L3D cube (w/ Novation Launchpad support)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published