Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. Piezzo siren/alarm

Piezzo siren/alarm

Scheduled Pinned Locked Moved Hardware
32 Posts 5 Posters 3.2k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • bjacobseB bjacobse

    @ben999
    I guess you don't hit resonance frequency.
    Why not scavenge a piezo from a smokealarm, then you you know that the circuit is made for resonance frequency.
    BTW I did not write MY piezo is working at 30V, I directed to a piezo that Adafruit is using, and that uses up to 30V - just to correct that I hvae not used the pieo myself

    ben999B Offline
    ben999B Offline
    ben999
    wrote on last edited by
    #13

    @bjacobse thanks for clarification :smile:

    No smoke came out of mine under 25V DC so i guess it's ok

    And yes, i shall cut open an old smoke alarm, you're right.

    Thanks a lot

    bjacobseB 1 Reply Last reply
    0
    • ben999B ben999

      @bjacobse thanks for clarification :smile:

      No smoke came out of mine under 25V DC so i guess it's ok

      And yes, i shall cut open an old smoke alarm, you're right.

      Thanks a lot

      bjacobseB Offline
      bjacobseB Offline
      bjacobse
      wrote on last edited by
      #14

      @ben999
      But also look careful at the smokealarm PCB, as you might be able to reuse this to ensure that you are using resonance frequency

      1 Reply Last reply
      0
      • FotoFieberF Offline
        FotoFieberF Offline
        FotoFieber
        Hardware Contributor
        wrote on last edited by FotoFieber
        #15

        AFAIK the piezo acts like a capacitor. If you don't use AC, you may have to discharge it with a parallel resistor or discharge it with a transistor.

        You could find some useful information on eevblog, e.g. http://www.eevblog.com/forum/projects/how-to-connect-a-piezo-speaker-to-a-microcontroller/

        toneAC:
        https://bitbucket.org/teckel12/arduino-toneac/wiki/Home

        ben999B 1 Reply Last reply
        1
        • FotoFieberF FotoFieber

          AFAIK the piezo acts like a capacitor. If you don't use AC, you may have to discharge it with a parallel resistor or discharge it with a transistor.

          You could find some useful information on eevblog, e.g. http://www.eevblog.com/forum/projects/how-to-connect-a-piezo-speaker-to-a-microcontroller/

          toneAC:
          https://bitbucket.org/teckel12/arduino-toneac/wiki/Home

          ben999B Offline
          ben999B Offline
          ben999
          wrote on last edited by ben999
          #16

          @fotofieber hi thank you for your message

          I was coming back here to share my findings.... been playing with... ToneAC :joy:

          Yes you're right, differential drive makes a hell of a difference! each pin of the piezo speaker are connected to its own arduino output (serial resistor on one pin though) that send the same signal in opposition as to get a differential movment.

          But i don't quite get it :

          • driving the piezo speaker with up to 25V doesn't improve noise level at all
          • switching to differential drive @5V (so it's a 10V potential peak-to-peak) opens hell's doors wide open

          That's the part i dont understand. I'll carry on investigating.

          Still: noise level is a bit below as compared to same pizeo speaker connected to original alarm enclosure...
          I might have a go with transistors and try a differential of 2S or 3S LiPo.
          Also waiting for my oscilloscope to find out!

          And lastly: ToneAC uses pins 9 and 10... so it's a NO-NO with nRF24 :cry:
          Enters... ToneAC2. It's inferior (CPU cycle, accuracy, lower freq) in many points except that pins are configurable.

          More soon... :nerd_face:

          mfalkviddM FotoFieberF 2 Replies Last reply
          0
          • ben999B ben999

            @fotofieber hi thank you for your message

            I was coming back here to share my findings.... been playing with... ToneAC :joy:

            Yes you're right, differential drive makes a hell of a difference! each pin of the piezo speaker are connected to its own arduino output (serial resistor on one pin though) that send the same signal in opposition as to get a differential movment.

            But i don't quite get it :

            • driving the piezo speaker with up to 25V doesn't improve noise level at all
            • switching to differential drive @5V (so it's a 10V potential peak-to-peak) opens hell's doors wide open

            That's the part i dont understand. I'll carry on investigating.

            Still: noise level is a bit below as compared to same pizeo speaker connected to original alarm enclosure...
            I might have a go with transistors and try a differential of 2S or 3S LiPo.
            Also waiting for my oscilloscope to find out!

            And lastly: ToneAC uses pins 9 and 10... so it's a NO-NO with nRF24 :cry:
            Enters... ToneAC2. It's inferior (CPU cycle, accuracy, lower freq) in many points except that pins are configurable.

            More soon... :nerd_face:

            mfalkviddM Offline
            mfalkviddM Offline
            mfalkvidd
            Mod
            wrote on last edited by
            #17

            @ben999 nice work, thanks for sharing.

            To change pins for the nrf24, use the following in your sketch

            #define MY_RF24_CE_PIN 7
            #define MY_RF24_CS_PIN 8
            
            ben999B 1 Reply Last reply
            1
            • ben999B ben999

              @fotofieber hi thank you for your message

              I was coming back here to share my findings.... been playing with... ToneAC :joy:

              Yes you're right, differential drive makes a hell of a difference! each pin of the piezo speaker are connected to its own arduino output (serial resistor on one pin though) that send the same signal in opposition as to get a differential movment.

              But i don't quite get it :

              • driving the piezo speaker with up to 25V doesn't improve noise level at all
              • switching to differential drive @5V (so it's a 10V potential peak-to-peak) opens hell's doors wide open

              That's the part i dont understand. I'll carry on investigating.

              Still: noise level is a bit below as compared to same pizeo speaker connected to original alarm enclosure...
              I might have a go with transistors and try a differential of 2S or 3S LiPo.
              Also waiting for my oscilloscope to find out!

              And lastly: ToneAC uses pins 9 and 10... so it's a NO-NO with nRF24 :cry:
              Enters... ToneAC2. It's inferior (CPU cycle, accuracy, lower freq) in many points except that pins are configurable.

              More soon... :nerd_face:

              FotoFieberF Offline
              FotoFieberF Offline
              FotoFieber
              Hardware Contributor
              wrote on last edited by
              #18

              @ben999 said in Piezzo siren/alarm:

              But i don't quite get it :

              driving the piezo speaker with up to 25V doesn't improve noise level at all
              switching to differential drive @5V (so it's a 10V potential peak-to-peak) opens hell's doors wide open

              You may try to use a 1kOhm resistor parallel to the piezo (as suggested on eevblog).

              1 Reply Last reply
              1
              • mfalkviddM mfalkvidd

                @ben999 nice work, thanks for sharing.

                To change pins for the nrf24, use the following in your sketch

                #define MY_RF24_CE_PIN 7
                #define MY_RF24_CS_PIN 8
                
                ben999B Offline
                ben999B Offline
                ben999
                wrote on last edited by ben999
                #19

                @mfalkvidd oh yeah I forgot about that one!!! Thanks a lot! I have used this with a Mega for who-knows-what-reason in the past but completely forgot about it! ToneAC still in the race then, thanks again

                @fotofieber thanks a lot, but that thread is for high-level hobbyists!!! :scream: Schematics, yummy!!!
                "replace the resistor with an inductor then you double the swing" but no figures... i'll google that and see where it gets me...
                I dont even know the specs of my piezo :zipper_mouth_face:

                FotoFieberF 1 Reply Last reply
                0
                • ben999B ben999

                  @mfalkvidd oh yeah I forgot about that one!!! Thanks a lot! I have used this with a Mega for who-knows-what-reason in the past but completely forgot about it! ToneAC still in the race then, thanks again

                  @fotofieber thanks a lot, but that thread is for high-level hobbyists!!! :scream: Schematics, yummy!!!
                  "replace the resistor with an inductor then you double the swing" but no figures... i'll google that and see where it gets me...
                  I dont even know the specs of my piezo :zipper_mouth_face:

                  FotoFieberF Offline
                  FotoFieberF Offline
                  FotoFieber
                  Hardware Contributor
                  wrote on last edited by
                  #20

                  @ben999 said in Piezzo siren/alarm:

                  @fotofieber thanks a lot, but that thread is for high-level hobbyists!!! Schematics, yummy!!!
                  "replace the resistor with an inductor then you double the swing" but no figures... i'll google that and see where it gets me...
                  I dont even know the specs of my piezo

                  I try to simplify: Take a 1 kOhm resistor and attach each side of it to another pin of the piezo. Don't change anything else.

                  ben999B 1 Reply Last reply
                  0
                  • FotoFieberF FotoFieber

                    @ben999 said in Piezzo siren/alarm:

                    @fotofieber thanks a lot, but that thread is for high-level hobbyists!!! Schematics, yummy!!!
                    "replace the resistor with an inductor then you double the swing" but no figures... i'll google that and see where it gets me...
                    I dont even know the specs of my piezo

                    I try to simplify: Take a 1 kOhm resistor and attach each side of it to another pin of the piezo. Don't change anything else.

                    ben999B Offline
                    ben999B Offline
                    ben999
                    wrote on last edited by ben999
                    #21

                    @fotofieber :grin: oh yes i got that one correct :stuck_out_tongue_winking_eye:

                    It was more about how to size the inductor and stuff. Guys on these forums know their sh*t, they dont go into much details: "just stick a thing there and you'll be good" :joy:

                    1 Reply Last reply
                    0
                    • ben999B Offline
                      ben999B Offline
                      ben999
                      wrote on last edited by ben999
                      #22

                      Guys,

                      Thanks all a lot for your input.

                      Seems sorted :

                      • differential drive (ToneAC)
                      • transistor (TIP120 in my case, not sure it's my best move)
                      • 3S louder than 2S, itself louder than 1S

                      Schematic TIP120 and 1k resistors

                      0_1555413823315_Capture.JPG
                      I did also put a 1k resistor in between the piezo speaker pins... but it lowered the tone by quite a lot... :thinking_face:

                      To be tested

                      I'll have a go with an inductance to see what " then you double the swing" means... double the loudness or double the speed ?

                      Thanks again, people involved :wink:

                      FotoFieberF 1 Reply Last reply
                      0
                      • ben999B ben999

                        Guys,

                        Thanks all a lot for your input.

                        Seems sorted :

                        • differential drive (ToneAC)
                        • transistor (TIP120 in my case, not sure it's my best move)
                        • 3S louder than 2S, itself louder than 1S

                        Schematic TIP120 and 1k resistors

                        0_1555413823315_Capture.JPG
                        I did also put a 1k resistor in between the piezo speaker pins... but it lowered the tone by quite a lot... :thinking_face:

                        To be tested

                        I'll have a go with an inductance to see what " then you double the swing" means... double the loudness or double the speed ?

                        Thanks again, people involved :wink:

                        FotoFieberF Offline
                        FotoFieberF Offline
                        FotoFieber
                        Hardware Contributor
                        wrote on last edited by
                        #23

                        @ben999 said in Piezzo siren/alarm:

                        I did also put a 1k resistor in between the piezo speaker pins... but it lowered the tone by quite a lot..

                        Cool, you sorted it out! The resistor may only help in an DC setup (one output from the arduino). In your AC setup it is useless.

                        ben999B 1 Reply Last reply
                        0
                        • FotoFieberF FotoFieber

                          @ben999 said in Piezzo siren/alarm:

                          I did also put a 1k resistor in between the piezo speaker pins... but it lowered the tone by quite a lot..

                          Cool, you sorted it out! The resistor may only help in an DC setup (one output from the arduino). In your AC setup it is useless.

                          ben999B Offline
                          ben999B Offline
                          ben999
                          wrote on last edited by ben999
                          #24

                          @fotofieber gosh that a good analysis :+1: that makes a lot of sense
                          Then i can picture things better:

                          • one output with 0 et +5V is considered as DC
                          • two output pulling differentially -5V to +5V... looks like a sin curbe... so it's AC !

                          Breadboard is out and still cabled, i'll have a go asap and confirm

                          Thanks again for your knowledge

                          FotoFieberF 1 Reply Last reply
                          0
                          • ben999B ben999

                            @fotofieber gosh that a good analysis :+1: that makes a lot of sense
                            Then i can picture things better:

                            • one output with 0 et +5V is considered as DC
                            • two output pulling differentially -5V to +5V... looks like a sin curbe... so it's AC !

                            Breadboard is out and still cabled, i'll have a go asap and confirm

                            Thanks again for your knowledge

                            FotoFieberF Offline
                            FotoFieberF Offline
                            FotoFieber
                            Hardware Contributor
                            wrote on last edited by
                            #25

                            @ben999
                            You could try DC (one output) with 12V to the piezo. If you want to use only 5V, the AC solution should be louder, as it gets 10V difference to the piezo.

                            I usually stop optimizing, when it is good enough. If AC is enough, go with it. :)

                            ben999B 1 Reply Last reply
                            0
                            • FotoFieberF FotoFieber

                              @ben999
                              You could try DC (one output) with 12V to the piezo. If you want to use only 5V, the AC solution should be louder, as it gets 10V difference to the piezo.

                              I usually stop optimizing, when it is good enough. If AC is enough, go with it. :)

                              ben999B Offline
                              ben999B Offline
                              ben999
                              wrote on last edited by ben999
                              #26

                              @fotofieber DC+ one output is really poor and voltage has no impact on noise. I have tested with up to 6S LiPo and there's absolutely no gain as compared to 5V DC

                              AC+ two outputs is a game changer! Much louder right from +/-5V and really a killer @ +/-12V.

                              So that's it: the first iteration of this project will go for a step-up converter from 5V up to 12V for the piezo speaker.

                              Thanks folks!

                              EDIT: could someone suggest a MOSFET (or transistor) that could be used in lieu of the huge (and probably over-sized) TIP120 (that where there, waiting in the drawer :) ). Through-hole is my league. SMD is a bit of a struggle (welding, machining pcb, ...)

                              Thanks again :smiley:

                              1 Reply Last reply
                              0
                              • ben999B Offline
                                ben999B Offline
                                ben999
                                wrote last edited by ben999
                                #27

                                back at it !

                                I got my LCD microscope out and tried to reverse-engineer the original board. I should have done that to start with.

                                I drew that circuit on www.falstad.com (this link takes you to my actual circuit) and got several kV out of the simulation lol.

                                I used the original transformer: i could only measure resistance, so 5,5ohms on primary side, and 195ohms on secondary.

                                First transistor hooked to wave generator is J3Y. I replaced it with a BC547 (the "copy-paste" engineer hidden inside my head told me it's fairly close lol).

                                Second transistor is labeled J41CG and seems pretty strong to me so i replaced it with TIP120 .

                                buzz01.png

                                Next I put all these components onto the breadboard, and load my favourite Nano with this sketch :

                                const int buzzerPin = 9;
                                int i = 0;
                                unsigned long duration = 1000;
                                
                                void setup() {
                                  pinMode(buzzerPin, OUTPUT);
                                }
                                
                                void   loop() {
                                  for (i = 1000; i < 5000; i++) {
                                    tone(buzzerPin, i, duration);
                                  }
                                  for (i = 5000; i > 1000; i--) {
                                    tone(buzzerPin, i, duration);
                                  }
                                }
                                

                                That is ever so LOUD !!

                                So this is plenty good enough for my little project !

                                next step

                                1 Reply Last reply
                                1
                                • TheoLT Offline
                                  TheoLT Offline
                                  TheoL
                                  Contest Winner
                                  wrote last edited by
                                  #28

                                  There are also a lot of circuits using 555 timers and some old CMOS or TTL chips that easily create the oscilation you need. It draws a bit more power when the piezo is active. But for me that's worth it, because it gets rid of the complication in the code.
                                  And is you have a bad MySensors radio connection, MySensors will keep executing code that might interrupt code. Which is annoying for applications like this, because it will interfere with your piezo sound. That's why I prefer a hardware solution or an active piezo buzzer. The ones that have a range from 3.3V to 24V are usually very load at 24V. They can be driven with a simple fet.

                                  At least that's how I look at electronics now, don't jump to a software solution when some old skool electronics make your life easier.

                                  But I love the project!

                                  1 Reply Last reply
                                  0
                                  • ben999B Offline
                                    ben999B Offline
                                    ben999
                                    wrote last edited by
                                    #29

                                    Next step is to measure battery voltage on a daily basis.

                                    Current setup is as follow:

                                    • Pro Mini 8MHz 3.3V (regulator removed)
                                    • Single cell LiPo (4.2V)
                                    • Solar panel (unknown specs)
                                    • Solar charger/boost to 5.0V based on 4056 chip

                                    My reference for this part of the project is this post :
                                    @Anticimex said in New library to read Arduino VCC supply level without resistors for battery powered sensor nodes that do not use a voltage regulator but connect directly to the batteries ;-)

                                    I would like to activate the voltage divider on demand, via a transistor (NDP6020P as per previous link) as to not draw voltage 24/7 on a permanent divider.
                                    I am also considering using AVR's internal 1.1V reference to measure the voltage.
                                    Simulation gives this: link to falstad
                                    circuit-20260319-1115.png

                                    As one looks at the "live" simulation one can notice that the transistor leaks a bit... a few mV.. that's the bit that worries me.

                                    Is this a flaw from the calculation or does a transistor leak anyway ?

                                    Thanks a lot for your suggestions !

                                    1 Reply Last reply
                                    1
                                    • TheoLT Offline
                                      TheoLT Offline
                                      TheoL
                                      Contest Winner
                                      wrote last edited by
                                      #30

                                      Just curious, still learning. Would a mosfet not draw less power? You could use a Mosfet and use a diode instead of a resistor to pull it high or low. That way it consumes micro amps.

                                      ben999B 1 Reply Last reply
                                      0
                                      • TheoLT TheoL

                                        Just curious, still learning. Would a mosfet not draw less power? You could use a Mosfet and use a diode instead of a resistor to pull it high or low. That way it consumes micro amps.

                                        ben999B Offline
                                        ben999B Offline
                                        ben999
                                        wrote last edited by ben999
                                        #31

                                        @TheoL thanks a lot for your suggestions

                                        Unfortunately this is way above my league
                                        And i'm not brainy enough to modify his design

                                        I am using that same transistor mentionned in @Anticimex 's post

                                        My question was very general : does a transistor leak and by how much (is that a figure even given is the specs sheet?)

                                        Thanks you anyway for replies

                                        1 Reply Last reply
                                        0
                                        • TheoLT Offline
                                          TheoLT Offline
                                          TheoL
                                          Contest Winner
                                          wrote last edited by
                                          #32

                                          Can't give you a 100% answer. I've noticed with FETS I sometimes have a low leak Voltage. But I've seen Chinese designs that gave a negative voltage when the FET was turned off haha

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          18

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.2k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular