PDA

View Full Version : Is it dangerous to connect a 8 ohm speaker to a bs2?



Tobi
04-14-2010, 02:23 AM
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..... http://forums.parallax.com/images/smilies/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

davejames
04-14-2010, 03:04 AM
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

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

Leon
04-14-2010, 03:07 AM
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

erco
04-14-2010, 03:09 AM
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."

davejames
04-14-2010, 03:16 AM
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

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

Tobi
04-14-2010, 03:19 AM
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 http://forums.parallax.com/images/smilies/blush.gif )

I´ll go to bed now, cause it´s bedtime here nowhttp://forums.parallax.com/images/smilies/smile.gif

Tobi

davejames
04-14-2010, 03:20 AM
...and what was the 'solution'???

DJ

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

Tobi
04-14-2010, 03:39 AM
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 http://forums.parallax.com/images/smilies/smile.gif)

erco
04-14-2010, 07:30 AM
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 ARSE!

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)
04-14-2010, 12:42 PM
Use a transistor to drive the speaker, and you should have no worries. For an example circuit, look at the schematic for the SoundPAL (http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/28825/List/0/SortField/4/ProductID/482/Default.aspx):

http://forums.parallax.com/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

sumdawgy
04-14-2010, 08:19 PM
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. (http://www.national.com/ds/LM/LM386.pdf)

RadioShack sales info here. (http://www.radioshack.com/product/index.jsp?productId=2062598#tabsetBasic)

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 http://forums.parallax.com/images/smilies/nono.gifcommon sense still applies.


{edited RE:clamping}


Post Edited (sumdawgy) : 4/14/2010 1:42:30 PM GMT

Spiral_72
04-14-2010, 09:00 PM
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"...... crap, there went another one.

davejames
04-14-2010, 10:02 PM
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

erco
04-14-2010, 10:31 PM
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."

Tobi
04-18-2010, 12:15 AM
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