Coder Social home page Coder Social logo

raspilights's Introduction

raspilights

This is a crazy project for controlling a musical holiday lights show. I built a toolbox-based controller for 48 independent outlets, driven by relays, controlled by a Raspberry Pi and a custom i2c breakout board ased on the MCP23017 chip.

Each MCP23017 chip can take the i2c control input and assign addresses for up to 16 outputs, increasing the options from the standard GPIO pins on the Pi. This breakout board uses 3 MCP23017s for a total of 48 relays (6 boards of 8). I should note that each relay board is powered from a 12V laptop power supply that goes through a beefy 5V regulator. The breakout board is powered by 5V and 3V3 from the Pi.

I use midi files to sequence the lights, with linkages defined between note values and relay addresses in midimap.json. Creating the midi files is a whole other discussion. I first loaded the wav file into a digital audio workstation, corrected the timing through the song, and then recorded the notes that corresponded to each individual light string into a midi track. It takes a while to set up each midi file, but the note_on and note_off messages make it very convenient to turn on and off the relays. mido makes it incredibly easy to parse through a midi file and read each message, which then get parsed into a queue.

The file raspilights.py was my original attempt that uses a subprocess call to play for wav file playback. This led to wildly unpredictable differences in when the music started vs. when the light sequence started. It works ok, but I wanted more control.

pg_raspilights.py uses pygame to playback the wav file and it's timed to start as soon as the midi messages start getting parsed into the thread queue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.