Sound sensitive flasher (MCU)

Status
Not open for further replies.

Mosaic

Well-Known Member
Hi all:

I'm using a 12F675

https://www.electro-tech-online.com/custompdfs/2012/01/131810.pdf

to flash an RGB LED when it senses a loud sound on this mic:

https://www.electro-tech-online.com/custompdfs/2012/01/25R0612.pdf

It's a novelty device that you can wear and it flashes different colors in time to a bass beat.

The challenge is maintaining tiny size, low parts count, and battery power consumption.

So far the design appears to consume 6 pins:

1 for ADC reading mic to 'trigger' flash.
3 for CA RGB LED.
1 for Interrupt on change (driven by a tactile switch to WAKE)
1 for providing power to the MIC (so that I can save power when SLEEPing)

Questions:
1) Do I have to select pins based on TTL or Schmitt operation?
2) For the Interrupt on Change pin, is an RC debouncer required, any suggested RC values if so?
3) Is a comparator input for the MIC preferable to the ADC sampling? Not sure about MIC output voltages yet.
4) Would using a buzzer as a sensor input instead of a mic be better for filtering out the non-percussion sounds?
https://www.newark.com/jsp/search/productdetail.jsp?sku=25R0777
 
Hi Mosaic, maybe I can answer a few of your questions.

1) Your microphone will be on an analog input, so that doesn't matter. Your switch should be on a ST input.
2) Perhaps you would be better off doing the debounce in software for the minimum of external components?
3) ADC sampling is a lot more versatile and would have more uses than a comparator input.
4) TBH I have no idea. At a guess I would say that a buzzer would have a lot worse frequency response than a mic.
 
I need some advice on the interface of the mic to the ADC. The mic produces an AC signal of around perhaps 100mV. I need to offset that by perhaps 1/2 Vdd and then sample with the 10bit adc to measure the peak value.
Would running the AC mic signal into a 1/2 Vdd (2x 9.1 k resistors across the supply rail) be a reasonable way to do it without adding more semiconductors?

If the audio is perhaps 5 khz I'd have to sample at about at least 25Khz to get a sample within perhaps 10% of the peak voltage.

At a 4Mhz clock the ADC sampling takes about 20uS, assuming perhaps 50uS for programming loop overheads that means about 50uS (50 asm instructions) per sample once sampling is done in parallel with the program loop to save acq. time.

That only gives about a 20Khz sampling rate. Not quite hi enough. I may have to interleave ADC sampling in the main prog. loop to achieve the required freq. Perhaps like...Adc sample..do 20 Asm inst - asm sample...etc.
Perhaps use the Acq interrupt to drive things and keep the max adc sampling happening..
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…