I have a small 5v buzzer which I am using, I initially used the tone() function and that all worked fine. Only problem is that it is not loud enough for what I am using it for. I tried applying 3.7v to it from a lithium ion battery and it was much louder, I then tried using digitalWrite to apply the voltage but it barely does anything. Anyone know how to get it working as I dislike using the tone() funtion. (Do not have link/information for the buzzer)
If all you need to do to make it sound is connect it to a battery, then try driving it via an NPN transistor as you would a small motor. See http://embedded-lab.com/blog/wp-content/uploads/2010/12/Circuit_SingleTransistorDCMotor.png but don't use a BC547, use a BC337 or 2N2222A.
Is that buzzer buzzing on its own if you connect it to 5V ?
The Tone() library is to generate a tone to a loudspeaker.
Erdin:
Is that buzzer buzzing on its own if you connect it to 5V ?
The Tone() library is to generate a tone to a loudspeaker.
If you mean connecting it directly to a 5v power source, then yes. I know the tone() library generates a frequency and not direct voltage.
Still don't understand why I cant connect it to a pin and ground, set the pin high and achieve the same result as connecting it directly to a battery.
rep8:
Still don't understand why I cant connect it to a pin and ground, set the pin high and achieve the same result as connecting it directly to a battery.
-
Maybe there was an error in your code. Did you remember to set the pinMode to OUTPUT?
-
Maybe the buzzer takes too much current for the pin to supply. Did you measure the voltage on the pin?
dc42:
Maybe there was an error in your code. Did you remember to set the pinMode to OUTPUT?
Maybe the buzzer takes too much current for the pin to supply. Did you measure the voltage on the pin?
I am certain that there is no error in the code, I even used the blink sketch and re-assigned the pin to ensure it. There is an extremely faint sound when it is set high, and about 3.1-3.2 volts are on the pin (using an arduino fio (3.3v))
Then you need to drive it with a transistor and stop killing your arduino output pin.