Need to detect when voltage is sent to 3.7v speaker

Imgur

I drew a crude schematic of how I'm planning on wiring it. My goal is to be able to tell when sound is coming from the speaker using AnalogRead(). I dont really need the arduino to be able to tell how much voltage is going to the speaker. Just binary yes/no. Is the wiring as simple as i drew in the schematic? or will i need someting more? thanks :smiley:

Your schematic would probably work, but I'd be tempted to put a capacitor on the input as you are detecting AC not DC and that will give you some buffering etc.

You may also be able to use a digital input, if you use a capacitor and a resistor divider network to set a mid point voltage, or turn on the internal pullup on a digital input and use an external 22k (the internal pullup is 22k), and a capacitor.
But this would be dependant on the voltage that you are getting at the speaker. Its possible that there would not be enough swing to tigger an interrupt etc on a digital pin. But it would make the code more compact if you were only trying to detect audio or no audio.

Almost certainly not.
There is something missing from the speaker on the diagram like how it is driven, unless the "go pro" is some sort of driver.
A speaker will need to be driven by AC, if you put AC into and arduino it will be damaged. You need to include a seriese diode and a capacitor at least to make this work.

@Grumpy_Mike

A GoPro is a digital camera, it has a big socket on the back with loads of outputs (but I can't remember if a speaker output was one of them, it may be).

It also outputs audio and video on a modified USB port, but I don't think this is what rujoesmith can be connecting to, as AFIK its raw base band video + audio subcarrier

e.g. GoPro Hero 2 Hacking with Bus Connector and Power Mode Pin 12 - YouTube

Thanks. I have come across a go pro as a camera but not as an audio output.

I would still go with a seriese diode though and a capacitor across the analogue input, even if you have AC coupling. It is unlikely to give only a single ended output.

I agree, a capacitor is a good idea.

I'm not sure the GoPro would generate any negative voltages, so I'm not sure if a diode is necessary, but who knows .

I'm not even sure the GoPro can drive speaker

I actually have the poor mans version, the gopro 960. So I don't have the bus connector :frowning:

The end goal of the project is to turn the gopro into a dashcam that i never have to touch. It will start recording when i start the car and will delete the files off the memory card when i turn the car off, unless i want to save.

Right now the only way i have of interfacing with the gopro is by hardwiring the physical buttons. Ive wired up the buttons to the arduino and can send button presses. Ive made a few macros to do things like start recording and delete files. This sort of works, but isnt very reliable because the gopro occasionally lags, the arduino will send a button presses to fast, and the gopro will miss it. I cant simply adjust the times that the button presses are sent because it is unpredictable when the gopro will be lagging.

The speaker on the gopro beeps each time a button press is executed. So I figured if the arduino can detect voltage to the speaker, it will know that the button press has been completed and can move onto the next.

Sorry if this doesnt make sense :~

Yes that makes sense. So is that speaker a ceramic resonator?
Have you measured what sort of output you have on that pin?

Also, I dont think i explained what i wanted to do very well in my original post. The gopro already has a tiny onboard speaker that only plays one pitch. I just want to be able to detect when the speaker is beeping.

Im not sure what type of speaker it is, but i have measure 3.7v dc with a multimeter

rujoesmith:
Im not sure what type of speaker it is, but i have measure 3.7v dc with a multimeter

You need to see it on a scope to tell if it is DC.

Ah, ok diddnt realize that. All i did to measure was put positive at the solder point of red wire, and negative to ground. Then pushed a button to make the speaker beep and measured ~3.7v.

At the bottom of this tutorial is a picture of the speaker. Not the same model gopro, but the speaker looks to be the same.

In which case I would put in a diode just to be on the safe side, it can't hurt.

sounds good, thanks for all the input!

I also did what you are doing with a go pro last week , maybe two weeks ago , I havent bothered to delete files, but I made some macros etc to put the camera in the mode that I want,

void pressTrigger(){
  pinMode(trigger, OUTPUT);
  digitalWrite(trigger,LOW);
  delay (50);
  pinMode(trigger, INPUT);
}

there is the code used to "press the trigger button" I define the pin as an input in setup (), I can reduce the 50ms delay down to 20ms, but it gets a little un reliable, 50ms is quick as heck anyway, it seems that the screen on the gopro takes around 30ms to change image,

I thought about taking a feed from a LED or the speaker to confirm the button press before continuing but it has been reliable enough for now without that.

I have a hero3+ silver edition, maybe they improved it, I am trying to get some RF modules working so that I can control it remotely and have some feedback, from it on an lcd screen remotely, I think that once i get that far i will need a confirmation signal from the gopro.

rujoesmith:
The end goal of the project is to turn the gopro into a dashcam that I never have to touch. It will start recording when I start the car and will delete the files off the memory card when I turn the car off, unless I want to save.

No, you most certainly do not want to delete the files from the memory card whenever you turn the car off.

Paul__B:

rujoesmith:
The end goal of the project is to turn the gopro into a dashcam that I never have to touch. It will start recording when I start the car and will delete the files off the memory card when I turn the car off, unless I want to save.

No, you most certainly do not want to delete the files from the memory card whenever you turn the car off.

he says “unless I want to save” maybe he will have a button to cancel the deleting when the car is turned off.

for the OP, dont count on running the arduino from the cars power supply if you want it to do stuff with the power off , unless you can find a constant live wire

yeah i have a constant on wire, its powered by a 5v car charger wired to the cig lighter which stays on when the car is off. The easiest way to let the arduino know its time to stop recording would probably just be a button. But id rather have it auto-shutdown. Any ideas on what i could do to have it detect the car has been turned off?

I thought i could wire an analog pin to some factory wiring that shuts off when the car does. With a resistor to bring it down to ~3-5v of course. This way i could just check for voltage on the analog pin and have it send its final button presses.

If you delete automatically on turn off then supposed you had a serious crash that wrecked your car, you would have no record. Better to have the delete automatically on switch on, unless a button is pressed.

rujoesmith:
wired to the cig lighter which stays on when the car is off.

Now that is unusual.