LM386

From ElectroDragon Wiki

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
  1. C1 1~10uF Bypass capacitor
  2. C2 10uF Gain 200x. Optional, without 10uf is 20x gain.
  3. C3 220uF Output coupling capacitor
  4. C4 47nF Boucherot cell
  5. C5 100nF Power supply decoupling
  6. C6 100uF Power supply decoupling
  7. C7 10uF Microphone coupling capacitor
  8. MIC Electret microphone
  9. R1 10R Boucherot cell
  10. R2 1 ~ 10K Microphone load resistor
  11. 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.