📜 ⬆️ ⬇️

Color music for LED strip WS2812, Arduino and PC

Happy New Year! Before the new year, I assembled color music for the house on WS2812 LED tape. The project turned out to be easy to repeat and not expensive.

The formation of color-musical programs is carried out by the Arduino nano controller on the basis of the data received from the CMU.EXE program. The program “CMU.EXE” for a personal computer serves as a 20-band spectrum analyzer and program control panel.

This organization will allow everyone to simply collect color music. Fans of programming can, without delving into the intricacies of digital processing of audio signals, create their own color musical programs in a simple Arduino IDE.

→ Sketches for Arduino and the program "CMU.EXE" are presented on GitHub

The project provides two types of connection to a personal computer.

The first option is a direct connection to a USB PC, a COMtoLed sketch.

The second option is to connect via a radio bridge built on nRF24L01, sketches COMtoRF and RFtoLed.


You can use the color musical and dynamic subroutines in the sketch or replace them with your own. All color organ programs in the sketch are made in the form of separate subroutines, this will facilitate the understanding of the presented source code and the writing of its subroutines.

For the Arduino controller to work, you will need

1. Install the Arduino IDE library: Adafruit_Neopixels, IRremote, RF24 (if using the wireless option)

2. Set in the sketch:

- The number of LEDs in your tape:

#define stripLed 120 // количество светодиодов в ленте 

- The numbers of outputs to which your tape and IR receiver are connected:

 #define stripPin 2 // выход управления светодиодной лентой #define irPin 3 // вход IR 

- Contact numbers for controlling the radio module (if used):

 RF24 radio(9, 10); // Объект radio для работы с nRF24, номера выводов nRF24L01+ (CE, CSN) 

At the moment, 7 color-music programs and more than 70 variants of running lights are implemented in the sketch (according to Chinese calculation, another color = another program).

The program “CMU.EXE” for a personal computer is quite complex and is offered as an executable module without source code.

The color organ program “CMU.EXE” can receive an audio stream from any recording audio device of a personal computer. For example: mixer, line-in, microphone or any virtual audio cable.

Using a mixer or a virtual audio cable, you can get an audio stream from any audio player. For example: ITUNES, AIMP, VLC or any other.

Appearance of the program:




Connect to ITUNES using a virtual audio cable and playing via AIRPlay:



The video of the color musical work is presented on youtube:






Thanks for attention!

Source: https://habr.com/ru/post/409893/