Then the GND of the speaker is then connected to the GND of the battery. Firstly is it right that the BASE pin of the opto-coupler is floating?
The main problem I am experiencing a voltage drop from 9.54V to 0.099V between PIN 5 and PIN 4? All I need is the speaker to be turned on and off at specific times.
Depending on how loud you need it you can attach a speaker directly to an arduino pin with the tone() function, with a appropriate series resistor, however that will not be very loud so you will probably want to look into an amplifier to feed the tone into or an alternate way of producing a tone, maybe a 555 timer that can be switch on and off with a transistor
Are you trying to use the opto coupler as a solid-state relay? Those opto couplers are good for maybe upto 10mA of output current maximum - I'm unsure why you say "on" and "off" about a speaker (perhaps its a buzzer?).
Sorry I was not very clear about the on off state, I've set up the speaker with two syringes and a tin so that it pumps a liquid out. Works perfectly when connected directly to the battery. What I want to do is control the timing of when the water is pumped out using the Arduino. My ultimate goal is water collision photography, and the reason behind using a speaker is that I cannot afford a solenoid valve.
Ah, its certainly needing more than 10mA then - opto coupler is used to pass signals between circuits at different voltages, not to switch power. A switching transistor or MOSFET would be what you need I think (possibly also with optocoupler if circuits are at different voltages).
Shucks, the only other thing I have available is a few MOC2023 opto-isolator that I use to trigger the camera's flashes, they work to trigger the circuit on, but not for turning it off