Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Arduino alert sound

Status
Not open for further replies.

jack0987

Member
I would like my arduino to sound an alert. To do this, I cobbled together the following:

pic1a - Copy.jpg


Code:
tone (8, 500, 500);

It is not very loud. (The resistor is 100 ohms.)
I also understand it is said this is not a good way to do it.

I then added a simple amp.

arduino-active-buzzer-circuit.png


It is a bit louder. If I lower R1 to 100 ohms it gets a little louder.

For starters, I would like to:
1. get a little louder still with a simple volume control
2. make the sound more pleasing to listen to. (maybe kind of a bell sound)

I have various transistors and some CA3080s. Maybe I could just buy an arduino amp for four or five bucks.

Please offer suggestions and comments.
 
The first circuit, with just a speaker and 100 ohm will be very low power, the second should be considerably louder, but you may have killed the transistor as it's not suitable for feeding a low impedance loudspeaker. Note that the ciruit shows a buzzer, not a loudspeaker.
 
The first circuit, with just a speaker and 100 ohm will be very low power, the second should be considerably louder, but you may have killed the transistor as it's not suitable for feeding a low impedance loudspeaker. Note that the ciruit shows a buzzer, not a loudspeaker.

LOL. You are right. I did not notice that. In what way way can I alter the circuit for the speaker?
 
What impedance is the speaker?, you should put a low value resistor in series with it to reduce the power to it and limit the current through the transistor.
 
What impedance is the speaker?, you should put a low value resistor in series with it to reduce the power to it and limit the current through the transistor.

The speaker is out of an old computer. I measure about 15 ohms for it if I did it right.
I thought most speakers were 8 ohms.

I elected to use a speaker for two reasons. First, because I do not have a buzzer and, second, I thought it may sound a little better.

I am looking on the internet to see if I might find a better amp circuit.

Also, I wonder if it may sound better if I converted the square wave the tone() function generates to a sine wave.
I will look for a circuit for that, too.
 
It will give a roughly sinusoidal signal, but at too small an amplitude, so would need an amplifier. Also 10kHz is arguably too high a frequency for an alert tone.
 
It will give a roughly sinusoidal signal, but at too small an amplitude, so would need an amplifier. Also 10kHz is arguably too high a frequency for an alert tone.

The alert tone will most likely be about 500. (I do not think we can hear 10K can we?)
Do you think the sine wave might be a bit more pleasing to listen to?

For an amp, I found this circuit:

LM386_AudioDue.jpg


I doubt I have an LM386.

Do you know of other possible circuit choices?
 
The alert tone will most likely be about 500. (I do not think we can hear 10K can we?)
Do you think the sine wave might be a bit more pleasing to listen to?

10K should be easily audible for most people, standard hearing when young is about 20Hz to 20KHz.

However, it's far too high for such a use, 500Hz to 1000Hz would be alot more suitable.

A sine wave is certainly 'nicer' than a square wave to listen to - but you would need a proper amplifier - you mentioned Arduino amplifiers, there are endless cheap examples of those you can buy.
 
A sine wave is certainly 'nicer' than a square wave to listen to - but you would need a proper amplifier - you mentioned Arduino amplifiers, there are endless cheap examples of those you can buy.

There is This Tutorial I found.
https://www.arduino.cc/en/Tutorial/SimpleAudioPlayer

It will play *.wav files but then I would have to add more parts or use an Arduino Due

Also, there is this amp as a possible. Perhaps I should just go with that and construct the square wave converter just for fun.
Amp-Amazon.jpg

https://www.amazon.com/5V-12V-Ampli...YQ/?tag=bingshoppinga-20&linkCode=df0&hvadid={creative}&hvpos={adposition}&hvnetw=o&hvrand={random}&hvpone=&hvptwo=&hvqmt=e&hvdev=c&hvdvcmdl={devicemodel}&hvlocint=&hvlocphy=&hvtargid=pla-4583657821275508&psc=1
 
Last edited:
Longer time ago in Elektor a Driver was built with an BS170 / BS250 pair as driver for the PWM signal.
The full PWM Voltage goes to this pair.
The "filter" is then the slew rate of loudspeaker.
For my last project ( MiDi Metronom ) I used a LM 386 too.
As filter I used a T filter with inductors and a capacitator at the LM386 input, because the signal goes to a High Power Amp.
And It's not a good Idea to put there 77KHz rectangular in.

As source File You can use any 8 Bit raw mono audio file.
With a tool ( xxd ) You can covert that direct into C-Code and use it.
Look here: https://github.com/baldram/ESP_VS1053_Library/issues/18

So You can play any alarm sound You want.
 
Longer time ago in Elektor a Driver was built with an BS170 / BS250 pair as driver for the PWM signal.
The full PWM Voltage goes to this pair.
The "filter" is then the slew rate of loudspeaker.
For my last project ( MiDi Metronom ) I used a LM 386 too.
As filter I used a T filter with inductors and a capacitator at the LM386 input, because the signal goes to a High Power Amp.
And It's not a good Idea to put there 77KHz rectangular in.

As source File You can use any 8 Bit raw mono audio file.
With a tool ( xxd ) You can covert that direct into C-Code and use it.
Look here: https://github.com/baldram/ESP_VS1053_Library/issues/18

So You can play any alarm sound You want.

Thank you. I got a cheap amp and am going to go with that for now. Your comment should help others reading this topic..
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top