I'm trying to keep the pin usage down on my Arduino project as I don't know how far I'll go with adding features. Initially, I'll be powering a 1602 16x2 LCD with a 595 shift register. I also want to power a speaker, but I've gathered that hooking it directly to the 595 with the LCD will procude a very "buzzy" sound.
I've read things like controlling a 555 timer from the 595, and using the 555 to drive the speaker, but haven't found a definitive way forward.
Please could someone recommend how to run a speaker from a 595? I'd like to be able to control the pitch, tone and length (it will be producing morse code) of the sound from it.
but I've gathered that hooking it directly to the 595 with the LCD will procude a very "buzzy" sound..
...I'd like to be able to control the pitch, tone and length (it will be producing morse code) of the sound from it.
Digital circuits produce square waves & rectangle waves which have lots of harmonics. You can control the pitch (frequency), and to some extent you can adjust the "tone" (and volume) by adjusting the duty cycle. A "pure" tone is a sine wave. The length/duration is no problem.
You might want to download [u]Audacity[/u] (a FREE audio editor). It has a Generate feature that can generate square or sine waves at any frequency you wish. That would make it easy to experiment with different tones to see what you like, so you know what you are shooting for.
Please could someone recommend how to run a speaker from a 595?
You probably need an amplifier, or at least a MOSFET. (An amp would give you a volume control)... How much current can you get from a 595? 5V into an 8-Ohm speaker is 625 mA (5/8 = 0.625).
Take the 595 and run it thru a LM386 for some more volume. How loud do you need ...---... ?
Why use all the pins needed to drive a '595 tho? Go direct from an IO pin - can control the frequency and duration easily, use blink-without-delay style control.