# How to calculate PWM duty cycle to compensate for different piezo sounder response at different frequencies?

How to calculate PWM duty cycle to compensate for different piezo sounder response at different frequencies?

I have a piezo sounder, and the datasheet informs me that I will get the following response:

Frequency Response 200Hz 74dB 1000Hz 81dB

If I set my PWM duty cycle to 100% at 200Hz to get 74dB, how do I calculate the PWM duty cycle required to give the same response of 74dB at 1000Hz?

Thanks kindly for any help.

• Uh. If you set your PWM to either 0% or 100% at 200 Hz you get 0 Hz. Have you used PWM before? Do you understand what a piezo does and how it works? (allaboutcircuits.com/technical-articles/… ) Do you know what a natural resonance frequency (or frequencies) is or what it might mean to operate something away from that frequency? You have some reading to do.
– jonk
Commented Jul 26, 2017 at 23:52
• It's an inverting output. So 100% duty cycle is not DC. Commented Jul 27, 2017 at 0:08
• Yes, I've used PWM before. It works fine on my current project. Just looking to add a few refinements. Commented Jul 27, 2017 at 0:10
• Measure it with a SPL meter, and adjust accordingly. Seriously, there are going to be a ton of variables which influence a calculated answer. Commented Jul 27, 2017 at 1:19
• @Tantalum: Jonk is correct. 0% PWM will result in 0 V continuous. 100% PWM will result in continuous V+ with no 0 V pulses. That is DC. If it is inverting then 100% will give you 0 V. That can be considered DC with a value of 0 A. Commented Apr 29, 2018 at 16:59