Go Down

Topic: [SOLVED] problem with arduino buzzer module (Read 2609 times) previous topic - next topic

Payam_sbr

Dec 11, 2017, 07:33 pm Last Edit: Dec 15, 2017, 04:43 pm by Payam_sbr
I bought this buzzer module:

This module presents 3 pins, /ground/IO/vcc/
And simply use a transistor to providing buzz.

board is pro mini 3.3v
my problem appear after calling:

Code: [Select]

analogWrite(3, 20):
delay(50);
analogWrite(3, 0):
delay(50);


after that Seems Buzz is finished  but some quiet noises still sense able, which ended after i cut the i/o wire. This noises come back again when i touch the i/o pin of the module or connect it to the ground.

Is it a reverse flow trough the pin#3 (i decided pin3 for sending analog) which comes from module to arduino?

does it damage my output pin or even arduino board?

What is wrong and how can i solve it

P.s:/ also i used a zener diode between arduino and module but no success.

I can attach some schematics if realky needed.

DVDdoug

#1
Dec 11, 2017, 08:04 pm Last Edit: Dec 11, 2017, 08:13 pm by DVDdoug
That shouldn't be happening.

Is the buzzer ground connected to the Arduino ground?

What does the (unwanted)  noise sound like?   Is it similar to what you're hearing with analogWrite()? Or higher/lower pitch, or hiss or crackle, etc?

Are you sure the noise is coming from the piezo speaker?

Is that a "buzzer" or a "transducer"?    A buzzer makes noise when you apply DC.   A transducer/speaker is driven by an AC audio signal...   If it makes a tone/buzz (not just background noise) with digitalWrite() it's a buzzer.

What are you using for a power supply?  i.e.  If you can try running if off a battery that can tell you if the noise is coming from the power supply.

Noise wouldn't be unusual with a normal-linear amplifier, but the transistor won't switch-on until you get nearly 1/2 of a volt and that would be a LOT of noise.   And, you should get "dead silence" with the input grounded.





BTW - Is there a reason you're using analogWrite()?   That can "work", but the default PWM frequency is a little low for a piezo.    Normally, you'd use tone() with a transducer and digitalWrite() with a buzzer.     With a transducer  analogWrite(128) will give you a square wave for the loudest sound.     

Payam_sbr

Is the buzzer ground connected to the Arduino ground?
Thank you for response.
yes sir.

What does the (unwanted)  noise sound like?   Is it similar to what you're hearing with analogWrite()? Or higher/lower pitch, or hiss or crackle, etc?
attached an amplified record of this noise  (recorded by phone).

Are you sure the noise is coming from the piezo speaker?

Is that a "buzzer" or a "transducer"?    A buzzer makes noise when you apply DC.   A transducer/speaker is driven by an AC audio signal...   If it makes a tone/buzz (not just background noise) with digitalWrite() it's a buzzer.
this buzzer uses DC voltage as input and analogWrite just charge its transistor to acting like a switch. there is a short "CHICK" like sound when i use digitalWrite(#pin, HIGH) which ended  very fast.

What are you using for a power supply?  i.e.  If you can try running if off a battery that can tell you if the noise is coming from the power supply.
i used a wall adapter 5v, but i connected module VCC to arduino vcc for a 3.3v how ever this module is compatible with both 3.3 and 5 volts. BUT this noise can be sensed via USB powering.

Noise wouldn't be unusual with a normal-linear amplifier, but the transistor won't switch-on until you get nearly 1/2 of a volt and that would be a LOT of noise.   And, you should get "dead silence" with the input grounded.
i used Arduino Ground for module GND-PIN,
this dead silence just occur when i disconnecting I/O pin of the module.



BTW - Is there a reason you're using analogWrite()?   That can "work", but the default PWM frequency is a little low for a piezo.    Normally, you'd use tone() with a transducer and digitalWrite() with a buzzer.     With a transducer  analogWrite(128) will give you a square wave for the loudest sound.
as i tested right now, when i use Tone(pin#3, Frequency, 50ms) that noise will be sense able, this occurs after digitalWrite(pin#3, LOW) !!

please help me to understand the reason of this noise! why my body cause this too when touching that I/O pin of module :o  :smiley-eek-blue:

jremington

#3
Dec 12, 2017, 12:28 am Last Edit: Dec 12, 2017, 12:29 am by jremington
Quote
why my body cause this too when touching that I/O pin of module
Your body will pick up a 50 or 60 Hz signal from the nearby AC wiring by capacitive coupling, and that signal is apparently enough to trigger the transistor on the buzzer module.

Payam_sbr

#4
Dec 12, 2017, 08:48 am Last Edit: Dec 12, 2017, 08:55 am by Payam_sbr
Your body will pick up a 50 or 60 Hz signal from the nearby AC wiring by capacitive coupling, and that signal is apparently enough to trigger the transistor on the buzzer module.
Thanks,
I guess analogWrite(..., 0) also provide some less Hz signals because connecting buzzer base to other pins does not cause any noise.

//!\\ also arduino ground also generate some noises

sterretje

analogWrite(..., 0) actually produces a digitalWrite(..., 0).

Below the beginning of the analogWrite function in wiring_analog.c
Code: [Select]
void analogWrite(uint8_t pin, int val)
{
  pinMode(pin, OUTPUT);
  if (val == 0)
  {
    digitalWrite(pin, LOW);
  }
  else if (val == 255)
  {
    digitalWrite(pin, HIGH);
  }
  ...
  ...
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Payam_sbr

analogWrite(..., 0) actually produces a digitalWrite(..., 0).

Below the beginning of the analogWrite function in wiring_analog.c
Code: [Select]
void analogWrite(uint8_t pin, int val)
{
  pinMode(pin, OUTPUT);
  if (val == 0)
  {
    digitalWrite(pin, LOW);
  }
  else if (val == 255)
  {
    digitalWrite(pin, HIGH);
  }
  ...
  ...

Well... is there any way to fully stop this signals instead of the "LOW"?

IF NOT : Is there any good practice to filtering this LOW noises?

ELSE : can sone one please tell me how many current maybe wasted or tell me the risk of damages when buzzer do noises for a long time (years) of work

Payam_sbr

Shall i use capacitor on IO pin to reduce small noises?

If yes, please tell me how.
Tnx

larryd

If you add a capacitor to an 'output' pin, you may damage the pin as the capacitor is initially a short.


.
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

Payam_sbr

its not the best solution but as no one did not offer any solution i have to solve this by self.

the problem mentioned in this thread was not ignore able because buzzer module was working anyway (without load sound) and takes valuable heat even with analogWrite(..., 0).

i solved this by using a transistor as switch to turning off the Buzzer when it is not used and simply connect its base to a digital PIN and before using buzzer via PIN3, i just activate it by digitalWrite(7, HIGH) and then after playing buzz normally, i deactivate it again with digitalWrite(7, LOW).


eatcircuits

Hi,

I faced this buzzer hissing sound even after a call to noTone(pin);
The module was getting hot.

I figured out the buzzer module control pin is active low.

the inbuilt noTone() code is:

Code: [Select]
void noTone(uint8_t _pin)
{
 int8_t _timer = -1;
 
 for (int i = 0; i < AVAILABLE_TONE_PINS; i++) {
   if (tone_pins[i] == _pin) {
     _timer = pgm_read_byte(tone_pin_to_timer_PGM + i);
     tone_pins[i] = 255;
   }
 }
 
 disableTimer(_timer);

 digitalWrite(_pin, 0);
}

According to this code the buzzer control is made low, which is active in this buzzer module.

The solution would be to call digitalWrite(pin, HIGH);

This stopped the hissing sound and no heating of the buzzer module.

Go Up