Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

how to use microcontroller to sample music?

Status
Not open for further replies.

babboy12345

New Member
Dear all, i'm doing final year project for using music as a input to control my water pump on/off and other application. But now i dono to use which microcontroller to ADC my music signal, and my signal bandwidth is 4khz.
 
HI
I'm sure if you use AVR (like ATMEGA 32) you can be sucssesfull
allso it has an ADC in itself And can work in 10KHz freqency (if your up freq is near 4khz)
It can programed easly
 
May i know is that have other ic component need for my project or just a single microcontroller can solve it. Besides Atmega32,still have other choices?
 
Hi,
Any microcontroller as long as there's ADC module available in the microcontroller with the sampling rate of more than 8 kHz (Nyquist sampling theorem). Visit Microship website. 8-bit microcontroller will be enough for this frequency.
The other IC needed is the op-amp for the active low pass filter from the music output into the microcontroller input.
 
Dear all, i'm doing final year project for using music as a input to control my water pump on/off and other application. But now i dono to use which microcontroller to ADC my music signal, and my signal bandwidth is 4khz.
Doesn't sound like you even need to record any "music". Just peak rectify the audio with a diode, cap & resistor and use either a ADC or comparator in the microcontroller to detect the varying DC voltage level.
 
Last edited:
Mr bananasiong,thx for ur reply,and i'm happy we r from same country. As bro say,i already done a low pass filter,and now try to ADC my signal,but the problem is,i dono which MCU i gonna to use,and how to write the command,can bro helps?
thx
 
Hi,

Most of the above mentioned microcontrollers can work including microchip's PIC12 or PIC16 family of microcontrollers. If you wish to shorten your learning curve, I will suggest you try out BasicX-24p Stamp controller (**broken link removed**)
 
Hi,
As I said, look for Microchip's website for your requirement. You need ADC, what else? How many I/O pins do you need? What programming language are you going to use? ANY microcontroller will do.
 
Ok. Do you mean PIC16F877A? 877 is not in production anymore.
Read the datasheet of PIC16F877A, under section 11, in page 127. For the ADC to work well, some timing need to be in concerned.

PIC uses sample and hold, whereby an internal capacitor is charged approaching the voltage level of the input. The voltage level in across the capacitor is then sampled to digital form.
Acquisition time is the time for the internal capacitor to be charged up. There's formula shown in the datasheet.
Conversion time takes around 11 AD clock cycles (not microcontroller instruction cycle), depends on how fast you set it.

For example, let's say 4 MHz oscillator is used. Base on table 11-1, the AD clock will be 8 Tosc, which is 2 µs. From the datasheet, the minimum acquisition time is around 20 µs. Then the conversion time will be 11 x 2 µs which is 22 µs. So total time taken for one cycle is 42 µs. So the sampling rate is around 23.8 kHz, which suits your application.
 
thx
you make me clear now, very very thx. If i need oni 8Khz,but i set to 26Khz,is that works well?
You don't need 8 kHz, but more than 8 kHz. So as long as the sampling rate is more than twice the maximum frequency, then it's okay. Of course the higher the sampling rate the better the quality, but you need to handle the conversion data in shorter time.
 
Dear all, i'm doing final year project for using music as a input to control my water pump on/off and other application. But now i dono to use which microcontroller to ADC my music signal, and my signal bandwidth is 4khz.

Hi babboy,
Did you ever get your project working. I'm doing a project quite similar to yours but mine is to detect sound from smoke detector to turn on my water pump. Which microcontroller did you use?
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top