maximum power applied to it will be about 1.26W with a
4.5V supply. Note: The RMS voltage of a 0V based/50%
duty cycle square wave is
Vrms = Vpk ÷ √
2
Refer to
https://masteringelectronicsdesign.com/how-to-derive-the-rms-value-of-pulse-and-square-waveforms for
more details.
The PN2222 can drive a larger speaker if you need
more volume. I used the PN2222 instead of a newer
transistor (such as the 2N3904) because the PN2222
can handle more collector current: 1A vs. 200 mA. R5 is
present because there is very little volume until you reach
about 2.5V driving the base resistor.
If you use a more powerful speaker, you may want
to decrease the value of R5, or eliminate it completely by
replacing it with a jumper. If you need more sound output,
a larger speaker will work, but I would not use one less
than 8Ω.
I tried a speaker I have with taps for 40Ω, 20Ω, and
10Ω. The speaker (about 30 years old with no power rating
on it) is 5” x 7” and was quite loud using any of the three
taps, with the 10Ω tap being the loudest. I recommend
that you use a diode across the speaker input since most
speakers present an inductive load.
You can also use a higher voltage supply for just the
speaker. You’ll still need a lower voltage for the PIC; it will
operate anywhere between 2.5V and 5V. You’ll need to be
careful that you don’t cause the PN2222 to dissipate too
much power. Its spec is about 0.6W. Of course, you can
add an external power transistor if you need lots of volume.
If you look at the board layout in Figure 2, you can see
that the speaker connections are quite close to both the
battery pins as well as Q3. This was done deliberately to
keep the high current path of the speaker away from the
rest of the circuit.
Note that the current for the speaker does not go
through Q1. This was done because I didn’t want the high
current to be switched by Q1. My first design had the
current go through it, which created a problem. Due to
Post comments on this article and find any associated files and/or downloads at
www.nutsvolts.com/
magazine/issue/2018/09.
; FIGURE 1.
; FIGURE 2.
September/October 2018 23