Louder tone() with an IRL540


I'm building a device for my grandfather, in his nineties, which has a pretty bad hearing. It's a kind of custom alarm clock, to help him with some other health issues.

For part of this project, I need to generate a sound, for which the tone() function is perfect. Now I just want to make it louder.

So, I got a small speaker (Visaton K50 (art. 2901)) which is rated 8 ohms, with a rated power of 2W, and maximum power of 3W, an IRL540, and a 12V supply.

I found on this forum a schematic which is somewhat similar to what I want to achieve (https://forum.arduino.cc/index.php?topic=375310.0), but it needs some modfications to actually relate to my project.

So, I attached below a schematic with my changes, and I'm not sure of what I'm doing, specifically about the values for R1, R2 and R3.

I guess that I can keep 270R and 10K for R1 and R2 respectively. Correct?

But what about R3? I want to maximize the sound output, but also not damage the speaker. I guess that R3's role is to limit the current flowing through the speaker to avoid damaging it, which would make sense.

As P=R.I², transformed into I=sqr(P/R), it means I should limit the current to 0.5A to stay inline with the rated power of the speaker.

As R=U/I, and with U being 12V, it means that a 24R resistor should do the trick.

And it's power rating should be at least P=R.I²=24/4=6W.

Does it make sense to size things like that, or am I missing something? Is it how I can produce the loudest sound with this simple BOM?

Thanks for your input and advices!

I didn't carefully check your calculations but everything looks "about right". If you have a 5V power supply you might get-by without the resistor (or with a lower-value lower-power resistor).

You won't really know if it's loud enough until you experiment.

With a square wave there is no current/power half the time so your power is cut in half. If you write your own code instead of using the tone() function (which I assume you're doing) you can shorten the duty-cycle to reduce the power & loudness that way. That will change the harmonic structure of the sound but you can probably find a frequency & duty cycle that sounds OK, or that's minimally annoying. :wink:

On the other hand, a "2W" speaker is supposed to be safe with a 2W amplifier and regular voice/music hitting 2W on occasional peaks and an average maybe 1/10th of that. i.e. You can usually fry a 2W speaker with constant 2W test tones! But I suspect you CAN get loud enough with a tone around 1-2kHz without frying the speaker.

One problem with square waves and a non-linear amplifier is that you can't add a regular volume control pot. But like I said you can adjust the duty cycle in software so you could do it that way and you could stick a pot on an analog input that controls the duty cycle (if you want the ability to adjust the volume).

Or... You might try PWM to generate the "tone". That's an easy way to change duty-cycle if the frequency isn't too low (it might be too low to "sound loud"). Just don't go over 50% PWM (127). 50% is maximum loudness (a square wave) and above that you're wasting more power for less sound.

Piezo buzzers can be more efficient than speakers, although they only have one
resonant frequency they do well at. This is why they are almost universally used
in appliances for warning tones and alarms.

Thanks DVDOUG and MarkT.

Using a 5V power supply is not really an option, as I need to switch some 12V relays as well, which I'm doing through some BC548, and it works well.

You are right, I planned to use the tone() function, and having a potentiometer connected to an analog input to vary its pitch. I'm going for a speaker and not a piezo buzzer specifically because of this need to be able to adjust the pitch: the hearing loss is not something linear in the case of my Grandfather: he can't hear some frequencies at all, while some are still somewhat ok. So I need to be able to adjust this to test with him and see what he hears best. It might require adjustement later on, so having a potentiometer for easy tuning is a must. But actually not using tone() but some custom code for more flexibility is a good idea. Thanks for the hint!

Duly noted regarding the possibility to damage a 2W speaker with 2W of power. Actually this is not expected to be running for long period of times, but only for alerting him in specific circumstances. Well, I'll tests and see how it behaves...

So, as it doesn't look completely stupid, I will go forward and order the components I listed, and test to see how it performs...

Thanks again for the feedback!

I would place R2 on the Arduino side on pin D8, this will give you a little more drive on the MOSFET. There is a great discussion on this at: Max Voltage for Speaker of Given Power Rating - Electrical Engineering Stack Exchange. Lowering the value of R3 will increase the volume. Do not take your duty cycle above 50%, you would then be wasting power as heat.

I would place R2 on the Arduino side on pin D8, this will give you a little more drive on the MOSFET.

This is something I consider not worth worrying about. 270 ohm : 10k voltage divider reduces 5V to
4.87V, and logic level MOSFETs are usually 100% guaranteed to work at max current output with
only 4.50V gate drive across all devices and temperatures (in fact the IRL540 is characterized for 4.0V
gate drive anyway).


I finished the construction of my prototype yesterday, and I can confirm that the above schematic works fine, and makes things annoyingly loud (at least for a non hearing-impaired person :-)).

I didn't play yet with custom code in place of tone(), but will keep this in mind if further sound tweaking is required.

Thanks a lot to those who helped on this topic!


This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.