Arduino Forum

Using Arduino => General Electronics => Topic started by: Danielvt on Jun 07, 2018, 09:16 pm

Title: Driving a piezo loudly!
Post by: Danielvt on Jun 07, 2018, 09:16 pm
Hi all!

I'm rather new to electronics, and i'm working on building an alarm. However i can't seem to figure out how to push my piezo to be louder. Currently i've hacked one of these 'cheap' personal alarms that can be bought at the hardware store and pulled out the piezo. Before doing so i measured 40v across the piezo from a mere 4.5 volts battery. I have many failed tries on trying different circuits to boost the power, using all sorts of different methods. Where i'm currently at i use an inductor and transistor like so:

(http://www.talkingelectronics.com/projects/PIC_LAB-1/images/PiezoAsInputOutput.gif)

wired up using:



Setup as shown on attachment.

The inductor and piezo is in the 5v output of the arduino.

When i measure across the piezo i get around 3.3v

Any idea what i'm doing wrong? How do i increase the volume/voltage across the piezo?

Thanks a lot in advance!

/ Daniel

Title: Re: Driving a piezo loudly!
Post by: MarkT on Jun 07, 2018, 09:18 pm
Well the 10mH choke has a much better chance of resonating in the audio band than a tiny 100uH...
Using component values a hundred-fold out isn't normally successful.
Title: Re: Driving a piezo loudly!
Post by: Danielvt on Jun 07, 2018, 09:24 pm
Well the 10mH choke has a much better chance of resonating in the audio band than a tiny 100uH...
Using component values a hundred-fold out isn't normally successful.
Thanks for the reply Mark!

(Correct me if i'm wrong) As i understand it, the resonance of the inductor is what can produce a higher voltage, right? - So the aim for me to increase the sound-pressure of the piezo would be to find an inductor that resonates at the exact same frequency as i would like the piezo to? (for instance 4kHz) so when i use
tone(3,4000,1500) in my arduino-code i'm not resonating the inductor at the correct frequency? That makes sense, and i've bumped into this before. However i don't understand how on earth i'm to find the correct frequency for the inductor to increase the voltage?

Can you point me in a direction?

Best regards
/ Daniel
Title: Re: Driving a piezo loudly!
Post by: MarkT on Jun 07, 2018, 09:56 pm
The piezo and the inductor form a resonant LC tank circuit.  Hit the resonant frequency and the voltages will
be much higher than the supply.

Piezo elements are basically flexible ceramic capacitors.
Title: Re: Driving a piezo loudly!
Post by: jremington on Jun 07, 2018, 10:38 pm
Quote
However i don't understand how on earth i'm to find the correct frequency for the inductor to increase the voltage?
1. Look up or measure the capacitance C of the piezo element.

2. Calculate the parallel LC resonant frequency in Hz using f = 1/(2*PI*sqrt(L*C)).
Title: Re: Driving a piezo loudly!
Post by: allanhurst on Jun 08, 2018, 12:53 am
The piezo will have a self-resonant frequency in it's housing at which it will be most efficient.

Hence most drivers use this as the tuned element of of a high voltage output oscillator....

I did this years ago for a burglar alarm  and got ear-piercing results at 3-4kHz

Special magnetics are required. eg TOKO make them. An auto-transformer wound on a ferrite core.

See if I can dig out a circuit.

The housing will be important for best output - look at a commercial unit. It has to be tuned as well.

A piezo disc is NOT a wideband device !

Allan

Title: Re: Driving a piezo loudly!
Post by: Danielvt on Jun 08, 2018, 09:52 am
1. Look up or measure the capacitance C of the piezo element.

2. Calculate the parallel LC resonant frequency in Hz using f = 1/(2*PI*sqrt(L*C)).
Thanks a lot!

I measured the capacitance to 12.27nF and then found a inductor on 154mH to match, so that i would get around 3.6569 kHz which is where the piezo is hearable.

However when measuring the AC voltage i only get half of what's inputtet through the waveform generator, any guess what's wrong?
Title: Re: Driving a piezo loudly!
Post by: MarkT on Jun 08, 2018, 12:17 pm
What is the Q of the inductor?  Power inductors are not normally suitable for RF applications like this.
Title: Re: Driving a piezo loudly!
Post by: Danielvt on Jun 08, 2018, 12:39 pm
What is the Q of the inductor?  Power inductors are not normally suitable for RF applications like this.
I'm not sure - i guess after seeing wiki, that you're asking about the quality-factor? I'm currently at university where we have a component-shop where i found the inductor. However atm. i've managed to actually find a frequency where i can bump the voltage up to around 10ACv from 2 outputs in the arduino, using the ToneAC library. This is done using two of the above mentioned inductors and some time finding a frequency with a waveform generator.

When you talk about power inductors, i'm not quite sure what the difference between different inductors are (and their usage), could you elaborate? :)

Thanks again for your help! :-)
Title: Re: Driving a piezo loudly!
Post by: MarkT on Jun 08, 2018, 12:46 pm
Its a very big subject area, inductors are far more complicated than any other passive component type,
there are literally thousands of different magnetic materials used, none is even remotely ideal except
for air-cored, and then you have resistance losses and stray capacitance to worry about.

It may be the case that the Q of the piezo element is too low for resonance even...

Another way to get higher drive voltages is using a step-up transformer.

You mentioned the cheap alarm the piezo came from - why not reverse-engineer the driver circuit
in that?
Title: Re: Driving a piezo loudly!
Post by: allanhurst on Jun 08, 2018, 12:49 pm
I wouldn't call a few kHz RF....

And modern swmode psu's often run at 100's of kHz so their inductors should be fine.... though 154mH is a bit high for that. They're normally 10's to a couple of hundred uH.

What's it's core made of, OP?

Allan
Title: Re: Driving a piezo loudly!
Post by: Paul_KD7HB on Jun 08, 2018, 06:41 pm
A much easier solution is to use a self-excited piezo. Just apply 5 volts to get the sound. There are many different sound levels available. Pick one to suit your situation. I put one on an oven controller that is so loud I had to use it inside the enclosure. It was laying around the shop left over from some customer's project.

Paul
Title: Re: Driving a piezo loudly!
Post by: DVDdoug on Jun 08, 2018, 08:57 pm
Quote
...The inductor and piezo is in the 5v output of the arduino.

When i measure across the piezo i get around 3.3v

...However when measuring the AC voltage i only get half of what's inputtet through the waveform generator, any guess what's wrong?
How do you know what's coming-out of the waveform generator?

DMMs are calibrated to measure the RMS voltage (https://en.wikipedia.org/wiki/Root_mean_square) of a sine wave.   If you don't have a sine wave it won't be correct.*

A 0 - 5V square wave has a peak of 5V (and 5V peak-to-peak).  The average is 2.5V and the RMS is also 2.5V.   

The RMS of a sine wave is 0.707 times the peak and the average** is 0.637 x peak.   Since the meter assumes a sine wave, some meters will simply filter the rectified & filtered voltage to get the (rectified) average, and then multiply by (0.707/0.637) to get RMS.   

Or, it might read the peak and multiply by 0.707.  It looks like that's what your meter is doing...It's just the wrong formula for a square wave.


* There are "True RMS" meters.   I have one at work.   

** That's the average of the rectified voltage or the average of the absolute values.   The true  average is zero, since a sine wave is positive half time and negative half the time.
Title: Re: Driving a piezo loudly!
Post by: allanhurst on Jun 08, 2018, 10:12 pm
The reading is only true if you use a true RMS voltmeter - eg a Fluke 87 - a cheapo voltmeter measures the average and displays it as if it were RMS.

This is only accurate for a sinewave. Not for any other waveform.

Allan
Title: Re: Driving a piezo loudly!
Post by: ted on Jun 09, 2018, 03:56 am

you need autotransformer

https://www.electroschematics.com/wp-content/uploads/2008/12/siren-driver-schematic.jpg
Title: Re: Driving a piezo loudly!
Post by: Danielvt on Jun 11, 2018, 01:31 pm
So the whole problem revolves around the fact, that i need to drive the piezo to the highest possible DB-level from a 3v battery. I've designed and 3D-printed a resonance chamber which seems to work okay. My biggest succes has come from driving around 4.6kHz from the output arduino pin to a transistor and from there to a parallel setup with a 4.7kH inductor and the piezo. The piezo is measured as 18.5nF which by my calculations should result in a ressonance frequency around 17068Hz. However this is far from where i get my highest voltage when measuring vAC. Around 4.6kHz is where i get the highest voltage (around 6.2vAC). Any suggestions on how to increase the voltage across the piezo? My current setup just doesn't seem to cut it. It needs to be louder :( (it's for an alarm)

Thanks again for inputs!
Title: Re: Driving a piezo loudly!
Post by: Paul_KD7HB on Jun 11, 2018, 03:43 pm
So the whole problem revolves around the fact, that i need to drive the piezo to the highest possible DB-level from a 3v battery. I've designed and 3D-printed a resonance chamber which seems to work okay. My biggest succes has come from driving around 4.6kHz from the output arduino pin to a transistor and from there to a parallel setup with a 4.7kH inductor and the piezo. The piezo is measured as 18.5nF which by my calculations should result in a ressonance frequency around 17068Hz. However this is far from where i get my highest voltage when measuring vAC. Around 4.6kHz is where i get the highest voltage (around 6.2vAC). Any suggestions on how to increase the voltage across the piezo? My current setup just doesn't seem to cut it. It needs to be louder :( (it's for an alarm)

Thanks again for inputs!
Look for a PULSE TRANSFORMER with winding ratios that will give the voltage you want. Use to be almost free from surplus establishments. Now probably hard to find used.

Paul
Title: Re: Driving a piezo loudly!
Post by: allanhurst on Jun 11, 2018, 03:47 pm
Presumably you don't mean 4.7kH ( 4700H)

What value is it?

Allan
Title: Re: Driving a piezo loudly!
Post by: allanhurst on Jun 11, 2018, 03:55 pm
Putting about 80mH in series with the piezo would give a reasonable current through it at 4kHz - see enclosed.

The voltage depends on the internal resistance of the piezo.

Allan
Title: Re: Driving a piezo loudly!
Post by: Danielvt on Jun 11, 2018, 04:47 pm
Presumably you don't mean 4.7kH ( 4700H)

What value is it?

Allan
Sorry, i mean 4.7mH ofcourse!

Putting about 80mH in series with the piezo would give a reasonable current through it at 4kHz - see enclosed.

The voltage depends on the internal resistance of the piezo.

Allan
I don't have a 80mH inductor unfortuanently. Only have 56mH  :-(  But why would you put it in series? According to what i've found

(http://blog.mbedded.ninja/wp-content/gallery/electronics-misc/dynamic/piezo-drive-circuit-parallel-inductor.jpg-nggid03549-ngg0dyn-500x500x100-00f0w010c010r110f110r010t010.jpg)

they should be in parallel? :-)

For some weird reason my calculations of ressonance frequency don't seem to match the reality of what i'm measuring :-(



Title: Re: Driving a piezo loudly!
Post by: allanhurst on Jun 11, 2018, 05:03 pm
You've drawn a parallel resonant circuit which presents a low impedance except at resonance - and only allows twice the supply volts across the piezo.

A series resonant circuit becomes low impedance at resonance, and forces a lot of current to flow through the piezo. It  has no such limitation .

If you used my circuit with a 56mH and added a 2.2nF across the piezo you'd also acheive resonance, and it ought to work at about 4.6 kHz

Note you can't use a single transistor driver here - try an arduino  output to start with and tweak the extra C for best output.

Allan
Title: Re: Driving a piezo loudly!
Post by: Danielvt on Jun 11, 2018, 09:48 pm
You've drawn a parallel resonant circuit which presents a low impedance except at resonance - and only allows twice the supply volts across the piezo.

A series resonant circuit becomes low mpedance at resonance, and forces a lot of current to flow through the piezo. It  has no such limitation .

If you used my circuit with a 56mH and added a 2.2nF across the piezo you'd also acheive resonance, and it ought to work at about 4.6 kHz

Note you can't use a single transistor driver here - try an arduino  output to start with and tweak the extra C for best output.

Allan

Awesome, i'll give it a try, when i get back to the measuring equipment at Uni tomorrow! However i'm not quite sure what you meant about driving the transistor through the Arduino? Currently i'm using a wave-generator with square-wave output at around 4.6kHz with 1.5v amplitude, 50% duty ratio. I've attached the setup here.
I get (with the 15nF dummy acting as the piezo) around 6.2vAC from a 3.3vDC source. and a 4.7mH inductor which is the highest i've managed to get so far.

Thanks again so much for your help! I really appreciate it!

Title: Re: Driving a piezo loudly!
Post by: allanhurst on Jun 11, 2018, 11:42 pm
Try it my way with a signal generator. And do some sums .

And download and learn to use simulation programmes such as 'PSPICE' or 'LTSPICE'.

You'll find them very useful.



Allan

edit :  you may find the enclosed driver useful - put the inductor/piezo where I show the loudspeaker.
Title: Re: Driving a piezo loudly!
Post by: Danielvt on Jun 12, 2018, 10:02 am
Try it my way with a signal generator. And do some sums .

And download and learn to use simulation programmes such as 'PSPICE' or 'LTSPICE'.

You'll find them very useful.



Allan

edit :  you may find the enclosed driver useful - put the inductor/piezo where I show the loudspeaker.
Hi again Allan,

I've tried your setup and got the following (check attachment)

I didn't quite understand your resistor however. I tried both 1k ohm and 1 ohm. The 1ohm gave me the 1.5Vpp as the waveform generator is outputting.

It doesn't seem to work for me :/ Do you have any idea, what i'm doing wrong?

Again, thanks a lot for your time! :-)

/ Daniel
Title: Re: Driving a piezo loudly!
Post by: ted on Jun 12, 2018, 12:27 pm
For resonance google - 3 wire piezo buzzer
Title: Re: Driving a piezo loudly!
Post by: Danielvt on Jun 12, 2018, 06:15 pm
Try it my way with a signal generator. And do some sums .

And download and learn to use simulation programmes such as 'PSPICE' or 'LTSPICE'.

You'll find them very useful.



Allan

edit :  you may find the enclosed driver useful - put the inductor/piezo where I show the loudspeaker.
Ok good news! I got it working with the signal processor, and i finally understand the entire setup, and how the capacitor, inductor and waveform signal processor work together. Managed to get around 16-17vAC from the 3v power source - Amazing!! :D Works like a charm, however when i try to move from the waveform generator towards a transistordriven circuit i get into trouble. I've made the setup as shown on the attachments, however it seems like i only get power from the transistor-gate and nothing form the actual DC power source. How can this be?

By the way, thanks for the tip with simulation-software, it has saved me lots of hours! 
Title: Transistor to drive LC circuit not working
Post by: Danielvt on Jun 12, 2018, 06:34 pm
Hi all!

I'm trying to drive a LC/tank -circuit with an Arduino in order to increase the voltage across a piezo. This far i've managed to get the LC-circuit working perfectly with an increase from 3.3vAC to 16-17vAC when the 3.3vAC is supplied through a waveform generator. However since i need to run it from the Arduino i'm trying to get this to work with a transistor. I just can't seem to get it right. Whatever i try, it seems like the only source of power is the base-input of 1.5vAC from the simulated Arduino pin. And the 3.3v from the DC source doesn't affect the output at all - even tried changing it to 5v, 12v, and 60v in the simulations - no change in output.

What on earth am i doing wrong?

I've attached both setups in the 'Schematics.jph' file.

Thanks in advance for any inputs!

Best regards
 / Daniel
Title: Re: Transistor to drive LC circuit not working
Post by: Danielvt on Jun 12, 2018, 06:59 pm
Woops, ofcourse schematics is the other way around:
Title: Re: Transistor to drive LC circuit not working
Post by: pwillard on Jun 12, 2018, 07:02 pm
I really don't like simulators... but shouldn't it look a wee bit more like this?

(https://i.imgur.com/1dp751V.jpg)


Title: Re: Transistor to drive LC circuit not working
Post by: DVDdoug on Jun 12, 2018, 07:07 pm
Quote
And the 3.3v from the DC source doesn't affect the output at all
Where's the (simulated) meter connected?    Of course the important thing is the voltage across the piezo.

Is the capacitor supposed to be the Piezo or is it supposed to be the resistor?

Of course, if you can supply a higher DC voltage in the real world you wouldn't have to be playing-around with resonant circuits.  ;)

Title: Re: Driving a piezo loudly!
Post by: jremington on Jun 12, 2018, 07:19 pm
You will destroy the transistor (and may already have) if you fail to use a base resistor (1K - 10K).

To what peak-to-peak voltage have you set the signal generator?

Quote
however it seems like i only get power from the transistor-gate and nothing form the actual DC power source.
Please explain why you think this.
Title: Re: Transistor to drive LC circuit not working
Post by: pwillard on Jun 12, 2018, 07:23 pm
Note:  I'm indicating you have to drive the BASE of the transistor with a PWM signal.  No switching... no voltage...   Just feeding DC won't do anything.
Title: Re: Driving a piezo loudly!
Post by: allanhurst on Jun 12, 2018, 07:30 pm
Try my driver posted in #22 and read my comments..

You probably don't need the output capacitor - replace it with a short.

You won't get anything from your circuit as there's no way for the transistor to get power...

A capacitor ( such as a piezo) blocks dc current flow.

Allan
Title: Re: Driving a piezo loudly!
Post by: jremington on Jun 12, 2018, 07:52 pm
If you want to simulate a piezo element, you need to take into account its equivalent inductance, which can be surprisingly large, as well as the internal resistance. At the moment, you are just (incorrectly) simulating an LCR circuit.

Unfortunately decent SPICE/LTSPICE models for a piezo element are hard to find, but here is one attempt (https://www.edaboard.com/showthread.php?190513-How-to-create-impedance-model-in-Cadence-Spice).
Title: Re: Transistor to drive LC circuit not working
Post by: jremington on Jun 12, 2018, 07:55 pm
Please do not double post (http://forum.arduino.cc/index.php?topic=552022.msg3769809#msg3769809).
Title: Re: Transistor to drive LC circuit not working
Post by: Danielvt on Jun 12, 2018, 08:01 pm
Please do not double post (http://forum.arduino.cc/index.php?topic=552022.msg3769809#msg3769809).
I just thought the other thread went a bit off-topic in regards to the original post, which is why i made a new post :-)
Title: Re: Transistor to drive LC circuit not working
Post by: Danielvt on Jun 12, 2018, 08:10 pm
Where's the (simulated) meter connected?    Of course the important thing is the voltage across the piezo.

Is the capacitor supposed to be the Piezo or is it supposed to be the resistor?

Of course, if you can supply a higher DC voltage in the real world you wouldn't have to be playing-around with resonant circuits.  ;)


The voltage is measured at the capacitor - which is yes supposed to act as the piezo. I don't have the possibility of having a higher DC-voltage across the piezo since we're running on a 3v battery - which is why i'm using a LC-circuit :)
Title: Re: Driving a piezo loudly!
Post by: Coding Badly on Jun 12, 2018, 08:30 pm

Threads merged.

Title: Re: Driving a piezo loudly!
Post by: Danielvt on Jun 12, 2018, 08:47 pm
You will destroy the transistor (and may already have) if you fail to use a base resistor (1K - 10K).

To what peak-to-peak voltage have you set the signal generator?
Please explain why you think this.
I run the signal generator at 1.5V but if i change it, the output changes (and doesn't change if i change the DC input!) which is why i think the signal is providing the output.


jremington i have it working perfectly without the transistor, so my ressonant LC circuit is working fine :)

Note:  I'm indicating you have to drive the BASE of the transistor with a PWM signal.  No switching... no voltage...   Just feeding DC won't do anything.

I'm not really sure what you mean - how should i simulate it? Could you elaborate?

Thanks for all your responses! Appreciate it!

/ Daniel
Title: Re: Driving a piezo loudly!
Post by: Danielvt on Jun 12, 2018, 08:55 pm
Try my driver posted in #22 and read my comments..

You probably don't need the output capacitor - replace it with a short.

You won't get anything from your circuit as there's no way for the transistor to get power...

A capacitor ( such as a piezo) blocks dc current flow.

Allan
Hi Allan,

I tried the circuit with no luck (see attached schematics)

Title: Re: Driving a piezo loudly!
Post by: jremington on Jun 12, 2018, 09:52 pm
Quote
I tried the circuit with no luck
You tried a different circuit, which won't work for several reasons.

You could try the one in reply #22, carefully following the instructions to replace the speaker (8 Ohm R2) with the piezo, but it won't be any louder than the direct output from an Arduino, because there is no voltage boost.
Title: Re: Driving a piezo loudly!
Post by: allanhurst on Jun 13, 2018, 12:21 am
jremington - you're right of course.

1/ modelling a piezo as a series capacitor and resistor isn't very accurate , but it's a reasonable starting approximation. A better model will not be linear, but will vary strongly with excitation voltage.
Can't be bothered.

2/ my crude circuit does not, as you say, provide any voltage gain, but it will provide much more current, which may be useful driving a low impedance series resonant load.The series l-c provides the voltage gain at resonance.

Pwillard : your circuit is a basic boost voltage convertor  - but we don't want high voltage dc.

Danielvt. Your implementation of my circuit is inaccurate. Get it right and try again.

1 resistor, two transistors. Omit the 100uF capacitor. Could anything be much easier?

Allan
Title: Re: Driving a piezo loudly!
Post by: Wawa on Jun 13, 2018, 08:38 am
Didn't read all the posts in this thread, but isn't it easier to use a MAX232 to drive a piezo.
Like the do on an HC-SR4 ultrasonic sensor module.
The MAX232 should be able to drive a piezo to ~30volt peak/peak.
Leo..
Title: Re: Driving a piezo loudly!
Post by: Danielvt on Jun 13, 2018, 09:25 am
Didn't read all the posts in this thread, but isn't it easier to use a MAX232 to drive a piezo.
Like the do on an HC-SR4 ultrasonic sensor module.
The MAX232 should be able to drive a piezo to ~30volt peak/peak.
Leo..
Hi Leo!,  thanks! I can't find any resources on how to wire/set up the Max232 to a piezo, could you elaborate? I believe 30vPP from a 3.3v source sounds amazing though! :-)

/ Daniel
Title: Re: Driving a piezo loudly!
Post by: Wawa on Jun 13, 2018, 09:31 am
Google "HC-SR4 schematic diagram" (images).
The first diagram shows how to connect the MAX232.
Not sure about powering this chip with 3.3volt though.
Consult the datasheet.
Leo..
Title: Re: Driving a piezo loudly!
Post by: allanhurst on Jun 13, 2018, 12:34 pm
The MAX232 psu generates +/-7v with a 7k load, only +5/-4 v with a !k load. It requires a +5v supply.

If you just want to to the job with a high voltage supply a boost convertor would be OK - but you then also need a suitable circuit to drive the piezo.

The op has already achieved 17vac from a 3v5 signal using a series resonant circuit. Since the waveform will be sine-ish that implies 48v p-p.

Allan
Title: Re: Driving a piezo loudly!
Post by: ted on Jun 14, 2018, 12:45 am
we're running on a 3v battery - which is why i'm using a LC-circuit :)
This one is loud, 4.5V, for high voltage they are using autotransformer,
Title: Re: Driving a piezo loudly!
Post by: ted on Jun 14, 2018, 12:46 am
http://makercorner.blogspot.com/2017/06/diy-refrigerator-door-alarm.html (http://makercorner.blogspot.com/2017/06/diy-refrigerator-door-alarm.html)