Siren from an AC horn speaker via Arduino

Hi, I need some guidance here if anyone can help please.

I'm wanting to add a siren to an Arduino project I'm working on for an out door sport. I'd like to have various tones.

Today it was suggested to me from an electronic store to use an AC horn speaker. I'm looking at doing this using an 8ohm 15W AC driven horn speaker, with a 5V 3A micro relay and adjusting the "loudness" with a 50 ohm 3W pot.

Sorry for no wiring diagram yet, but digital pin 3 to coil, and other coil end to arduino gnd. 12V AC to one speaker wire. Other speaker wire to 50 ohm pot. Then 50 ohm pot to relay common and finally NC of relay to other 12V wire.

What I don't understand is the "principle" of the programming. I've tested it with analogWrite but can only get buzzing. I think I should be using digital write with delays(?). Can someone please direct me to an appropriate starting point I can study or experiment with. Thanks in advance.

cjcj:
What I don't understand is the "principle" of the programming.

I understand "horn speaker" in your posting.

But I'm missing some words about components like "power amplifier" and "MP player module".

You can not connect that horn speaker directly to an Arduino, or any other controller for that matter. You need a circuit in between to boost the current from the Arduino to drive the speaker. These are normally called audio amplifiers.

Then you could drive it using the 'tone' function.

Grumpy_Mike:
You can not connect that horn speaker directly to an Arduino, or any other controller for that matter. You need a circuit in between to boost the current from the Arduino to drive the speaker. These are normally called audio amplifiers.

Then you could drive it using the 'tone' function.

Thanks Jurs and Mike for your replies.

Yes, this is where I'm getting confused. I tried to run the "toneMelody" from a digital pin to the relay coil. I then could hear the "tone" the relay buzzing away. Then I thought I would connect a separate 12V AC supply to the common of the coil and connect the output from the relay directly to the siren to hear the same sound but loader. It sounded really bad.

I'm showing my ignorance here not understanding how sound comes out of a siren. From what I was told by the rep in the store, it was simply running a digital output (frequency) from the arduino to the relay and using an AC supply to drive the horn.

I tried to run the "toneMelody" from a digital pin to the relay coil.

Please don't, it is a good way to destroy your Arduino. Anything over 40mA results in damage and there are few relays you can drive directly. Even if you could drive it directly a relay could not move fast enough to generate audio.

From what I was told by the rep in the store, it was simply running a digital output (frequency) from the arduino to the relay and using an AC supply to drive the horn.

I think you misunderstood him.

I think the relay is to turn the sound on and off. The sound is generated by the AC frequency and as such can not easily be changed.

However it looks like this could just be a power speaker so try driving it from an audio amplifier.

Grumpy_Mike:
Please don't, it is a good way to destroy your Arduino. Anything over 40mA results in damage and there are few relays you can drive directly. Even if you could drive it directly a relay could not move fast enough to generate audio.

Thanks Mike. Yes I was worried about the 40mA. The relay however is a mini relay - 5V. He was quite adamant that it could be used to drive the AC to the speaker.

Grumpy_Mike:
I think the relay is to turn the sound on and off.

I thought he said the "tone" was attained by the relay switching on/off at a high set frequency and the "volume" was adjusted with the 3W 50 ohm pot.

Maybe better to cut my losses at this stage. What do you think would be the simplest and cheapest way to generate an "end of game" siren via my arduino (a piezo is to "high" and "squeeky")?

thought he said the "tone" was attained by the relay switching on/off at a high set frequency

No, a relay has to move mechanically and you will find that you can't make it move fast enough. Also trying to switch AC, which I assume is 50 or 60Hz, will produce a horrible mess as the two frequencies beat and move in and out of phase.

Try and plug it into a you iPod or something else generating audio and see if you can here it through this.

cjcj:
Maybe better to cut my losses at this stage. What do you think would be the simplest and cheapest way to generate an "end of game" siren via my arduino (a piezo is to "high" and "squeeky")?

The simple answer:

For driving a "15W speaker" you'll need a "15W audio amplifier" or "15W PA amplifier".

And if you want to drive anything else than a "square wave frequency" as a sound, you'll need also a "WAV player" or "MP3 player" module as well.

For driving a “15W speaker” you’ll need a “15W audio amplifier”

No that is only for driving it to it’s full capacity. You can drive it at much less.

Grumpy_Mike:
No, a relay has to move mechanically... trying to switch AC, which I assume is 50 or 60Hz, will produce a horrible mess

Yes that's what I thought. He did however say something about having it osilate at least 500 times per second.

Jurs - the audio or amp does seem to make sense. This is why I'm now considering what is an easier/quicker/cheaper solution. Any suggestion would be appreciated.

cjcj:
Jurs - the audio or amp does seem to make sense. This is why I'm now considering what is an easier/quicker/cheaper solution. Any suggestion would be appreciated.

If you have a few resistors and a NPN transistor, you could also create a low-power amplifier circuit on a breadboard:

(But this circuit will not be able to provide maximum volume with your 15W speaker.)

Something like that?

jurs:
If you have a few resistors and a NPN transistor, you could also create a low-power amplifier circuit on a breadboard

What a great clear simple diagram - thanks. Yes I do have the components to build this, however I do need it to be loud enough to be heard across the sports ground.

I did buy the relay and pot, but didn't buy the 15W horn speaker yet - I've been testing things with another horn I got from a house alarm. I'm now really considering whether I buy something like a car alarm siren that runs on DC - "LINK". Would this be simpler to turn on / off or even adjust in tone?

There are two types of audio transducer, one that you provide power to and it makes a noise. The other where you have to provide a waveform to and it "plays" that waveform. This is not always made clear in the advertising material.

For example the top hit on that page says:-

Connects to a 12VDC power source and select a...

and I can't find what appears after the ... anywhere.

cjcj:
I'm now really considering whether I buy something like a car alarm siren that runs on DC - "LINK". Would this be simpler to turn on / off or even adjust in tone?

You can purchase a mortorcycle horn or car horn and power it from a car battery or 12V DC and switch on with a relay.

But it can play just one single tone: sound ON or OFF.

Yes the descriptions are a bit thin. Further down the page, the advert does say: "...connects to a 12VDC power source and select a tone with the controller". So the controller obviously generates the waveform. I might drop in this morning and check out all their horns.

Jurs - a car horn sounds like a great idea. I could just pulse some sort of "pattern".

jurs:
For driving a "15W speaker" you'll need a "15W audio amplifier" or "15W PA amplifier"

I rang back the sales person. I see how sound works now (sorry for my ignorance). His suggestion of a horn speaker, pot, relay and 12VAC can only produce a 50 to 60 Hz tone as that's the waveform of AC current supply - hence a dull hum only. That's useless!!!

I tried connecting the 12VAC directly to the speaker via a 20ohm resistor and I can see the flexing of the cone back and forth at 50Hz. I then connected 12VDC - single movement of the cone in one direction - depending which way I connected pos/neg. Now I see how sound works in a speaker.

So now I understand the need to create a waveform with a higher frequency to get a "note" and then amplify it. I'll do some reading up on audio amps (as well as your circuit) and hopefully can work it out. Cheers and happy new year Jurs (and Mike).

Look up the tone function and use the amplifier circuit given earlier.

Grumpy_Mike:
Look up the tone function and use the amplifier circuit given earlier.

Yes, I was already on it. I used the horn I had a home (from an ex. alarm siren), created the tone, and fed it into the breadboard circuit into the "out" indicated on the diagram above. It does work and sounds a bit louder.

What I've noticed however is the current reading between the Arduino 5V supply to the 10 ohm resistor (leading to the speaker) is around 80mA. Is this OK? Also, the amp reading of the "OUT" as per diagram and the 2.2K ohm resistor is do low it's almost unreadable. Is this correct?

By the way, the speaker I'm using measures 10 ohms across the 2 wires. Is this normal? Does the resistors have to be adjusted to compensate? Also, can I use an external 12VDC supply instead of the 5V from the Arduino? If so, how do I calculate the change in resistors that I need?

No that reading is not OK.
Sorry but it sounds like you don’t know how to measure current. You put the meter in seriese with what you want to measure unlike measuring voltage where you put the meter across the points you want to measure.

What you are doing by putting a current meter across the output and ground is to short out the output and that will give you 80mA. Anything over 40mA will damage the Arduino and you must ensure that the current is less than this. So a seriese resistor of 120R is the smallest to use with direct connection to a pin.

You can use an external 12V but you can not connect it direct to the Arduino, you need a transistor or some other form of amplifier.

Yes, I thought the 80mA was too high so I stopped immediately. As far a measuring current, I did disconnect the 5V supply to the 10R resistor then measure between them (as per diagram below).

jurs:

In the above I’ve made the following changes:

  • Replaced the 10R resistor between 5V arduino supply and speaker +ve with a 82R resistor
  • Disconnected the Arduino 5V from this new resistor
  • Connected +ve from an external 12VDC supply to the new 82R resistor
  • Connected -ve from the external supply to Arduino gnd
  • Inserted a 68R resistor between the speaker -ve and collector of the NPN

Note, in my code I made pin 13 the output pin. It generates the wave (tone) for the speaker via “tone(13,400);”. I measured the voltage from this pin to gnd and it is 2.5V. But current reading is still not readable. I assume given it’s a “tone”, is must be really small (less than 1mA). Correct?

I assume now given I only have gnd and pin 13 connected to the amp circuit and this is driven by an external power supply, I should be safe (see below). Not sure if my resistors are correct.
Sound.jpg