sound/light controller

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I want to make a simple gadget that can control 10 banks of LED's and turn them on and off off depending on the frequency or volume of some music. I'll probably use an Atmega16 as I have a few of these and turning on and off the LED' is no problem either. I am just not sure about measuring the sound. If I hook up a mic and pre-amp to an ADC on the Atmega16 will it read variations in the voltage? Any advice would be appreciated.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I usually have a precision rectifer circuit feeding the ADC.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The a/d reads the voltage right then. To get beats, you need the average this 200ms compared to the avg last 200ms, so you need either a diode and an rc filter to get an average, or you need to get a bunch of samples and detect the average voltage in lo,mid and hi freq bands using digital techniques. Classic choice of use hw to make the sw simpler, or push hw into the sw to save the cost of those external components over a run of 1000s.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good answers above, already.

Do it in hardware, or do it in software...

Google Color Organ gives > 2 M hits, but have a look at what is out there.

In the "old days" this was a common project, usually with 3 - 5 channels, not 10, all done with op amp filters which then drove SCRs.

If you are building many, then perhaps a dsPic would be a good choice, (disclaimer, I've not used one, but isn't it aimed at digital signal processing). Maybe a Propeller chip? Maybe a PC :)

Getting 10 distinct bands from the audio spectrum will require some pretty good filters.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

An FFT is the easiest way to do it; here is an AVR FFT:

http://ucsb-ieee.googlegroups.com/web/avrfft.rar?gda=iHptfzwAAAC6OThZyfE7WwDSogTxiPT6-VD7M4nhTWMCZ7XzSE2hFdFI6L-37L2gdJGvYdPpjR39Wm-ajmzVoAFUlE7c_fAt

The performance of this FFT should be checked, it might not be fast enough. If that is the case, Microchip has free FFT software for their dsPIC chips which can do a 256 point FFT in 476.4 us.

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the advice, all probably pretty basic electronics I guess but still over my head. I'll start playing with a few circuits and see what I come up with.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Its probably tough to learn electronics and programming at the same time. I spent a lot of time in the early 70s with opamps on a white project board using pots and a scope to look at gain and offset and clipping and filters. Wanted to make audio consoles back then. Later I tried to do all that with sw. There is a spectrum of capabilities in the hw sw tradeoff to do with performance and reducing either hw or sw cost. I used to observe that when there was a team of a hw guy and a sw guy and a proj mgr and a docs guy etc, the hw guy would push his problems off into the sw and viceversa, so it helps if the designer knows whats hard and easy in hw and sw. Then there's FPGAs, that are sort of programmable hardware. I know nothing about them. They are like magic black boxes to me.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah, I'm afraid I am better at programming than electronics, but not much.

I really only need this to be simple so rather than try and split the sound into frequencies I have decided to measure the volume of the sound and then light the LED's depending on that.

I have never done anything with audio stuff before and have no idea what sort of output I would get. So far I have built a very simple pre-amp with a microphone on it. Measuring the output from this I am getting fluctuations in voltage from -1 to +3V. But obviously not very sensitive so I added a small 0.5W amplifier. After that I am getting fluctuations in voltage of around -2 to +2V. But there is also a lot of noise on the output too.

I am guessing this is where a precision rectifier circuit would help, would that convert the output to all positive voltages so I would get 0 to +2V?

Then if I used a differential ADC channel with a 2V AREF I would get a full resolution of the audio output. Just thinking out loud here, if someone can confirm I am on the right track I would really appreciate it. Thanks.