Noob question: Powering an Arduino Mega and a 9V speaker with one battery?

Hey,

I am working on this project as a complete noob to Arduino and electricity in general, I was able to make an easy version of a timer already with 4 buttons, a LED, buzzer, etc.

Now I am planning to upgrade this timer to make a timebomb for airsoft games.
This project is going to need a speaker, which I have, it can take max 9V, which I need since it needs to be very loud. (reaching about 100m in a forest)

I was thinking about powering both the Arduino and the speaker with a 9.6V NiMH battery, which we have plenty of, since they are used in the airsoft replicas.

Now I am not exactly sure how I can do this, I have an optocoupler from the starter kit and I have a 5V regulator. Do I need both of these, or can I just power the Arduino with 9V instead of 5V?

Here's a sketch of how I was thinking about doing this, cause I'm terrible at explaining:

Would this work or how should I do it properly?

Thanks in advance.

You can power the Arduino from 9V (it has a built-in 5V voltage regulator).

You'll need more than an opto-isolator to drive a "regular" 4 or 8 Ohm speaker. At a minimum, you'll need a transistor or MOSFET driver and depending on what kind of sound you want you may need an audio shield and regular audio amplifier.

This project is going to need a speaker, which I have, it can take max 9V

Do you have a link to the specs? Speakers usually don't have a "voltage" rating. Usually they are rated by wattage & impedance.

What kind of sound do you need? The Arduino doesn't have a digital-to-analog converter.

An opto isolator is no use whatsoever for power.

You want power into this speaker and that means an audio amplifier (these days usually
class D) for an audio signal.

For a single tone you can just use an H-bridge as a driver.

You haven't provided real data on the speaker - part number, datasheet, etc. Speakers
are not rated by voltage.

For the sound volume you are talking about something like 500W to 2kW is likely to be needed,
completely out of the power class you are thinking about. 100m outside is completely
unlike 10m indoors.

I'd suggest using some sort of mp3 playback module and some beefy ICE system.

You could use a simple circuit like this one, just feed it with your 9V supply and not 5V as shown here :-

I h http://www.geronika.be/shop/monacor-nr-18ks-16-0990.html

Can give 98db sound, it's supposed to go off like a fire alarm.
It's is giving a long loud sound when the bomb goes off and three loud beeps when it is defused.

  • Power rating: 10WMAX/8Ω
  • Frequency range: 1,200-7,000Hz
  • SPL (1W/1m): 98dB

Does this speaker play audio files or would a buzzer work? Much louder for the power.

no sound, just dooooooot dooooooot, like a piezo buzzer

So why not use a buzzer?
The horn will also be directional, but either way 100meters is quite far. You'd need 2Amps just to power that horn speaker to its upper end capability. And a dinky 9V might work a few times but you'll be replacing them regularly with use.

It's basicly this thing I am making, just my own version of it.

The horn is only on for like 5 seconds in an hour, so I don't think that uses much of the battery, they're 1600 mAh batteries, they only last a few hours in an airsoft replica as well.

These are the batteries we use:

I still had to wait for the speaker to arrive so I could test things out.
Now that I have it, I first tested it with 5V to see if it works.

Then I made this circuit to power it with a 9V battery:

The N thingy being a BC547 transistor in TO92 Package
The speaker is this one http://www.geronika.be/shop/monacor-nr-18ks-16-0990.html
And the battery is a 9V Duracell

It goes a lot louder than when I tested it with 5V, I was just wondering if it could still be louder, cause louder is better.

I used this simple code so I could use the reset button on the Arduino to test it out.

const int speaker = 7;

void setup() {
  pinMode(speaker, OUTPUT);
  tone(speaker, 440);
  delay(1000);
  noTone(speaker);
}

The N thingy being a BC547 transistor in TO92 Package

Which needs a 1K resistor between the base and the Arduino.

Grumpy_Mike:
Which needs a 1K resistor between the base and the Arduino.

I did that first but then the speaker went incredibly silent, removing the resistor made it loud.
How does that happen and how am I supposed to get around that?

compy111:
I did that first but then the speaker went incredibly silent, removing the resistor made it loud.
How does that happen and how am I supposed to get around that?

Removing the resistor will damage the Arduino's output driver. It's not a matter of if, but when.

Don't use a wimpy small signal BJT when you need a power transistor. 10W through 8 ohms needs over 1ARMS, a substantial amount of current. That BJT is only rated for 100 mA. Get a proper, beefy MOSFET.

If you want serious power in a 8-ohm loudspeaker, you'll need something a bit better than a single transistor.

To get 10 watts you'll need about 9-volts rms, which is > 25v p-p.

So you'll need either single ended amplifier with >25v supply, or a bridge circuit with > 12v supply. And capable of > 3A peak

An H-bridge motor shield with a 12v supply would be a good choice.

You won't run this off a little 9v battery.

regards

Allan