Computers and modern gadgets

Answer

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry"s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five http://jquery2dotnet.com/ centuries , but also the leap into electronic typesetting, remaining essentially unchanged. It was popularized in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

This device combines a color music device (CMU) and a light dynamic device (SDU) with 8 channels, with many lighting effects. The outputs of the device are designed to connect a sufficiently powerful load. And in the archive there is a version of the circuit for even greater power. The separation of frequencies among DMU channels is purely software and very simple. The number of timer/counter pulses for a strictly defined period of time is counted and, depending on the value of this counter, one or another LED turns on. This is a very simple algorithm, but nevertheless, it works.

Digging allows:
Select mode- CMU/SDU. In the SDU mode, even if there is a signal at the input, only the main program of the light-dynamic device works. In the CMU mode, if there is no signal, the selected SDU effect is played as a background mode.
Select the SDU effect. The button cyclically switches all possible effects of the dynamic light device.
Increase and decrease speed. These buttons control the speed of the SDS effects; they have no effect on the CMU.

LED matrix lamps are used as color spotlights; the permissible load on each channel is about 300mA! The circuit that is in the archive allows you to connect a load with a voltage of 12 volts and a current of up to 3 amperes (car incandescent lamps from turn signals or brake lights at 21 watts) to one channel.

Color music circuit for 6 channels on the Atmega8 microcontroller quite simple, and contains a minimal set of radio components. This device can be connected to the linear output of a computer, player, or radio. The input signal is amplified by the LM358 operational amplifier, then the signal is processed by the microcontroller and sent to transistor switches.
The level of the incoming signal is controlled by a potentiometer at the input to the device. For self-production, you can use a chip in a DIP package ATmega8-16PU PDIP28

Color music scheme on Atmega8

Printed circuit board drawing - color music on the Atmega8 microcontroller

Photo of the finished device - color music on the Atmega8 microcontroller

Connectors on the board:
J1 - When using a power source with a voltage higher than 5 volts (5-30 volts). Has protection against reverse power polarity. You only need to use one of the power connectors depending on your power source!
J2 - When using a power source with a voltage of = 5 volts (4.5-5.5v), it is used, for example, to power color music from three 1.5v batteries. Has protection against reverse power polarity.
J3 - Linear signal input, the source can be any device with a linear output (mp3 player, computer, radio, etc.), the ability to use both mono and stereo sources.
J4 - Connector for connecting a potentiometer (rated 10-100 KoM). Used to adjust the level of the incoming signal. If necessary, replace it with a jumper.
J5 - Connectors for connecting optosimistors or powerful transistor switches, for connecting color music with more powerful lamps or LEDs.
To make a color music device on a microcontroller, you can download

Additionally

  • IN: I bought a tape with contacts G, R, B, 12 on it. How to connect?
    A: This is the wrong tape, you can throw it away

    IN: The firmware loads, but the error “Pragma message...” appears in red letters.
    A: This is not an error, but information about the library version

    IN: What should I do to connect a ribbon of my own length?
    A: Count the number of LEDs, before loading the firmware, change the very first setting in the sketch, NUM_LEDS (the default is 120, replace it with your own). Yes, just replace it and that’s it!!!

    IN: How many LEDs does the system support?
    A: Version 1.1: maximum 450 pieces, version 2.0: 350 pieces

    IN: How to increase this number?
    A: There are two options: optimize the code, take another library for the tape (but you will have to rewrite some of it). Or take Arduino MEGA, it has more memory.

    IN: Which capacitor should I use to power the tape?
    A: Electrolytic. The voltage is 6.3 Volts minimum (more is possible, but the conductor itself will be larger). Capacitance - at least 1000 uF, and the more the better.

    IN: How to check the tape without Arduino? Does the tape burn without Arduino?
    A: The address strip is controlled using a special protocol and works ONLY when connected to a driver (microcontroller)

  • YOU CAN ASSEMBLE THE CIRCUIT WITHOUT A POTENTIOMETER! To do this, use the POTENT parameter (in the sketch in the settings block in the settings signal) assign 0. The internal reference voltage reference source of 1.1 Volt will be used. But it will not work at any volume! For the system to work correctly, you will need to select the volume of the incoming audio signal so that everything is beautiful, using the previous two setup steps.

  • Version 2.0 and higher can be used WITHOUT an IR REMOTE, modes are switched with a button, everything else is configured manually before loading the firmware.

  • How to set up another remote control?
    Other remote controls have different button codes, use the sketch to determine the button code IR_test(versions 2.0-2.4) or IRtest_2.0(for versions 2.5+), available in the project archive. The sketch sends the codes of the pressed buttons to the port monitor. Next in the main sketch in the section for developers There is a definition block for the remote control buttons, just change the codes to your own. You can calibrate the remote control, but honestly it’s too lazy.

  • How to make two volume columns by channel?
    To do this, it is not at all necessary to rewrite the firmware; it is enough to cut a long piece of tape into two short ones and restore the broken electrical connections with three wires (GND, 5V, DO-DI). The tape will continue to work as one piece, but now you have two pieces. Of course, the audio plug must be connected with three wires, and the mono mode is disabled in the settings (MONO 0), and the number of LEDs must be equal to the total number on the two segments.
    P.S. Look at the first diagram in the diagrams!

  • How to reset settings that are stored in memory?
    If you've played around with the settings and something goes wrong, you can reset the settings to factory settings. Starting from version 2.4 there is a setting RESET_SETTINGS, set it to 1, flash it, set it to 0 and flash it again. The settings from the sketch will be written to memory. If you are on 2.3, then feel free to upgrade to 2.4, the versions differ only in a new setting that will not affect the operation of the system in any way. In version 2.9 there was a setting SETTINGS_LOG, which outputs the values ​​of settings stored in memory to the port. So, for debugging and understanding.

When you're a kid, the grass is greener
and the sun is brighter and the air is cleaner

Folk wisdom

I remember when I was a teenager and went to a radio club, the boys would say with a breath: “I wish we could collect color music…”. My uncle, also a radio amateur, showed me a color music diagram. Then it seemed like something absolutely incredibly complicated.
In general, in the Soviet amateur radio environment, color music was a symbol. If you are a young radio amateur and have put together color music, then you start walking around with your nose in the air and groundlessly consider yourself a professional (and if you still understand why and how it works, then you don’t say hello to anyone at all). Every self-respecting radio amateur had to collect it, otherwise he is a loser.

Many years later. The soldering iron became covered with a black, indelible coating. The radio components lay sadly upside down on the table. The university course in electronics and circuit design somehow passed me by (I passed something, did something, but I don’t understand how).
One day, when I arrived at my parents’ apartment, I saw my old book on the shelf: “For a Beginning Radio Amateur.” And then my whole life flashed before my eyes: fingers burned by a soldering iron; the sickening stench of steaming aspirin; resistors; diodes; transistors; friend Lech, yelling into the intercom we assembled: “It works!!! Yurik! It works!!!".
So I again discovered the wonderful world of radio electronics.

Started from the very beginning. I understood how receivers, amplifiers, superheterodynes work... For the sake of training, I soldered a couple of “multivibrators” (my wife liked it). And now I come to color music. I tried to assemble it first using LC filters, but it was enough for me to wind only one coil, and then I ruined it. The second one was assembled using RC filters. It was already working and blinking merrily with three LEDs to the music, although I assembled it with a “hinged installation” and the circuit resembled a creepy spider the size of a plate.
But this is the 21st century. And now, wherever you spit, you’ll end up in a microcontroller. If you spit in the washing machine, you get it, you get it in the microwave, you get it in the dishwasher, and soon you won’t be able to spit in the kettle either.

In order to study working with microcontrollers and finally solder something that you can touch with your hands and it will not fall apart, I decided to make a “dynamic light installation”. All! Introduction is over! The most interesting things are ahead.

Target

Set a goal and achieve it!
m\f "Finding Nemo"

Assemble a device that, when a sound signal is received at the input, will light up one of the 8 LEDs, depending on the frequency of the sound signal. If there is no sound signal at the input, the device should blink with all sorts of beautiful effects. It turns out not just color music, but a “dynamic lighting installation”.

Theory

Theoretically, we are millionaires
but practically, we have two whores and one fagot

Joke

Color music is a device that turns on a light bulb of a certain color, depending on the frequency of the incoming sound signal. Those. the device must determine what frequency the sound is at the input and light the light bulb that corresponds to this frequency.
The average human ear perceives from 20 Hz to 20 kHz. In the designed device we have 8 light channels (LEDs).
In the simplest case, you could do this:
20000 (Hz) / 8 = 2500 Hz per channel. Those. at a frequency from 0 to 2500 Hz, one LED lights up, from 2500 Hz to 5000 Hz the second, etc.
But here a very interesting situation arises. If you take an “audio frequency generator” and listen to a sound with a frequency of 2500 Hz, you can hear that 2.5 kHz is a very high sound. With this distribution of channels, we will get only 1-2-3 light bulbs, the rest will be extinguished, because There are few very high frequencies in music.
I started searching. What is the distribution of sound frequencies in the average musical composition? It turned out that there are no such studies on the Internet. But I learned that when compressed into mp3 format, frequencies above 15 kHz are stupidly cut. Because they can only be heard on professional equipment, and no professional will listen to mp3. This means we lower the upper threshold to 15 kHz.
But then I miraculously found it.
After reading it, I made for myself the following table of channel frequency distribution:

Frequency range (Hz)Channel number
20-80 1,8
80-160 2
160-300 3
300-500 4
500-1000 5
1000-4000 6
> 4000 7


Development of a schematic diagram

Don't stop me from robbing!!!
Bender. Futurama

I did not develop the circuit from scratch. For what? The Internet is full of color schemes. You just need to steal them, choose the most suitable one and modify them for yourself. Which is what I did. Here is a diagram called “CMU/SDU on a microcontroller (8 channels).”
Only it was on a microcontroller of the PIC family. And after reading smart forums, I concluded that the most adequate microcontrollers for training and in general are AVRs. But no one was going to tear up the scheme “from scratch”. So we make changes:
1. We change the microcontroller from PIC to ATmega16 (I really wanted to do it on ATmega8, but after running around half the city, I couldn’t find them).
2. Change the power source from 12V to 19V. It's not because of coolness - it's because of poverty. I have this power supply from my laptop.
3. We replace all domestic parts with imported ones. Because when you poke a list of domestic elements in the seller’s face, he looks at you like you’re a sheep. Only transistors will have to be replaced: KT315 with BC847B, KT817 with TIP31.
4. We remove the external “quartz” Qz1 and with it the capacitors C6 and C7. Because ATmega16 has built-in quartz.
5. Remove the S1-S4 keys. No interactivity! Everything is automatic!
6. In the original output circuit, the following mechanism was used. KT315 transistors acted as a key to turn on the LEDs on the board. As the author described, this is kind of necessary to see what is working there, they are not visible to the end user... Superfluous! We remove these transistors and LEDs from the board. We leave only the KT817 transistors, which will turn on the light bulbs visible to the end user.
7. Because We changed the power source from 12 to 19 Volts, then in order not to burn the LEDs, we will increase the resistance of the resistors going from the KT817 transistors to the LEDs.
8. I completely did not understand the purpose of capacitor C4. He was just getting in the way. Removed it.
Here's what came out of it:


How it works


the basis for the operation of the synchrophasotron,
the principle of acceleration of charged particles by a magnetic field is established,
okay, let's move on
film "Operation Y and other adventures of Shurik"

The circuit contains a single-stage amplifier using transistor Q1. An audio signal (voltage approximately 2.5V) is supplied to connector J9. Capacitors C1 and C2 serve as filters that pass only the alternating component from the audio signal source. Transistor Q1 operates in signal amplification mode: when alternating current flows through its EB junction, then with the same frequency, current flows through the EC junction from the power source, through the voltage stabilizer U1.
Voltage stabilizer U1 converts the voltage from the power source into a voltage of 5V and, together with the capacitors connected to it, allows the formation of rectangular pulses. These pulses are sent to INT0 of the microcontroller.


The oscilloscope shows how the audio sine wave signal is converted into a square wave signal.
Now everything is in the hands of the microcontroller. He needs to determine the pulse frequency and, depending on the frequency (according to the plate above), apply a logical one (5V) to one of its pins (PB0-PB7). The voltage from the microcontroller pin goes to the base of the corresponding transistor (Q2-Q9), which operate in switch mode. When voltage occurs at the EB junction of the transistor, the EC junction opens, through which current flows to the LED from the power source.

The inner world of a microcontroller

I have a very rich inner world,
and they only look at my tits!
Quote from the women's forum

Let's now consider what's going on inside the microcontroller. The microcontroller operates at a frequency of 1 MHz (I did not change the default frequency).
We need to count the number of pulses received at the microcontroller input from the audio signal source over a certain period of time. A simple formula from these data calculates the frequency of the signal.

There is one problem with low frequencies: you cannot make this period very large or very small. In a standard musical composition, the frequency of sound changes constantly. If we make the measurement time large (for example, 1 second), then if the sound was 80 Hz for 0.8 seconds, and 12 kHz for 0.2 seconds, we will get a high-frequency sound and lose all the low ones. If we make the measurement time small, then we simply may not have time to measure low-frequency sound, because The measurement time will be less than the frequency of the sound signal.
After spending 5 minutes with the numbers, I calculated that a completely acceptable measurement time was 0.065536 seconds.
I received this sign.

If you notice an error, select a piece of text and press Ctrl+Enter
SHARE:
Computers and modern gadgets