Need help: Arduino + 555 timer + loud alarm signal

Hi everybody, please help me to figure our best approach to this problem:

I'm working on some home alarm project and one of the ideas is that when need, Arduino will send a loud "BEEP!" across the room. Here is my idea how to do it, I have couple thing I cannot understand and also any idea about how to make it better is appreciated:

  1. When alarm need to sound, arduino sends signal to 555 timer in monostable mode, signal length is 1second.
  2. That 555timer triggers another 555 timer that is in astable mode and tuned up to generate high beep frequency to piezo buzzer.

That part I just figured out, just need to wire two 555 times in specific way and combinations of R and C will give me timing I need.

Question1: I understand that in order to make piezo buzzer very loud I need to send more than 5V to it and 5V is all I can have directly from Arduino, is that correct? If so, what is the best way to do it? Do i need some kind of voltage step up module?

Question2: According to spec sheet, 555 timer in monostable mode triggered by switching leg#2 from high to low state, how do I properly do that with Arduino? Do I need to connect one of digital pins on arduino with pin#2 on 555 timer and connect Arduino's and Timer's grounds and then I simply do digitalWrite commands to switch digital pin on Arduino from high to low?

Need help please.

Thanks.

Can’t you do this without the 555s, using the Arduino’s tone() finction?

If you have an arduino you don't need 555's. Would you carry a slingshot if you had a machinegun ? If you need a higher voltage you can use a stepup converter to provide the Vcc for a swtched mosfet or push pull audio amplifier driving a speaker. Google "push-pull audio amplifer"

JimboZA: Can't you do this without the 555s, using the Arduino's tone() finction?

I do not want to use arduino's tone function because (per my understanding) as it plays tone it locks up program flow until tone is done? I am monitoring keyboard for clicks and I need to react to them so I want to outsource that beet outside of arduino, so I can simply send one command to one pin and it will trigger 555 timers. Let me know if I am wrong though.

You can use Timer 1 to generate a frequency to drive the audio amp and use GPIO to drive the mosfet that connects the timer output with the amp. You can make a simple amp with the following:

1 1 k resistor 1 2N3904 transistor 1 2N3906 transistor 1 220 uF electrolytic capacitor 1 8 ohm 2" speaker

Connect 1 k resistor to base of both transistors connect collector of 2N3904 to 3.3V connect collector of 2N3906 to GND connect emitter of both transistors together connect "+" lead of electrolytic cap to emitters connect "-" lead of cap to speaker "+" terminal connect "-" terminal of speaker to GND drive amp from other end of 1 k resistor using series pass transitor (AKA COMMON BASE) 2N3904 with collector connected to Timer output, emitter connected to 1 k resistor input , base connected to GPIO pin through a 1 k resistor.

push-pull audio amplifier

|500x183

raschemmel: You can use Timer 1 to generate a frequency to drive the audio amp and use GPIO to drive the mosfet that connects the timer output with the amp.

Can you give me please a bit more idea how to implement this? Do I need to strap an interrupt to Timer1 which will set pin to high when triggered or something?

Google “arduino Timer 1” (or “Timer One”) or Timer 2

Use Timer 2 because I don’t think it affects delay()

Do I need to strap an interrupt to Timer1 which will set pin to high when triggered or something?

Post your code and explain the details. I don’t see why a simple IF statement wouldn’t work.

  1. When alarm need to sound, arduino sends signal to 555 timer in monostable mode, signal length is 1second.
  2. That 555timer triggers another 555 timer that is in astable mode and tuned up to generate high beep frequency to piezo buzzer.

the 1 second can be detected using millis()
the tone is done by Timer 2 using a common base transistor (2N3904) to switch the timer output to the input of the audio amp I described through a 1 k base resistor to a GPIO. Collector connects to Timer 2 output, Emitter connects to input of audio amp (1 k resistor in schematic) and base connects to GPIO pin though 1 k ohm base resistor. I don’t know how loud that amp is. I haven’t tried it yet.

You can choose the note here

Read up on timers here

and
here

digitally enabled audio amplifier.jpg

Attached circuit has been tested. The amplifier is not that loud but you could add an LM386 and use the same transistor input switch. If you want to use a piezo instead the switch will still work.

Hello again All, while I had success getting needed beep frequency out of arduino without any timer chips (thanks very much for helping me figure out that) I am still having issues with loudness of piezo. I tried few things, nothing works, either no sound at all or very very quiet. Can you please walk me through my options again but a bit simplified, I am not stupid but unfortunately I an at slightly above beginner lever when it comes to circuitry. Once again, the way it is setup right now, I have piezo connected Positive to Pin#10 and Negative to GND on arduino and when I need to make it sound I simply send pulse to it through the pin and from my understanding it makes 5V go through piezo.

Also in my understanding, if piezo rated up to 12v, then if I send 12v to it, it will be louder, problem is where do I get those 12v if my arduino can only supply 5v.

How do I make it louder?

Use this circuit but with 12V
piezo driver

PIEZO DRIVER.png

It works but it is very quiet, is it perhaps because I use this transistor (PN2222) instead of the one you showing?

It works but it is very quiet, is it perhaps because I use this transistor (PN2222) instead of the one you showing?

That transistor should work fine. Do you have 12V on the cathode of the diode ?

Oups, sorry, all this time I meant 9v battery, not 12, but I figure that does not make huge difference.
This is the image of exactly how I connected it, red - wires, and in blue I show you what pin of transistor is what on the diagram.

There's nothing there.

Fixed, was too large in size but then forum flocks me for 5 minutes to make edits, all corrected now and picture attached in the message above.

That's the correct wiring. (assuming the flat face of the transistor is facing up in the image)

Post a link or photo for the piezo. Check the voltage on your 9V battery. They are rated for 300 mAh (drive a 300 mA load for 1 hour).

Test it by bypassing the transistor completely with a jumper wire from the anode of the diode to GND. If the volume doesn't change then the problem is not the transistor. Post your code too.

This is the piezo I am using, if I connect it directly to arduino it works just fine. https://www.adafruit.com/products/1739

I tried two different transistors already, same result. I did forget to mention that I am running arduino off USB is that makes any difference.

I will take a dinner break, then will rewire everything and will record its function and post here for troubleshootign.

Thanks.

Post a photo of your circuit. That kind of piezo is never very loud but it should be working. Are you SURE the base resistor is 1 k ? Try changing it to 150 to 220 ohms. Did you do what I said about putting a jumper wire from the anode of the diode to GND to test it ? Something is definitely not right. That's a simple circuit. It should have worked from the start.

Measure the voltage on the base of the transistor when you connect the base resistor to +5V. Measure the voltage on the collector too.

Nope, still the same result, I triple checked the circuit, ran it from both , USB and Wall power, two different resistor values, 1k and 150R there is a tiny bit difference with 150R it is louder comparing to 1k, but still waaaay quieter than if I connect piezo directly to arduino, my program is simple. It generates frequency via timer interrupt. tone command also gives the same result. Standard test "Melody" program from arduino package - same quiet result. Here are two videos:

This is straight from arduino, pin8 and GND https://www.dropbox.com/s/s3le5bjm2oekp0a/Video%20Apr%2022%2C%2012%2044%2026%20AM.mov?dl=0

And this is via transistor https://www.dropbox.com/s/h1o6xpmlh6lspfo/Video%20Apr%2022%2C%2012%2053%2002%20AM.mov?dl=0

I find that hard to believe. I can't see your circuit in the video . Can you post a closeup (from directly above) photo of your circuit ? it is possible this problem is due to the fact that the piezo draws such little current. I can tell you that my transistor circuit with a 2 " , 8 ohm speaker was louder than your piezo.

I will reassemble this circuit on naked arduino when I get home later tonight and will fire it up again. Yeah, I cannot beleive this either, it seem such simple and bulletproof schematic.