LM386N audio amp driven with propeller

mikeamikea Posts: 265
edited March 6 in Propeller 1 Vote Up0Vote Down
I'm trying to connect this audio ic to the prop to drive an 8 ohm, .25 watt speaker. Im using a 5 volt external power supply. How do i connect to the pins on the ic? I will initially be using the gain 20. Would pin 6 be the 5 volt +, and pin 3 be from the prop? Should i have a resistor in series from the i/o pin since the voltage will be higher than 3.3 to the ic? Is Pin 2 ground from the prop? Pin 4, 5 volt ground? Looks like the gain 200 picture posted instead of the 20 gain.
Screenshot_2018-03-05-20-02-20-1.pngScreenshot_2018-03-05-20-03-27-1.png

Comments

  • 8 Comments sorted by Date Added Votes
  • Ahhh, the venerable, cheap, and ugly LM386! Such a messy amp chip with all those extra components and large output cap when even chips decades odl supported directly coupled BTL loads. However the circuit diagram is misleading as it does not show the AC coupling that you will require to drive this chip, I am assuming you are generating analog audio via duty mode rather than simple digital sounds. As always you need an RC filter from the Prop pin and then you need to AC couple that to pin 3 via your volume control whether that be variable or made up of two fixed resistors. I favor a much lower R for the RC filter for the increased drive and lower output impedance so I use 220R and a 0.1uF cap with another 0.1uF cap or better for the AC coupling. Don't expect much power output if you are only running Vs at 5V. If you want a much louder sound at 5V you should use BTL or Class D amp chips (3W) for that.

    Tachyon Forth - compact, fast, forthwright and interactive
    useforthlogo-s.png
    --->CLICK THE LOGO for more links<---
    Latest binary V5.4 includes EASYFILE +++++ Tachyon Forth News Blog
    P2 SHORTFORM DATASHEET +++++ TAQOZ documentation
    Brisbane, Australia
  • Check out my circuit from 10 years ago:
    https://forums.parallax.com/discussion/100750/lm368-audio-amp
    Prop Info and Apps: http://www.rayslogic.com/
  • jmgjmg Posts: 11,781
    mikea wrote: »
    I'm trying to connect this audio ic to the prop to drive an 8 ohm, .25 watt speaker. Im using a 5 volt external power supply. How do i connect to the pins on the ic? I will initially be using the gain 20.
    Would pin 6 be the 5 volt +, and pin 3 be from the prop? Should i have a resistor in series from the i/o pin since the voltage will be higher than 3.3 to the ic? Is Pin 2 ground from the prop? Pin 4, 5 volt ground? Looks like the gain 200 picture posted instead of the 20 gain.
    As Peter says, BTL amps save the output coupling cap and deliver more power eg NCS2211.

    That said, the LM386 still works, and you can prune some parts. Pin7 C is optional, and lowest gain has fewer parts.
    Looking at the internal circuit schematic, Pins 2 & 3 show 50k in, but there are also pins 1 & 8 & 7 that could have resistor-series signal drive.
    If using 2 or 3, and a AV=20 you need a divider of 1/12 from 3V and AC coupling. (3+ parts)
    Or, you could experiment with ~10k direct from your P1 pin to Pin 1 or Pin8, (Gnd Pin2 & Pin 3) and scope the output.


  • Another approach is to directly drive the speaker class-D from the digital pin using a high current buffer
    to boost the current (& maybe voltage).
  • “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • Tracy AllenTracy Allen Posts: 6,271
    edited March 7 Vote Up0Vote Down
    Here are couple of blasts from the past.
    pik33's low-noise driver
    MarkT's take on class D

    As mentioned, bridge tied, differential outputs are superior to the single ended output that needs the fat capactor. Furthermore, differential inputs are nice too, if nothing else, to forestall the annoying pop that can occur when starting up single ended. The Prop's duty differential mode is convenient for that. The LM386 does have a PNP differential input stage, so it appears that it could accept differential input instead of the single ended input shown in the example schematics. Not easily though, because it has a narrow +/- 0.4V common mode range centered around ground, . The modern chips (I've used the TPA6204) have a common mode range that spans almost the full power supply range. The +/- inputs can sit at Vdd/2 = 1.65V, and the amplifier can be set up with a gain of close to x1 to take advantage of the full span of pwm input.
  • [ I've updated that thread you mention as I've been experimenting with class D again recently. ]
  • I used this chip back in the 80's ....It made for a cool Guitar amp.
    __Walt McDonald__

    The Truth is out there
    It's not rocket-surgery
    I see why we don't have any water,All of the pipes are full of wires!
    E=WMc2
    Now with WiFi
    Not in the Spin Bunch
    import RPi.GPIO as GPIO

    ABB M202 certified
    ABB M211 certified
Sign In or Register to comment.