0

I am using an ATmega328 to drive a 16x2 LCD, a LED, and a piezo buzzer. Piezo buzzer needs to buzz after every 5 seconds. But it doesn't make a nice sound it just gives out a faint buzz. Suspecting the buzzer to be faulty, I tested it separately from a 5V supply and it worked well. Then I put it back in the circuit and checked for the amount of current the whole circuit used. It was about 26mA when buzzer and LED were turned off, and 36mA with buzzer and LED ON. So no problem there. Additionally, the buzzer sometimes start sounding well too occasionally. This occurs after about half a minute the circuit is turned ON. This looks like that the buzzer is somewhat warming up before it can work properly. But this occurs occasionally.

I am using A0 Analog pin (or Pin no. 23 on ATmega328) for driving the Buzzer and giving 100Hz square wave to it.

What could possibly be the reason for this problem?

  • 3
    Re “I tested it separately from a 5V supply”: you mean with no square wave? Then you mus have a self-oscillating buzzer, right? You are trying to drive it with a software-generated square wave? – Edgar Bonet Jan 28 at 9:29
  • give the buzzer digitalWrite(HIGH) – Juraj Jan 28 at 9:43
  • even with a plain piezo 100 Hz is a very deep sound not played well on piezo – Juraj Jan 28 at 10:15
  • @Edgar Honey yes with no square wave...i used 5V using external supply... It worked well. But when 5V was supplied using microcontroller, it didn't work untill few seconds – Bhuvnesh Jan 28 at 16:03
  • 1
    you need a speaker, not a buzzer – jsotola Jan 28 at 20:13
1

If it works well with direct 5v supply and not from an Arduino pin, you probably need a transistor to drive the buzzer.

Here is an example how to drive a buzzer using a transistor: https://www.maxphi.com/piezo-buzzer-interfacing-arduino-tutorial

| improve this answer | |
0

Some buzzers are active buzzers and will self oscillate when powered. Other buzzers requires an oscillating signal on their pins in order to make a sound. If the buzzer works on 5v then its an active buzzer and you only need to feed it a HIGH signal to make it work. Don't try to feed it a 100hz square wave.

| improve this answer | |
  • It worked well with a constant 5V supply but not when this constant 5V was supplied using code(here I am not talking about the 100Hz wave, I modified the code to give a constant 5V) – Bhuvnesh Jan 28 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.