Maker Pro
Maker Pro

The input given to Piezo Speaker is an analogue signal or Digital signal?

Status
Not open for further replies.

jayfoonglw

May 22, 2014
7
Joined
May 22, 2014
Messages
7
Hello, I want to ask the input given to this Piezo speaker is an analogue signal or digital signal? This is because I am using digital output pin of Arduino Uno board to connect this speaker, is that okay?

Besides, if this speaker require an input analogue signal, then should I use Digital to Analogue Converter where convert the digital output pin of Arduino into analogue signal first and then feed to speaker?

The diagram of the connection between Arduino and speaker is shown in this attachment.Circuit Diagram for Hardware.PNG

Thanks for helping.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
What type of "speaker" is it? Is it a simple piezo "bender" like this one?

piezo bender.jpg
These devices are not really speakers, in that they're not designed to reproduce sounds accurately. They're designed to reproduce beeps, really.

Also, what kind of sounds are you generating with the Arduino? Just beeps?

If you answered yes and yes, then there is no need for any analogue signals. You can use a single digital I/O pin on the Arduino to generate a binary control signal for the piezo bender.

You don't need an LM386 to drive the piezo either. The LM386 is an audio amplifier that's designed to amplify analogue signals. It will work, and it will do a reasonable job and produce a reasonable amount of sound. If you want more volume, a different type of audio amplifer called a BTL ("bridge-tied load") amplifier can generate twice as much voltage across the piezo bender, and may be louder. You can also drive the piezo bender from a digital BTL output circuit that doesn't use an IC, although this may take up more PCB room than the other options.

You may also find that changing the acoustic characteristics of the piezo bender's mounting arrangement will increase the volume and modify the tone of the sound.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Presumably the output of the Arduino is simply a square wave, i.e. high half the time, low half the time. This is an analog signal in the sense that it is outputting a waveform, not digitally encoded information.

If it were outputting digitally encoded information, such as serial data that represented different analog levels, you would need a serial DAC to re-interpret it to an analog signal. But I seriously doubt that that is what it is doing. If it is, what you would hear on the speaker would sound like noise.

I agree with Kris the LM386 is not doing much for you other than lowering the output impedance, but piezo spekers are high impedance to being with. Also the configuration you have has a gain of 200 when it should be 1 since it cannot output a higher voltage than the micro is putting out because they both have the same power supply voltage. Basically, the LM386 is clipping a square wave, which give you (surprise) a square wave.

Bob
 

jayfoonglw

May 22, 2014
7
Joined
May 22, 2014
Messages
7
Dear Kris,

The front & back view of this speaker is shown in below.
This speaker will generate certain frequency sound (not the beep sound) when I feeding in certain frequency to Arduino Board from Simulink block (Matlab).

Since the speaker is not generating beep sound, then am I correct if I using digital output pin connect to LM386 first and then LM386 connect to speaker so that the speaker able to generate the amplified sound based on signal of digital output pin?

Thanks for helping.
20150218_182141.jpg 20150218_182250.jpg
 

jayfoonglw

May 22, 2014
7
Joined
May 22, 2014
Messages
7
Dear Bob,

The sound produced by the speaker is a proper sound without noisy.

Ya, I am using Amplification with 200 gain for the speaker. Besides as you said, I am getting clipped off amplitude for the output (speaker) although I feeding different amplitude of signal to the speaker in Simulink.

So, can you suggest me how to overcome this problem?

Thanks for helping.

Regards,
Jay

The following pictures are the oscilloscope results for 1 kHz and 100 Hz respectively with the scale of Volt/Div : 5V1kHz.jpg
100Hz.jpg
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
The front & back view of this speaker is shown in below.
OK. That is a standard mini loudspeaker, not a piezo.
This speaker will generate certain frequency sound (not the beep sound) when I feeding in certain frequency to Arduino Board from Simulink block (Matlab).
What do you mean, a "certain frequency sound (not the beep sound)"? If you feed it a signal at a fixed frequency, that will sound like a beep.
Since the speaker is not generating beep sound, then am I correct if I using digital output pin connect to LM386 first and then LM386 connect to speaker so that the speaker able to generate the amplified sound based on signal of digital output pin?
That type of speaker has a low impedance (8Ω) and must be driven from a low-impedance source, otherwise it will be barely audible. The LM386 does provide the low-impedance source for it, and it is an acceptable way to drive it, but (a) there are other ways of driving it that will produce more volume, if you need it, and (b) the LM386 is designed to reproduce an audio signal that includes subtleties, such as voice, music, etc, not just a simple rectangular wave signal at one frequency. It can reproduce that type of signal though.

I assume, from the oscilloscope waveforms, that your power supply is 5V. If so, your design in post #1 is probably OK and doesn't need any changes. It doesn't matter that the LM386 is operating at a gain of 200, although that's not necessary, and you can remove C2 to simplify the circuit.

With such a large input signal, its output will just swing hard to its maximum and minimum voltage, as long as the input bias is right. Check that the signal at the output of the LM386 swings over a DC voltage range of at least 3V. For example, the low output voltage is below +1V and the high output voltage is above +4V. If so, your circuit is OK.
 

jayfoonglw

May 22, 2014
7
Joined
May 22, 2014
Messages
7
Dear Kris,

For example, when I feed 100 Hz frequency sound to Arduino Board from Simulink block, then the speaker will generate low frequency sound. Similarly, when I feed 1kHz frequency sound, then speaker will generate high frequency sound.

Thanks

Regards,
Jay
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Yes, that's right. When the signal from the Ardino goes high, the speaker cone moves one way - let's say it moves outwards, towards the listener. When the signal from the Arduino goes low, the speaker cone moves the other way - away from the listener. If this happens regularly, each change on the signal from low to high and back is one "cycle" of the sound, and the number of cycles in one second (historically called cps - cycles per second) is the frequency of the signal, measured in Hz (hertz). A single regular frequency sounds like a continuous tone or beep. A higher frequency sounds like a higher pitch, and vice versa. Musically, if signal B is twice the frequency of signal A, then it sounds one octave higher. Two frequencies related by a factor of 2[exp]1/12[/exp] sound one semitone (one half-step) apart on the equally tempered scale. Two frequencies related by a factor of 1.5 (or 3:2) sound a perfect fifth apart. Blah blah blah!
 

jayfoonglw

May 22, 2014
7
Joined
May 22, 2014
Messages
7
Dear Kris,

Ya, you correct. When I feed a sine wave signal with frequency of 100Hz to the speaker, the speaker will generate a single tone only continuously rather than ON and OFF state accordingly.

Since the sine wave is an analogue signal with positive and negative amplitude, then the speaker should generate the sound with ON and OFF state accordingly not like continuous without stop.

Thanks for helping.

Regards,
Jay
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Since the sine wave is an analogue signal with positive and negative amplitude, then the speaker should generate the sound with ON and OFF state accordingly not like continuous without stop.
No, it should sound continuous, unless you are turning the 100Hz sine wave on and off at some lower frequency. What do you expect it sound like?

Bob
 

jayfoonglw

May 22, 2014
7
Joined
May 22, 2014
Messages
7
Dear Bob,

My expectation is since the speaker can generate the sound at positive amplitude of sine wave only (not negative amplitude), then the speaker should produce the sound at the period of positive amplitude whereas no sound will be generated at period of negative amplitude.

Thanks.

Best Regards,
Jay
 

davenn

Moderator
Sep 5, 2009
14,263
Joined
Sep 5, 2009
Messages
14,263
Dear Bob,
My expectation is since the speaker can generate the sound at positive amplitude of sine wave only (not negative amplitude), then the speaker should produce the sound at the period of positive amplitude whereas no sound will be generated at period of negative amplitude.
Thanks.
Best Regards,
Jay

no that is incorrect .... read Kris's post #8 again


Dave
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
And even if you expectation was true, it would still sound continuous. You have to get down to about 10Hz before we hear distinct clicks as opposed to a continuous sound.

Bob
 
Status
Not open for further replies.
Top