LM386
Schematic
Gain | C1 | R1 | R4 |
---|---|---|---|
20x, 14x, 10x | - | - | 2k, 5k, 10k |
20x | - | - | |
50x | 10UF | 1.2K | |
200x | 10UF | - |
- Amplification is controlled by R2 in schematic 2
- C1 1~10uF Bypass capacitor
- C2 10uF Gain 200x. Optional, without 10uf is 20x gain.
- C3 220uF Output coupling capacitor
- C4 47nF Boucherot cell
- C5 100nF Power supply decoupling
- C6 100uF Power supply decoupling
- C7 10uF Microphone coupling capacitor
- MIC Electret microphone
- R1 10R Boucherot cell
- R2 1 ~ 10K Microphone load resistor
- VSS 4 ~ 12V Supply voltage
Demo Code
- Only generate very simple sound for testing.
#define SOUNDOUT_PIN 9
void setup(void){
//Set the sound out pin to output mode
pinMode(SOUNDOUT_PIN,OUTPUT);
}
void loop(void){
//Generate sound by toggling the I/O pin High and Low
//Generate a 1KHz tone. set the pin high for 500uS then
//low for 500uS to make the period 1ms or 1KHz.
//Set the pin high and delay for 1/2 a cycle of 1KHz, 500uS.
digitalWrite(SOUNDOUT_PIN,HIGH);
delayMicroseconds(500);
//Set the pin low and delay for 1/2 a cycle of 1KHz, 500uS.
digitalWrite(SOUNDOUT_PIN,LOW);
delayMicroseconds(500);
}
- Arduino audio player project on this page.