I built a project with a morse key. My arduino drives a buzzer and I can control the pitch with the tone library, but controlling the volume is really hard. I added a potentiometer in series but it is really on or off. Once the voltage drops below a certain level, the buzzer goes off. Above that level it is on.
Is there an alternative to a buzzer? All I need are morse code beeps, nothing fancy, but with a volume control. I'm open to both hardware and software suggestions.
Tried this, but buzzer is really going on/off. No real volume control. Also tried with a resistor in parallel to reduce 500ohm range to a smaller range to get finer control, but it's really on/off.
Connect your buzzer directly to 5volt and ground, and see if it beeps.
If it does, then you have an active buzzer.
Only passive (piezo) buzzers can produce different tones, and can be volume controlled.
The ToneAC (not tone) library has a software volume option.
Leo..
Besides possibly needing a lower resistance pot, because our ears are logarithmic volume controls are normally Audio Taper. A regular linear pot make more-noticeable change at lower volume with very little perceived change past the half-way point.
That's more important for an everyday volume control than for an adjustment that's done less frequently.
I have found both types in my drawer. The active one cannot be controlled in volume, but it does produce tones with the tone library.
The passive one that I found is always quiet. No markings on it, so perhaps it is a 12V one and my 5V cannot drive it hard enough. Any suggestions on a good passive buzzer from the usual chinese stores?
Will look up that ToneAC library, sounds promising