converting a push button sound chip to play at set intervals

I am new to Arduino. I have done some of the basic tutorials and have been searching for a simple project that I could do on my own. I read about using the arduino board as an ISP to program ATtiny85 chips to do basic arduino functions using a much smaller signature. http://hlt.media.mit.edu/?p=1229 I thought it would be interesting to program an arduino or ATtiny to run a small sound chip that I removed from a dog toy to run at set intervals. The purpose would be a gag - hide it some where and have it go off one minute then maybe go off again 5 minutes later then maybe 15 minutes later etc and loop.

The sound chip is about 3/4 inch pcb running on two small watch batteries in series to produce about 3volts. Once a small button is pressed it completes the circuit and a sound chip is triggered through a small speaker. I jumped the connection where the button connected to be always on. I soldered hook up wire to the negative and positive connections and hooked up 3 volts via 2 AA batts and the sound was triggered. Everytime I applied voltage the sound chip would trigger.

Before programming the ATtiny - I thought I would try it on my arduino uno first. Then program the ATtiny if it worked.

I hooked up negative to ground and positive to an analog pin running at around 3.3volts. However, when voltage was applied through the pin instead of the sound being triggered, the speaker only hummed. I checked the voltage being applied through the pin and it was set right. Whats really bizzare, is when I place the positive wire into 3.3v on the board it triggers the sound. If I plug it in the 5v on the board it plays the sound only louder. I tried it with as a digital pin using digital write and instead of a humming noise I got a very small chirp from the speaker.

one attempt at code;

void setup() { pinMode(11, OUTPUT);

} void loop() { delay(1000); analogWrite(11, 170); delay(3000); analogWrite(11,0);

}

Is it my sketch? Did I approach the hardware wrong? I don't understand how I could apply the voltage with other means and get the sound to play but can't get it to replicate through a pin on the arduino. Any suggestions would really be helpful.

Yes, your approach is incorrect in the following two ways:

  1. You don’t want to power the circuit by an arduino pin. The arduino pins can only provide 20mA max current. The dog toy may need more than that so even after you fix connections, you are damaging your arduino.

  2. The analog output of 3.3V from arduino pin is not 3.3V static. Read this: http://www.arduino.cc/en/Tutorial/PWM

What I recommend you to do is to get a field effect transistor. It is an electronic switch you can open and close just like the removed mechanical switch. It is able to allow enough current to flow through itself instead of letting current flow from arduino pins.

Random tutorial I found on youtube.com

I actually watched the entire tutorial and it is pretty good.

Thanks that helps a lot.