What I mean is if it is an open drain and you connect the diode one way it will work as intended, but if it is not an open drain then no matter which way you fit the diode it shorts the output when it is driving either positive or negative. George ----- Original Message ----- From: "Mike" To: Sent: Saturday, November 29, 2003 12:16 AM Subject: Re: [PIC]: Driving a speaker? > On 28 Nov 2003 at 22:15, gtyler wrote: > > > > This could be true if it is an open drain output, otherwise it does not > > matter which way the diode is, > > Yes it does. It's called a inductive kick-back and it doesn't care if its an open-drain or > not. It will attempt to sent a high-current spike in the other direction. I wouldn't count > on the pull-up to absorb it all either. > > There's a lot of text below and by top posting, it isn't clear who or what you're replying > to. > > > in one direction the diode will short the > > output, also an isolating capacitor does not solve it either. > > The cap is to protect the speaker in the event that the PIC output is inadvertently left > high. > > > While I have > > seen PICs work like this I doubt if it is good practice.Rather drive a > > transistor and use that to drive the speaker. > > Why would it be bad practice? It only depends on the amount of drive required. If the > PIC can drive it... as they say, "If it ain't broke, don't fix it." > > at 5Vp-p into 8 ohms with no cap: > > Vrms = 3.53V and P = 1.56 W avg > > with cap and assuming a reasonable square wave at the speaker, neglecting cap > loss: > > Vrms = 2.5V and P = 781mW avg. > > NOTE: square wave in this context implies 50% DC, any thing else is a pulse or > rectangular wave except for 0% and 100% DC > > Take 781mW (with cap, which is smart, not for the speakers sake in this case, but > that of the PIC) and you get: > > Irms = sqrt(Pave/R) = 312 mA rms > > Ip = 441mA > > So much for the 8 ohm speaker with no driver transistor. But that removes the > abiguity of the technical term "doubt" used above. Good guess, though ;-) > > BRs, > Mike > > > > George > > > > > > > You really want to load the pic output with a diode? > > > > > > > > > > George > > > > > > > > No, and that wasn't suggested. The diode is there to prevent the > > > inductive > > > > kickback from hitting the PIC pin. I don't see how you can say you are > > > > "loading" the PIC pin with the diode, the diode only conducts when the > > > > speaker is turned off, and then only conducts current due to the attempt > > to > > > > change the current flowing through the speaker quickly. It is a similar > > > > effect to turning off a relay. TTYL > > > > > > You're both right - depends which way round the diode is. > > > > > > Regards > > > Sergio Masci > > > > > > > -- > > http://www.piclist.com hint: PICList Posts must start with ONE topic: > > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics