From: firstname.lastname@example.org (Bob Masta)
Subject: Re: Connecting a PC-speaker to a PIC cpu
Organization: Interstellar Research
X-Newsreader: Forte Free Agent 1.11/32.235
Date: Fri, 15 Nov 2002 13:47:44 GMT
NNTP-Posting-Date: Fri, 15 Nov 2002 08:47:44 EST
On Thu, 14 Nov 2002 20:35:24 +0100, "Henrik"
>I am trying to connect a PC Speaker (0.5W, 8Ohm) to a PIC cpu (16f877). (I
>am not sure about the Watt of the speaker, I do not got it in front of me at
>I am using PWM modulation in the PIC to achieve a sinus wave. The output is
>a flawless sinus from the RB1 port (measured with a oscilloscope). But when
>I connect the PC speaker I get no sound. This, I assume is because the PIC
>cpu generates to low current(?). Anyone got a suggestion on a circuit that I
>can use so I get my sinus-wave-sound? I've tried using a LM386 effect
>amplifier, using the circuit for a gain of 50, on the data page. But the
>signal out from the amplifier doesn't look to good.
>* Should I have a capacitance between the input of the amplifier and the
>* Is there a easier way of using the PC speaker?
I concur with the other posters who suggested a simple
transistor buffer, directly coupled to the PIC. This is
essentially what PCs use to drive the speaker. To
generate a sine wave with PWM, you have to use a
carrier frequency that is higher than the speaker
can handle (or your ears can hear, wichever is less).
The speaker will be operating with an effective DC
bias of half the sine amplitude, since this simple
circuit will only pull the speaker coil in one direction.
That means that you need to be careful of starting
and stopping sounds, since there will be a turn-on
You might get slightly better fidelity by converting the
PWM to 0-centered AC and running it through an
amp, but probably not worth the effort.
D A Q A R T A
Data AcQuisition And Real-Time Analysis
Shareware from Interstellar Research