DVDdoug:
Is the buzzer ground connected to the Arduino ground?
Thank you for response.
yes sir.
DVDdoug:
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).
DVDdoug:
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.
DVDdoug:
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.
DVDdoug:
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.
DVDdoug:
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
buzzer_noise.zip (26.3 KB)