I want to use a microphone in a simple project (reflex tester) so I don't want to use an op amp to get the audio signal. How can I use an NPN transistor to amplify the signal?
The idea of the project is that an LED turns on at a random time, and you have to clap when you see it come on. Your reflex time is the time between when the LED turned on and when you clapped. I obviously don't care about audio quality, so I don't want to use an op amp.
What kind of microphone are you using? I guess it generates a small mV signal when talked to. You can't switch on the transistor with that small of a signal unless you bias it.
What I did a while back was to bias the signal from an mp3 player (+-1V max) with a coin battery and voltage divider. I take about 1.5V from the voltage divider using a 3V coin battery. I then chained the signal from the mp3 player in series with this bias voltage. Then I used a 10KOhm resistor for base, and maybe 300Ohm for emitter with a small speaker. My collector bias voltage Vcc was 9V from a 9V battery. Without knowing the voltage range of your microphone when it's in real-time situation, I can't say for sure my setup works for you.
BTW, do you want an amplified analog signal or just a digital high/low? If you want digital, make the collector resistance larger, like 2K.
Have you got the electret the right way around? The negative pin that should go to ground is connected to the case.
What are you doing with the Analog in? This cct does not integrate the signal to just give you a volume level, it actually follows the audio waveform. So the integration goes no in the software. Even so, you would get some variation.
You should get a reading of around 512, but that need not be important. Maybe its just got a slightly high bias. Have you checked with a scope, or other test (speaker, AC meter, arduino test program...), that it doesn't react to sound?
I think Si's schematics should work. You can also try my one-transistor variant that I used on my morse encoder/decoder. I think the 3904 should work instead of the BC548 I used, but thats mostly a guess, I haven't really checked.
Both schematics just amplifies the soundwaves, and will oscillate around the center value (maybe 880 in your case). You will have to make some threshold value in software to check against. It's the same thing I did with my morse decoder btw, it just checks for sounds for its audio input. A simple clipping filter, I just ignored any samples below a certain value.
Other that that, why not use an op-amp? It seems well suited for your purpose, easy to make the amplification / sensitivity variable and much more sensitive than the aforementioned circuits.
I've already done amplification with an op-amp, so I just wanted to try the NPN variation. The circuit from nerdkits worked, but I took it apart for si's.... maybe I'll try it again. I don't have a scope, but a constant value of 880 seems odd... Unless all of my transistors are shot.
As I said before, the fluctuation is the signal. If you want to get the overall level, you need to do some Integration / low pass filtering / averaging.
The sketch I pointed you at for the book, has an algorithm in it to LP filter.
A 1 KHz sound wave is an oscillation at 1000 times per second. Lets say a sine wave. So if you sample the amplitude you may hit it when its at a peak, or when its in a trough. But unless you do something like find the highest value, or low pass filter it to obtain the envelope, you will not have a measure of the 'volume' of the sound.
Words to lookup on Wikipedia: low pass filter, signal envelope, sine wave