Incredibly spectacular color music using Arduino and LEDs. Incredibly spectacular color music on Arduino and LEDs Lighting effects on arduino
Attention! The new program is not compatible with old sketches.
Appearance of the new CMU program
The program supports color-musical and dynamic operating modes.
In color music mode, the outputs of 19 digital bandpass filters are used to generate color effects. The output values of digital filters are transmitted at a constant rate by a personal computer and are contained in the readData array.
In dynamic mode, color effects are performed at a pace set by a programmable delay. No connection to a PC is required to run dynamic programs.
In the program you can choose one of 4 color and music programs or one of 8 dynamic ones. Not all programs are implemented in the attached tape controller sketch. I implemented 3 color-musical and 4 dynamic subroutines. You can create the rest of the programs yourself.
Color music programs:
Rainbow;
MIX;
I-beam;
The new one is left for your implementation.
Dynamic programs:
1 - theaterChaseRainbow - from examples for the Adafruit_NeoPixel library, the tempo is set by the slider;
2 - rainbowCycle - from examples for the Adafruit_NeoPixel library, the pace is set by the slider;
3 - flickering lights
4, 5, 6 - different options for running lights
7..8 - left for your implementation.
Setting the color of the entire tape is done by selecting a color in the color field;
Dynamic programs can be executed autonomously, without connecting to a PC. If you want to use the tape controller standalone, you will need to connect buttons to one or more digital inputs of the arduino board, and a potentiometer to one of the analog inputs. The buttons will be used to switch the program number, and the potentiometer will be used to change the program parameter (tempo, brightness, color). Connecting buttons and potentiometer to arduino can be found in standard examples. Write and add code to the tape controller sketch that changes the subroutine number prog and parameter values param, depending on the buttons pressed and the position of the potentiometer. You can use the IR receiver and the TV remote control to switch dynamic programs. Connecting an IR receiver to arduino can also be found in standard examples.
To implement color music programs you have the outputs of 19 bandpass filters. You can process them as you wish to obtain a beautiful color and music program. You can increase the number of programs using the parameter change slider (250 states) to change the color program.
Leave the code of your beautiful dynamic and color-musical routines in the comments to the article, so that anyone who likes it can add it to their sketch.
Create, invent, write, share and everyone can make the device they want.
Sketch for the computer connection option “COMtoLED.ino”:
Additional Information
#include Sketches for the wireless option: Additional Information #include Sketch for the “RFtoLED.ino” tape module:
Add to favorites
Liked
+65
+147
On the Internet I found a lot of interesting ideas on how to simulate the effect of fire using programmable LEDs WS2812c and Arduino. I tried to make my own night light that will add romance to the room. Each instruction used a different combination of LED types and microcontrollers for them. They all had various disadvantages, such as how big a fire lamp could be, what it was designed for, etc. You will see my result below. Like any of my projects, I don’t want to call it completed, because looking at it, every time I discover new things that can be improved or refined. For the project you need: Since the diodes and Arduino nano use 5V, I was locked to that voltage. This means that you can use a power bank to power the lamp and create a romantic atmosphere anywhere, anytime. My LED strip had 120 diodes, I divided it into strips of 20 diodes per cylinder, you can see this in the photo. I also soldered the male/female plugs so that I could replace some parts of the lamp in the future. To program the LEDs I used the NeoPixel library. I also used parts of the code found on the internet, which I modified a lot to adapt and give the glow a more realistic feel. So, having finished with the electronics, we see that the glow still doesn't look like fire. To add realism, we need to scatter the light from the diodes, so that the glow of each individual diode is no longer distinguishable. After experimenting a bit with paper (which diffused the light too much) and plastic film painted white (also not suitable for my needs), I came to the conclusion that the only viable solution was to use frosted glass or acrylic. Since I wanted to use the simulated fire lamp a lot, I decided to just buy a regular lamp and use it as a shell. I removed all the electronics from the lamp and replaced it with my own. The glass of the lamp gave a pleasant diffusing effect, so a couple of tweaks and modifications to the program code made me completely satisfied with the result. With coming! The New Year is approaching, which means it’s time to urgently create the mood! Well, as always, at this time of year, dozens of electronic circuits of various color and music installations are born. What unique masters can’t come up with. From three-color blinkers to multi-beam laser systems controlled via a MIDI interface. As a big fan of the so-called addressable LEDs, I want to show you a very simple and amazing color music. I've never seen anything like this before. Until I assembled it in one evening. So, sound visualizer! In the visualizer, using the fast Fourier transform algorithm, 8 frequencies are selected (the sensitivity threshold for each frequency is different, decreasing from 1 to 8), converted to color and displayed on a line of LEDs using one of eight algorithms. The sketch was written by Michael Krampas, the guys from Chip and Deep added functionality, and the library for LEDs and fast Fourier transform (FFT) was written in Adafruit for the Piccolo project. The FFT library for 128 points, adapted for AVR microcontrollers, is written in assembler. The sketch itself and the FFT library need to be downloaded and . Don't waste time analyzing algorithms, just assemble, upload a sketch and enjoy the show. When you turn it on for the first time, you need to do a couple of settings: Brightness: hold color button when power on. The first 8 LEDs will display a rainbow of LEDs. Use the param knob to change the brightness. When finished, press the color button again and your configuration will be saved into memory. LED strip length: hold down the pattern button when turning on the power. One, two or three red LEDs will be displayed. Use the param knob to select the length of the LED strip depending on the number of red LEDs: 1=60 LEDs When finished, press the pattern button again and your configuration will be saved into memory. Dancing minus: same as Dance Party, but the signal spikes are emitted from one end. Light strip: the entire strip is illuminated in peaks. Color stripes: Signal peaks appear as colored bars that disappear. Color stripes 2: similar to colored stripes, but each stripe shrinks and disappears. Flashes: Signal peaks are displayed as an LED flash at a random location. The initial color is white and then fades through another color. Fireflies: signal peaks appear as single LEDs in a random location, and they move left or right and disappear. Their speed depends on the size of the signal. Rainbow: All signal peaks appear as the same color (with a small amount of random variation) and this color changes like a rainbow over time. The speed of color change is set by the param potentiometer. Colored Frequencies: In this mode, each signal peak is colored depending on the frequency band where it is located. The lowest band is red, and further up the spectrum. There are 8 frequency bands: red, orange, yellow, green, cyan, indigo, violet, white. This color mode is most interesting when the frequency response is set to all frequency bands. Frequency range: you can control the frequency range to which color music responds. To set the range, press and hold both buttons. Use the param knob to select how many of the eight frequency ranges will be shown. If you want to highlight the bass and rhythm of the music, set the frequency response to only the lowest 2 or 3 bands. If you want to show all frequencies in the music (such as vocals and higher instruments), select all frequency bands. This is a video instruction for setting up and also a demonstration of the visualizer in operation. There are two musical compositions at the end with different algorithms. One more composition Guys! And ladies of course. I really want you to have time to make this simple design for the New Year holiday. You will not regret! Guests will be shocked! Happy New Year 2018! Added 12/15/2017 Epilogue or debriefing Added 06/09/2018
“What is New Year without a Christmas tree?” Your toys are defective! - What, they don’t shine? - No, they are not happy! Probably everyone is already tired of boring garlands with the same type of effects. I want something more serious, with a minimum of investment and use of my head (it already hurts from the New Year's chaos). Here we will consider a garland with 100 LEDs, with 1000 variations and a price of 150 rubles per controller Use the tape on the WS2811, and so that it is controlled by the remote control. On Arduino, as a rule, this is not feasible, it is rather weak, there are not enough resources, you cannot attach anything extra. I was already ready to build this on ARM controllers. (I have a lot of controller boards with LPC1754 lying around) but I don’t want to solder, and I don’t have time to translate the code from Arduino. Yes, I know what can be done on the ESP8266, but I don’t want to... (those who wish can port the sketch themselves) And while painfully scouring the Internet in search of interesting effects for different libraries, I accidentally came across the FastLED-Demos page, where Andrew Tuline uploads effects for the FastLED library. I'm interested in the notamesh section I said Wow... and away we go... To repeat the pattern: Buy a garland based on WS2811 or WS2812 or the like (probably purchased a long time ago at previous sales). Buy an Arduino UNO, NANO or similar module on an ATMega328 controller Take an IR module (this or that) A remote control for an old TV or VCR or player. Power supply 5 volts and 3 amps. Well, anyone I had 100 pieces of WS2812B, I rolled each LED in transparent heat shrink, this gave a 360 degree glow. Images In the bins there was a scarf with a NANO circuit, a power supply, an IR receiver, and the housing from the router connected it all together. Images I managed: input from IR pin 8 (PB0, D8, physical pin 12), output to garland pin 14 (PC0, A0, physical pin 23) Here's the diagram: Check the pinout (for example, IR receivers may have different pinouts) You can choose other Arduino legs, I will show you where to change in the sketch. I left the first one, replaced the second one with IRremote (https://github.com/z3t0/Arduino-IRremote), now the remote control works with the FastLED library. My version of the sketch with these libraries https://yadi.sk/d/4aKV_Ug6HcFdWQ I tried not to redo the original sketch (no time). I will add new teams in the future. Download the FastLED and IRremote libraries and install them. To install the IRremote library, according to the author's advice, you need to remove Arduino/libraries/RobotIRremote We take the remote control, load an example from the IRremote library called IRrecvDemo In line 11 int RECV_PIN = 11; 11 is changed to 8 (in my circuit an IR receiver is connected to this pin) Upload the sketch to Arduino. We press the buttons on the remote control and codes will appear in port monitor mode, remember them. These codes must be inserted into the file commands.h, For example: for the team IR_A1(increase brightness) I have a key code on my remote control 0xff4ab5 #define IR_A1 0xff4ab5 //N/P //Increasing brightness of A1 you'll figure it out, I think. In line 75 we set the pin of the IR receiver int RECV_PIN = 8; In line 84 we set the output pin for the garland #define LED_DT 14 If you have other garlands, then select its type in lines 84-87. And don’t forget to remove the comment in line 208 for 4 wired garlands and add it to 209 //LEDS.addLeds LEDS.addLeds If the pins are not mixed up, it should work right away At the first start, the number of LEDs in the garland is set to 20 pcs. Therefore, for those who do not use the remote control, you need to put the required number of LEDs in drain 119, #define INITLEN 20 and if you have already launched, then change the code in line 225 NUM_LEDS = EEPROM.read(STRANDLEN); On NUM_LEDS =100; Where 100 is your number of LEDs. For others, the number of LEDs can be adjusted from the remote control I am not limited by the current of the power supply, if your power supply is weaker, then in line 211 we change the second number to yours set_max_power_in_volts_and_milliamps(5, 3000); where 3000 is the maximum current of the power supply in mA, we change it if necessary When I have time, I’ll add effects and post the sketch here. I recorded video effects (demonstration mode)
And in the video, without changing the effect, I switched palettes with the remote control. With coming! The New Year is approaching, which means it’s time to urgently create the mood! Well, as always, at this time of year, dozens of electronic circuits of various color and music installations are born. What unique masters can’t come up with. From three-color blinkers to multi-beam laser systems controlled via a MIDI interface. As a big fan of the so-called addressable LEDs, I want to show you a very simple and amazing color music. I've never seen anything like this before. Until I assembled it in one evening. So, sound visualizer! In the visualizer, using the fast Fourier transform algorithm, 8 frequencies are selected (the sensitivity threshold for each frequency is different, decreasing from 1 to 8), converted to color and displayed on a line of LEDs using one of eight algorithms. The sketch was written by Michael Krampas, the guys from Chip and Deep added functionality, and the library for LEDs and fast Fourier transform (FFT) was written in Adafruit for the Piccolo project. The FFT library for 128 points, adapted for AVR microcontrollers, is written in assembler. The sketch itself and the FFT library need to be downloaded and . Don't waste time analyzing algorithms, just assemble, upload a sketch and enjoy the show. When you turn it on for the first time, you need to do a couple of settings: Brightness: hold color button when power on. The first 8 LEDs will display a rainbow of LEDs. Use the param knob to change the brightness. When finished, press the color button again and your configuration will be saved into memory. LED strip length: hold down the pattern button when turning on the power. One, two or three red LEDs will be displayed. Use the param knob to select the length of the LED strip depending on the number of red LEDs: 1=60 LEDs When finished, press the pattern button again and your configuration will be saved into memory. Dancing minus: same as Dance Party, but the signal spikes are emitted from one end. Light strip: the entire strip is illuminated in peaks. Color stripes: Signal peaks appear as colored bars that disappear. Color stripes 2: similar to colored stripes, but each stripe shrinks and disappears. Flashes: Signal peaks are displayed as an LED flash at a random location. The initial color is white and then fades through another color. Fireflies: signal peaks appear as single LEDs in a random location, and they move left or right and disappear. Their speed depends on the size of the signal. Rainbow: All signal peaks appear as the same color (with a small amount of random variation) and this color changes like a rainbow over time. The speed of color change is set by the param potentiometer. Colored Frequencies: In this mode, each signal peak is colored depending on the frequency band where it is located. The lowest band is red, and further up the spectrum. There are 8 frequency bands: red, orange, yellow, green, cyan, indigo, violet, white. This color mode is most interesting when the frequency response is set to all frequency bands. Frequency range: you can control the frequency range to which color music responds. To set the range, press and hold both buttons. Use the param knob to select how many of the eight frequency ranges will be shown. If you want to highlight the bass and rhythm of the music, set the frequency response to only the lowest 2 or 3 bands. If you want to show all frequencies in the music (such as vocals and higher instruments), select all frequency bands. This is a video instruction for setting up and also a demonstration of the visualizer in operation. There are two musical compositions at the end with different algorithms. One more composition Guys! And ladies of course. I really want you to have time to make this simple design for the New Year holiday. You will not regret! Guests will be shocked! Happy New Year 2018! Added 12/15/2017 Epilogue or debriefing Added 06/09/2018
Sketch for the module connected to a computer “COMtoRF.ino”:
#include
Operation of the Rainbow, MIX, I-beam programs: Step 1: Create the Electronics
Step 2: Lighting Effects
Instructions
The scheme is very simple!
You will need an Arduino Nano, or Uno. Or which one do you have? Two potentiometers, five resistors, a pair of capacitors and a line (strip) of 180 WS2812b LEDs. All! There can be 60, 120 or 180 LEDs in the line.
It's just entertainment!
2=120 LEDs
3=180 LEDsAlgorithms
Dancing plus: audio peaks are emitted from the center of the strip and disappear as they approach the ends. The speed of the peak is proportional to the magnitude of the audio signal of that peak.
Pulse: Signal peaks appear as bright pulses that come from the center of the strip. The pulse width depends on the signal level.Color schemes
Random two-color scheme: two random colors are selected and only these are used to display signal peaks. Over time, new colors will be selected. Use param to adjust how quickly the color scheme changes. If the "parameters" potentiometer knob is in the up position, the colors will change frequently and each signal peak will have a new color. I recommend installing the handle in the middle.
1. How to change the backlight during pauses?
2. Is it possible to change the dynamics?
3. How to connect a strip with a number of LEDs other than 60/120/180?
Plus an updated scheme has been published. Don't worry, we only added one resistor.
There are two weeks left until the New Year. Will you have time to collect?
Made the backlight settings:
sketch and diagram.
Let's use it like this.
Background lighting:
During pauses, the background lighting is turned on, i.e. the entire line will glow in the color you choose and with the selected brightness.
Color: Set the PARAM2 potentiometer to the middle position and press the Background button once. The LED bar will light up. Rotate the PARAM2 potentiometer, the color of the ruler will change from red to purple. Select a color and click the Background button again.
Brightness: Set the potentiometer to the minimum position (knob all the way clockwise) and press the Background button. The line will go out. Slowly rotate the PARAM2 potentiometer knob to select the desired backlight brightness and press the Background button again. The brightness values will be written to the microcontroller memory.My wishes:
So.
Now about the sketch
Let's continue
Setting up my sketch
Look like that's it
Instructions
The scheme is very simple!
You will need an Arduino Nano, or Uno. Or which one do you have? Two potentiometers, five resistors, a pair of capacitors and a line (strip) of 180 WS2812b LEDs. All! There can be 60, 120 or 180 LEDs in the line.
It's just entertainment!
2=120 LEDs
3=180 LEDsAlgorithms
Dancing plus: audio peaks are emitted from the center of the strip and disappear as they approach the ends. The speed of the peak is proportional to the magnitude of the audio signal of that peak.
Pulse: Signal peaks appear as bright pulses that come from the center of the strip. The pulse width depends on the signal level.Color schemes
Random two-color scheme: two random colors are selected and only these are used to display signal peaks. Over time, new colors will be selected. Use param to adjust how quickly the color scheme changes. If the "parameters" potentiometer knob is in the up position, the colors will change frequently and each signal peak will have a new color. I recommend installing the handle in the middle.
1. How to change the backlight during pauses?
2. Is it possible to change the dynamics?
3. How to connect a strip with a number of LEDs other than 60/120/180?
Plus an updated scheme has been published. Don't worry, we only added one resistor.
There are two weeks left until the New Year. Will you have time to collect?
Made the backlight settings:
sketch and diagram.
Let's use it like this.
Background lighting:
During pauses, the background lighting is turned on, i.e. the entire line will glow in the color you choose and with the selected brightness.
Color: Set the PARAM2 potentiometer to the middle position and press the Background button once. The LED bar will light up. Rotate the PARAM2 potentiometer, the color of the ruler will change from red to purple. Select a color and click the Background button again.
Brightness: Set the potentiometer to the minimum position (knob all the way clockwise) and press the Background button. The line will go out. Slowly rotate the PARAM2 potentiometer knob to select the desired backlight brightness and press the Background button again. The brightness values will be written to the microcontroller memory.