Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

First Analog Circuit / Music Sync to RGB LED

Status
Not open for further replies.

skot123

Newbie level 6
Newbie level 6
Joined
Aug 28, 2006
Messages
13
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,404
led music sync

I have been working with RGB LED that fades between the colors and a Pic recently and I have been really pleased with the results.

One thing that I would like to add is the ability to synchronize to events in music.

In doing some reading, I think what I want to do is:

1. Create a negative voltage generator using a 555 timer (to supply the negative rail of the op amp)
2. Using an op amp (like a LM741) create a low pass filter
3. Read filter with ADC on PIC
4. Modify display based on ADC results

Am I looking at this appropriately? (Any advice for someone who hasn’t done any work with Op Amps or Filters?)

-Scott
 

rgb led circuit

Although I risk exposing my age here, I must say that what you have described sounds like the "color organs" that hobbyists built back in the 1960's and 1970's. These were typically made from shallow boxes filled with lights that lit in response to analog audio. Different colors of lights were employed such that each color would light in response to the amplitude of a particular frequency band. A plastic panel would cover the lights so that the light would be distorted into interesting patterns.

To implement something like this with an rgb led you will need three filters, one per color. You need a low pass filter for bass, a bandpass filter for midrange and a high pass filter for treble. Each filter will drive one led color.

If you use opamps to implement your filters then you can sample the filter outputs with the pic adc at a relatively low rate. You can do this without a negative power supply: use single supply opamps and level-shift your incoming audio so that its dc offset is approximately half your supply voltage. This is easily done by capacitively coupling the audio input and then apply a dc bias to the cap output. The dc bias generator is nothing more that the midpoint tap of a divide-by-2 voltage divider between vcc and ground.

If you really want to be clever, skip the opamp filters altogether and run the audio directly into the adc (using cap and dc bias generator as described above). Since the pic is doing little else besides a/d conversions and the occasional led output update, you can implement a simple fft and compute the led outputs directly.
 

    skot123

    Points: 2
    Helpful Answer Positive Rating
music sync led

Hello,

Thank you very much for the advice.

I have created the attached circuit, which is acting as a low pass filter, but I am not sure that I have the DC bias portion correct.

When I test, I have been using a frequency generator program on my computer to generate sine wave output through my sound card.

This is hooked up through the stereo plug on the attached circuit. (Is there a better way to include a schematic than an attachment?)

I would expect to see the waveform change as frequency increases, which it does.

However, I would have thought that the biased circuit would be at a higher voltage than the other trace, but they are showing at the same voltage. (The amplitude of the filtered circuit is less…but I would expect the midline to be higher on the scope.)

Please also note, I just purchased the scope and it could be operator error on my part as well.

Thank you again for your time and assistance.

-Scott
 

led color organ circuit

You need to arrange things so that audio will pass through a series dc blocking cap. To do this, you must add another cap in series with the wire that is just to the left of the voltage divider. Also, you will want to add a resistor in series with J1 pin 2 (between pin 2 and the junction at top of C1) to implement the filter function.

Regarding attaching images: if you attach small jpeg's (I'm not sure of the size limit; see elsewhere in forum for info) the image will appear when your topic web page is browsed.
 

rgb led music

You might find this interesting: an **broken link removed** that uses a pic to perform the filter functions. Schematic and source code is included.
 

led light organ circuits

I don't know what is the level of knowledge programming microcontrollers that you have. But if you have a microcontroller with ADC, you don't need to put external filters to separate low frecuencies from middle frecuencies and high frecuencies. All can be donde by software in the microcontroller.

Some ideas how to do:

Supposse, you sample at 8khz, and output leds using PWM signals (most of microcontrollers have ADC and more than 1 PWM)

You can measure the RMS value of signal just adding a fixed number of samples.
You can measure the "frecuency", just counting the zero crossings of signal.

Or, you can implement digital Z filters, all by soft to obtain the RMS value acording of spectrum of signal.

Hope it helps.
 

how to build sync led light to music

lambtron said:
If you really want to be clever, skip the opamp filters altogether and run the audio directly into the adc (using cap and dc bias generator as described above). Since the pic is doing little else besides a/d conversions and the occasional led output update, you can implement a simple fft and compute the led outputs directly.
To implement this digitally he will need to use one of the dsp PIC's. A little 8 banger can't hack this math at 8 kHz even if it's not doing anything else.

Added after 25 minutes:

penrico said:
I don't know what is the level of knowledge programming microcontrollers that you have. But if you have a microcontroller with ADC, you don't need to put external filters to separate low frecuencies from middle frecuencies and high frecuencies. All can be donde by software in the microcontroller.

Some ideas how to do:

Supposse, you sample at 8khz, and output leds using PWM signals (most of microcontrollers have ADC and more than 1 PWM)

You can measure the RMS value of signal just adding a fixed number of samples.
You can measure the "frecuency", just counting the zero crossings of signal.

Or, you can implement digital Z filters, all by soft to obtain the RMS value acording of spectrum of signal.

Hope it helps.
Since you're just starting you should take penrico's idea of counting zero crossings and use 3 'bands' or groups, one for each color. The more hits a band gets the brighter the led for that band. The circuit and firmware will be a lot easier than the other methods. The only change I would make is to measure the pulse width instead of frequency - doing it this way gives you more resolution.
 

led sync music

One of the challenges of learning on your own is when you ask a question, you end up learning about aspects of the technology that you were previously oblivious to. (Fun… but challenging)

I think the organ schematic is pretty close to what I was initially envisoning.

If I understand the schematic from the color organ correctly… it looks like 10uF capacitor is a high pass filter… then the next thing that happens is the voltage divider is adding a dc bias to the circuit.

The first of the two op amps is going to be an inverting amplifier. (Does this just invert the portion of the signal below ground and make it positive?)

The second op amp is increasing the voltage of the signal (offset voltage adjustment).

Then this goes to the ADC pin of the uC and everything else is handled in software.

Essentially, the ADC would give me beat detection from the music, correct?



As far as the idea of counting the zero crossings or the time between them:

Is this the correct implementation:

1 Setup 3 variables low/mid/high
2 Add DC bias to the circuit (so that entire waveform is above ground)
3 Start a timer
4 Sample the ADC, if the voltage is equal to 2.5 volts (5 volts from the power supply, divided by two equal resistors) then goto step 6
5 Goto step 4
6 Look at the timer, depending on the time since last reset increment either low/mid/high
7 Reset the timer
8 Goto step 4

I really apologize if I am asking redundant or overly basic questions, but I am learning a lot.

-Scott
 

led music display circuit

skot123:
The step 4 in your implementation: "4 Sample the ADC, if the voltage is equal to 2.5 volts (5 volts from the power supply, divided by two equal resistors) then goto step 6". I suggest change to:

4 Sample the ADC, if the voltage is highter to 2.5 volts and the sample before was lower or equal to 2.5 volts (5 volts from the power supply, divided by two equal resistors) then goto step 6.

It's better to find the translation from negative to positive, than expecting a sample of exactly 0 volts.
 

pic control rgb led with music

hey guys,
i have connected this circuit

**broken link removed**

i tired the input with direct connect to speaker and phone jack
the problem i facing now is when i connected the voltmeter to the 2nd op amp output, the value remain at 2.5v and it is not varying
the output value remain 2.5v constantly even when i play/stop the music

even the output is 2.5 but when i check it with Oscope, the value is not 2.6v
why is this hapenning?


any idea guys?

thanks and warm regards =)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top