2
\$\begingroup\$

We need to connect a small speaker- a headphone one, to an Microchip Pic. I don't know whats the resistance of such speaker(it's very small) but I guess it's 8-ohm. (We are only using one headphone speaker, not both.)

I know the Pic can output 20mA in a port, so with 5V output and 20mA I have about 0.1W to use, which is good enough (Does not have to be audible to humans, this will be audio-coupled to a microphone).

Not knowing the speaker's impedance or current requirements, I was wondering if connecting them with a 300Ω resistor, directly to the mcu (with a dc blocking component), would produce something, or am I missing something?

Please don't advice an op-amp. I know about them, but am trying to avoid that, because I need a small signal and very small power draw.

\$\endgroup\$
  • \$\begingroup\$ Headphones are often 16-32 ohms. Also, "class D amplifier". \$\endgroup\$ – Ignacio Vazquez-Abrams Oct 4 '13 at 8:29
  • \$\begingroup\$ @IgnacioVazquez-Abrams class D is overkill for a headphone speaker. Overkill might be a understatement. \$\endgroup\$ – Passerby Oct 4 '13 at 8:37
  • 1
    \$\begingroup\$ @Passerby: Sure, but if he's connecting it to a MCU anyways then he gets one for free. \$\endgroup\$ – Ignacio Vazquez-Abrams Oct 4 '13 at 8:38
  • \$\begingroup\$ 300 ohm and a series decoupling capacitor would work ok if you are just feeding tones - don't expect audio unless you are PWM modulating the logic signal from the MCU. \$\endgroup\$ – Andy aka Oct 4 '13 at 8:39
  • 2
    \$\begingroup\$ The 300R seems like a bad idea, most of your tiny output power will end up there and not in the headphone? \$\endgroup\$ – pjc50 Oct 4 '13 at 8:41
2
\$\begingroup\$

While this is a less authoritative answer than I prefer to give, frankly, yes, that should work.

There are many projects where a speaker is directly connected to a microcontroller through just a resistor. The Arduino Tone library and Tutorial is one such example. The Arduino uses an Atmel ATMega328 (or similar), with a similar current limit (40mA, with voltage droop). The example/recommended setup is an 8Ω speaker connected with an 100Ω resistor. While speaker Impedance is not the same type of Ohms as DC Resistance, the combination of greater impedance of your headphone speaker (Typically 16-32Ω) and higher limiting resistor (300Ω as you mentioned) should be enough to both produce sound and protect the Pic's output pin.

Most often, a DC blocking capacitor is not needed in these limited situations.

Then again, this is my educated guess.

The other option is using a single npn transistor for the speaker. This might be sufficient if a direct connection is not.

\$\endgroup\$
  • \$\begingroup\$ Thanks a lot for your help ! but with 300 ohm resistor, and a 16 ohm speaker, the resistor takes all the power for himself, isnt it ? and about the transistor, because some restriction ,we didnt wanted to put one, but if you have some circuit diagram that uses only 1 transistor,not too many things around him, i will be happy to hear. thanks again.] \$\endgroup\$ – Curnelious Oct 4 '13 at 9:07
  • 1
    \$\begingroup\$ @Curnelious: Connecting the speaker and filter across complementary outputs will increase the output power. \$\endgroup\$ – Ignacio Vazquez-Abrams Oct 4 '13 at 9:12
  • \$\begingroup\$ i dont get you. you say i should output the signal from 3 ports of the mcu, to the speaker ? \$\endgroup\$ – Curnelious Oct 4 '13 at 9:21
  • 1
    \$\begingroup\$ Use 2 outputs. When one outputs a high the other outputs a low, and vice versa. \$\endgroup\$ – Ignacio Vazquez-Abrams Oct 4 '13 at 9:31
  • \$\begingroup\$ @Curnelious it shouldn't. And you could adjust the resistor as needed (a trim pot can be used for testing). \$\endgroup\$ – Passerby Oct 4 '13 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.