Skip to content

peterbatridge/ennea-LED

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Nonagons

Introduction

The Nonagons are an art project I started back in December of 2019 to fill the space on an empty wall in my living room. I had some LEDs and an old raspberry pi laying around that were put to good use in the nonagons.

Parts

  • Raspberry Pi 2b+
  • 4 144 LED/m Dotstar Strips (only 434 LEDs total used and I bought mine from adafruit but you can find them cheaper as APA102 led strips)
  • Mini USB Microphone
  • Female DC Power adapter - 2.1mm jack to screw terminal block
  • 74AHCT125 - Quad Level-Shifter (3V to 5V)
  • 5V / 10a power supply
  • 40 4pin strip-to-strip LED connectors 10mm wide (these were actually not wide enough but ended up working)
  • A large assortment of jumpper wires of all types
  • 4700uF 10v Capacitor
  • 2 feet x 2 feet x 1/4 inch project board
  • A test board with the same dimensions as above made of something cheap like MDF
  • Excess wood, preferably also 1/4in thick (used for gluing to the main project board, screwing the screw eyes into and hanging from)
  • 2 Screw Eyes
  • Picture Hanging Wire
  • Wood Stain
  • Spray on Lacquer
  • Gorilla Glue
  • 8ft of Quarter Round (size doesn't matter a ton, it's just to increase the surface area the aluminum can be glued to)
  • 9+ft of Aluminum that is 2 inches wide (you'll need 9ft so you can get two 2ft pieces and two 2ft quarter inch pieces)
  • A thin sheet of cork (optional for coasters)

Tools

  • An exacto knife preferably with a couple different attachments for different jobs
  • A CNC Router (I used an x-carve with a 1/8th inch drill bit for the whole project)
  • A 3D Printer with clear filament
  • Clamps
  • A hacksaw with a blade for cutting metal
  • Soldering Iron & Solder
  • Gloves
  • A Tarp
  • Something to spread wood stain with
  • A respirator if you use spray on lacquer
  • Sandpaper of varyings grits (Some for wood, some very fine for the aluminum pieces)

3D Printing

The plastic nonagons were first designed in Blender as a flat surface with walls to keep the LEDs inside. Then I printed them with transparent filament. The model can be found here as nonagon.stl and is definitely broken but my 3D printer's software automatically fixed it before printing.
3D Print Design 3D Printing

At this point there was no plan for the board. After seeing that nonagons managed to fit some LEDs comfortably inside, then the rest of the board was planned around their size
First Nonagon Several Nonagons Nonagons Upside Down

CNC Routing

The design for the CNC cut was created in the Inventables Easel program, it's super easy to use. There are little tails on each nonagon so that there is room for wires sticking out of each nonagon. The design for the nonagons can be found here in Nonagons2.zip
CNC Design

Test cuts were made in an MDF board to get the size right holes for the plastic nonagons. I had to pause the cut and turn off the drill as soon as each nonagon was cut completely out in order to remove the cut out piece of wood. Without removing the wood the drill bit could potentially fling it across the work surface.
CNC MDF CNC Pause CNC MDF Fit

After getting the right sized nonagon cutouts determined, it was time to move on to using actual wood.
CNC Router Wood

Unfortunately one of the wood boards ended up not laying as flat as the MDF and the drill went through in places it shouldn't have. Luckily I had another.
CNC Router Failed

The wooden cutouts are a good size for coasters so I saved them
CNC Router Coaster

Assembly

Somewhere along the way I realized I could only fit 31 LEDs on a strip inside the nonagons if I had plastic connectors and wires on both ends of the strip. Originally I hadn't planned to do all the LEDs in series but it was the path of least resistance.

  • In order to have the wires sit comfortably in the nonagon I needed to cut a rectangle out of the plastic nonagon walls. This seemed very difficult to do at first but a simple method I discovered was heating up my exacto knife blade and then quickly cutting/melting through the portion of the nonagon I wanted to remove.
  • I removed the cover on one side of each plastic connector so that the LED strip could fit in it. I had to shave off a very small amount of the strip's sides in order to fit them into the plastic connectors.


Melted Nonagon Edge And Strips

Next the rough edges of the board needed to be sanded and then the board was stained. After the stain dried the board was coated several times in spray on lacquer (make sure to do this in a well ventilated area and wear a respirator)
Unsanded Edges Staining

Gluing

Throughout the gluing process I was using small clamps to hold the pieces in place and random heavy objects to hold the board flat and in place. Next the wooden quarter round was cut to size and glued onto the wood so that there was a larger surface area on the sides of the project board which the aluminum frame could be glued to.
Clamping on quarter round

Next the aluminum strips were cut to size. 2 of them were 2ft exactly and the other two were 2ft and a quarter or half inch so that the aluminum could make a perfect box around the edges of the project board. The aluminum was sanded with increasingly higher grit sandpaper to remove blemishes and make it look polished.
Cut Aluminum Strips Unsanded vs Sanded Aluminum

Next two rectangles of wood were glued onto the back of the main board and screw eyes were installed so that picture hanging wire could hang the whole project on the wall. The extra layer of wood was added so that the screw eyes would not pierce or warp the main board in any way.
Installing screw eyes

Next the aluminum edges were glued onto the board
Gluing and clamping aluminum to board

About an hour after gluing once the glue was set but not 100% dried, I flipped the project over to remove any excess glue from the front of the board while it was still ever so slightly malleable. When completely dried the glue can also be removed very carefully using an exacto knife.
Edges Edges 2

One of the final steps of assembling the board itself was gluing in the plastic nonagons
Some nonagons glued to the board Final Board

Coasters

The wooden cutouts from the board can be easily turned into coasters. I carved names into some of them for my girlfriend and her roommates as well as for Ken's 50th.
CNC Router Coaster

I stained the cutouts and then sprayed them with lacquer before cutting very thin cork to glue onto the back of the coasters. Before doing this I wish I had attached something heavy to the back of the coasters because the surface tension from water on a cup can easily pick them up. The cork cutouts are definitely just forbidden pringles.
Cork and Coasters Forbidden Pringles

I broke at least one exacto knife blade because I accidentally glued a couple of these to some excess MDF. The coasters work pretty well!
Broken Exacto Coasters supporting a wineglass of chocolate milk

Wiring

The Back Of The Board
Thankfully the wiring is simpler than it looks in that image. I got rid of the analog to digital converter chip and electret microphone that are pictured above. All that remains are the raspberry pi, the power sources, the strips and the level shifter. The microphone I'm using is called "Mini USB Microphone" and it's plugged into the USB port along with the WIFI adapter.

Power

The Raspberry Pi is being powered by it's stock usb power cable The LED Strips are being powered separately by a 5V/10A power supply

  • Each strip of 31 LEDs is in parallel with regard to power, with power and ground coming from this supply
  • There is a capacitor also in parallel with the strips to prevent any current spikes from damaging the LEDs
  • Adafruit has great guides on powering LEDs and managing power draw

LEDs and Raspberry Pi

I followed this guide on adafruit's website to wire up the LEDs. Adafruit Wiring Guide
All of the 14 strips of 31 LEDs are connected end to end as if they are one large 434 LED long strip. The plastic connectors and lack of soldering, while a huge pain at times, should hopefully make it so if an LED burns out I can easily swap out one 31 LED strip instead of replacing the whole thing.

Software

Development Environment

Mostly using SSH to write code in vim on the raspberry pi mostly and then testing the code by swiveling my chair and looking in a conveniently placed mirror. Sometimes using VSCode on my desktop and using this repository as a middleman between my desktop and the raspberry pi. There is a pygame version of the nonagon I can test some animations in as well so I don't have to do the elaborate system of mirrors.
My Development Setup Gif Conversion

Libraries

  • pyaudio and audioop for audio processing
  • numpy for more audio processing
  • adafruit_dotstar for using the LEDs
  • firebase_admin for reading and writing the firestore database which contains the state of the nonagons
  • PIL for converting gifs to nonagon animations
  • pygame for modeling the LED mapping to physical space and testing gif animations

Architecture

  • The main application for running animations is written in python and running on the raspberry pi.
    • main.py is responsible for setting up database connection, and then running the current mode
    • animation.py is responsible for creating and parsing animations on the lights
      • There are a couple core animation functions animateNonagonGroups, animateSideGroups and gifAnimation that run the bulk of the modes
      • There is also the drawShapes function used for more complex animations, note that this can be slow
    • shapes.py contains the different shape classes that define simple shapes for animation
    • constants.py contains shared values that are constant like gifs converted to nonagon-readable format
    • shared.py holds shared values that may change like the modeChanged flag for interrupting looping animations
    • physical_mapping.py contains snippets that can be used to convert gifs to animations displayed on the nonagons. It also contains the code for drawing the expected physical mapping of the LEDs with pygame and running the converted animations. This can be useful for testing if a gif animation will look good.
    • trains.py contains snippets for using the Chicago CTA API
    • weather.py contains snippets for using the Open Weather Map API
  • A firestore database for determining the state of the nonagons and to store animation modes
  • The frontend is an angular app that can be found here and can switch modes on the nonagons from any browser.

UI

UI1 UI2

Setup

I'm running raspbian headless and accessing it via SSH which takes some easily googlable setup
Here is the crontab setup to start the program in the background 30 seconds after startup. This could be modified to start immediately and then the python could check for a network connection.

sudo crontab -e
>
@reboot (sleep 30 && sudo python3 /home/pi/Desktop/ennea-LED/main.py) &   
>
ctrl+x > y

credentials.py contains something like this for the Chicago CTA API and a weather API:

owm_api_key = "API_KEY_HERE"
cta_api_key = "API_KEY_HERE"

There is also a file for firestore credentials

Making Patterns

This sheet is useful for creating animations by nonagon or side of nonagon since it shows how they can be addressed in relation to their physical position.
Nonagon Edge Reference Sheet

TODO

  • So so so much
  • Scheduling for modes (like automatically turning off or at 8am displaying a weather mode)
  • Mode Ideas:
    • Weather Mode
    • Train Passing Mode
  • Engine Improvements:
    • Add Triangle Class (and also add that to expanding stuff)
    • Ensure that all modes have a way of breaking from their loop if the mode changes
    • Create random modes
      • All non-audio modes
      • All audio modes
      • Mix of audio and non audio
      • Blinding Modes?
  • User Interface:
    • Add acceptable range for all parameters
    • Ensure UI can handle all types of modes
    • Allow addition of color palettes
    • Allow addition of nonagon groups
  • Bugs:
    • Some parameters aren't named correctly

Similar Patterns

After making this I couldn't stop seeing similar patterns, for example:
Chicago Flag Work Bathroom Tiles

Finished Product

Images

Finished Product Off Finished Product Rainbow Sparkle Finished Product Rainbow at Night Finished Product Rainbow Circles

Gifs

Rainbow Circles Closeup Acid Mode Rainbow Explosion Tearing Red Blue Alternating
Rainbow Lines Color Swap Blue Line Green Background Ex Machina Mode Rainbow Circles

Videos

Popping noise triggers brightness change Music Triggers Pinwheel Music Triggers Pinwheel 2 Ex Machina Mode

About

Nonagon Infinity

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages