I've been trying to use my Arduino to detect an alarm clock going off. My first approach involved putting a relay across the speaker, but the clock couldn't close the relay because either the clock didn't have enough power or the clock's alarm is a rapid series of beeps, not a constant beep which would be more desirable. Are there any other ways to do it?
Can you read the speaker output into an analog port and watch for a change in voltage?
I don't see why I wouldn't be able to, although I've never done anything like that before. How is it wired and read in the code?
You might be heading down the wrong path tying into the speaker directly. Why not use an amplified microphone? There's one on our Gadget Shield or you can buy a microphone module. Put the microphone near the alarm clock speaker and use analogRead() to take frequent readings and compute signal power.
-- The Arduino Drum Machine: MIDI development system with 14-track MIDI drum machine sequencer / groove-box software
Yes, I'm getting light with an LED, so I suppose the opto-isolator is the way to go. It seems simple enough to use, just connect one end to the speaker and the other to the arduino analogue? How is it wired to the arduino and what is the code look like that reads the input?
After going to Radioshack in search of an opto-isolator, I instead walked out with some photoresistors. Not wanting to buy online and pay shipping, I instead managed to make it work by connecting an LED directly to the clock speaker/buzzer, putting the photoresistor right up on the LED and connecting it to the Arduino analog in, and wrapping the whole deal in a layer of electrical tape to keep unwanted light out. It seems to work wonderfully, but will the LED hold up being connected directly to the clock speaker/buzzer, or do I need a resistor? I can't seem to get a good reading on the voltage or amperage it's putting out because it constantly cycles on and off when it goes off.
Thanks all for the help.
It seems to be reliable enough for my taste, and putting an LED at risk is always favorable over putting the Arduino at risk.
Thanks again for all the help!