Shop OBEX P1 Docs P2 Docs Learn Events
Is it dangerous to connect a 8 ohm speaker to a bs2? — Parallax Forums

Is it dangerous to connect a 8 ohm speaker to a bs2?

TobiTobi Posts: 5
edited 2010-04-17 17:15 in BASIC Stamp
Hi everybody,

In this article http://forums.parallax.com/showthread.php?p=536748
Third posting, written by Jon Williams, is a sentence which frightens me..... freaked.gif

Jon Williams wrote, that you should not connect a speaker directly to a bs2,and now i´m asking myself what would happen if you would do, what would happen.

Would it be okay to put a transistor between port and speaker?

Thank you for answering,

a scared Bs-Newbie
Tobi

Comments

  • davejamesdavejames Posts: 4,047
    edited 2010-04-13 20:04
    Tob,

    It's a "current thing"; meaning, an 8 ohm resistance would allow more current to flow through the BS2 pin than the BS2 can safely provide and wind up damaging the circuitry "behind the pin".

    If the BS2 pin "high level" was 5 volts, then with an 8 ohm resistance connected to it (and the other end to ground), 625mA would be the end result if the BS2 could supply it. However, the BS2 has a 20mA per pin limit and anything over that will likely damage the device.

    Later,

    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • LeonLeon Posts: 7,620
    edited 2010-04-13 20:07
    Connecting a low impedance device like an 8 ohm loudspeaker to the output of any MCU might damage the output circuit for that pin. Some sort of buffer is needed. The resistance of the loudspeaker will a lot less than the impedance.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Leon Heller
    Amateur radio callsign: G1HSM
  • ercoerco Posts: 20,256
    edited 2010-04-13 20:09
    Just put an electrolytic cap (try 10-100 uF) between the stamp pin & speaker, you'll be fine. It blocks DC, and lets the audio signal pass through.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • davejamesdavejames Posts: 4,047
    edited 2010-04-13 20:16
    Erco - would not the inital inrush current of a 100uF cap to ground through 8 ohms be a bit much for the BS2 pin? Time constant for that scenario would be 800us and the cap would require at least 5 time constants to be remotely charge taking us to 4ms. Can the BS2 survive that?

    I don't know - just think'n out loud.

    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • TobiTobi Posts: 5
    edited 2010-04-13 20:19
    Thanks everybody for answering, that was pretty fast.

    After writing the message, i was thinking about the prob and found the solution.

    Writing down something seems to clear the mind (next time i will write my question on a piece of paper, and then when my mind doesn´t clear, i´ll post a question blush.gif )

    I´ll go to bed now, cause it´s bedtime here nowsmile.gif

    Tobi
  • davejamesdavejames Posts: 4,047
    edited 2010-04-13 20:20
    ...and what was the 'solution'???

    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • TobiTobi Posts: 5
    edited 2010-04-13 20:39
    Thinking about it, I started to calculate, like you did...

    the solution was to use a piezo speaker, or to use a transistor in front of the speaker.

    Tobi (trying to go to bed smile.gif)
  • ercoerco Posts: 20,256
    edited 2010-04-14 00:30
    Dave: XLNT point. I'm far from my Parallax documentation which recommends a particular value. I found this online, which mentions using 10 uF: http://claymore.engineer.gvsu.edu/~jamisond/controls.html

    I'll check tonite and report back. Your consideration of time constants is much more scientific than my quick 10-100 swag! There's some current lag due to the inductance of the speaker coil which limits the current inrush as the cap charges. So I suspect the Stamp could handle the brief current rush from a 100 uF cap (if a 10 uF is OK), but I'll defer to the experts!

    Which reminds me that yet again, I missed a key opportunity to use my favorite Hollywood line to sum up my simple electrolytic solution:

    POP A CAP IN ITS RAGGEDY Smile!

    Edit: Yep, even my old BS1 Parallax handbook calls for a 10 uF cap, so keep that value low. They and the link above both call for 32-40 ohm speakers, too!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."

    Post Edited (erco) : 4/14/2010 2:15:52 AM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-04-14 05:42
    Use a transistor to drive the speaker, and you should have no worries. For an example circuit, look at the schematic for the SoundPAL:

    attachment.php?attachmentid=69429

    Don't leave out the protection diode! A speaker is an inductive device, just like a relay or solenoid.

    -Phil

    Post Edited (Phil Pilgrim (PhiPi)) : 4/14/2010 5:48:10 AM GMT
    651 x 352 - 19K
  • sumdawgysumdawgy Posts: 167
    edited 2010-04-14 13:19
    I REALLY suggest· an inexpensive little·audio amp I use quite often in these situations...
    Comes as a little 8 pin DIP and @ $1.49 (Radio shack).·· (It might look like the ATTiny13 in the soundPAL schematic...that certainly looks like the same pin config.· But my memory is hazy.)

    It's cheaper than transistor/cap/resistor & my time are worth seperately.

    Oh and having hooked a Dishawasher to a bs1-ic... DON'T FORGET TO MAKE CERTAIN YOUR CLAMPING DIODES ARE CONNECTED.· (ie: I ran the wire from the darlington...left it in the bundle...so much pain.)

    LM386 Tech specs here.

    RadioShack sales info here.

    One caveat....lately, you need to order your parts online.· Cellphone commisissions have put most stores into blowing off thier parts inventory.· They may show a part on inventory that they don't know (& typically don't care) they "lost".·· I've taken to rummaging Radio shacks as I happen to drive by for my common use stuff.

    BTW, the use of the capacitor v/transistor was already well discussed.
    I just wanted to add 2 cents that using a disc Capacitor doesn't draw much charge current and should always be you D/C filter goto for allowing sound "A/C signal" through with no relatively no D/C flow.· Of course, let's not go using monster values here nono.gifcommon sense still applies.


    {edited RE:clamping}


    Post Edited (sumdawgy) : 4/14/2010 1:42:30 PM GMT
  • Spiral_72Spiral_72 Posts: 791
    edited 2010-04-14 14:00
    The BASIC_Stamp_Manual_v2_2.PDF page 200 has the attached schematic. I copied the pic directly from the Parallax document.

    I've used it many times, and had a lot of fun with it. I posted source code on here about a month ago to play Amazing Grace.

    I used a small 2" or so speaker. I think it was a 4ohm speaker.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "puff"...... Smile, there went another one.
    536 x 240 - 70K
  • davejamesdavejames Posts: 4,047
    edited 2010-04-14 15:02
    Erco - no "expert" here! (smiles)

    The use of a higher impedance speaker would certainly help the situation, but in the long run...if I were to attempt this...I'd use a buffer/drive/something-or-other in between the speaker and stamp; better protection for the Stamp and more oportunities for active filtering to "shape" the sounds.

    Later,

    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Post Edited (davejames) : 4/14/2010 3:07:47 PM GMT
  • ercoerco Posts: 20,256
    edited 2010-04-14 15:31
    I have taught classes using the BS2 Homework Boards and BS1 project boards. Both of those have 220 ohm protection resistors on all pins, so directly connecting a piezo (or speaker through a cap) barely produced any sound at all. Students used a one-transistor amp for all the speaker projects, which works fine. That built-in 220 ohm resistor will do as a bias resistor in a pinch. Ideally you should add more series resistance to properly bias a 2N2222, but students always lose the tiny resistors I gave them. I was happy if they didn't lose the transistor! You can run the speaker off of 9V Vin (instead of 5V Vdd) for a little extra volume.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • TobiTobi Posts: 5
    edited 2010-04-17 17:15
    Hello everybody,

    First I wanna thank everybody who answered my question! So many solutions for one problem!

    Would it be ok to·link it to the User FAQ?·It may·be helpful for·other users.

    @Erco: i´m using a script for the bs 1 project board, written by a german teacher. There´s a circuit for a speaker, which i would use for my BOE. I didn´t know that there are no 220 ohm safety resistors on the BOE.

    Greetings, Tobi
Sign In or Register to comment.