An easy way to make noise with Arduino using tone()

SdĂ­let
VloĆŸit
  • čas pƙidĂĄn 11. 07. 2024
  • đŸ€© FREE Arduino Crash Course 👇👇
    bit.ly/get_Arduino_skills
    **If you like this, I think you'll like the premium Arduino training we offer. Check it out here**
    bit.ly/3nSBPUs
    Click Below to Read About This Topic on Our Website
    programmingelectronics.com/an...
    We designed this circuit board for beginners!
    Kit-On-A-Shield: amzn.to/3lfWClU
    SHOP OUR FAVORITE STUFF! (affiliate links)
    ---------------------------------------------------
    We use Rev Captions for our subtitles
    bit.ly/39trLeB
    Arduino UNO R3:
    Amazon: amzn.to/37eP4ra
    Newegg: bit.ly/3fahas8
    Budget Arduino Kits:
    Amazon:amzn.to/3C0VqsH
    Newegg:bit.ly/3j4tISX
    Multimeter Options:
    Amazon: amzn.to/3rRo3E0
    Newegg: bit.ly/3rJoekA
    Helping Hands:
    Amazon: amzn.to/3C8IYXZ
    Newegg: bit.ly/3fb03X1
    Soldering Stations:
    Amazon: amzn.to/2VawmP4
    Newegg: bit.ly/3BZ6oio
    AFFILIATES & REFERRALS
    ---------------------------------------------------
    â–șAudible Plus Free trial: amzn.to/3j5IGrV
    â–șJoin Honey- Save Money bit.ly/3xmj7rH
    â–șDownload Glasswire for Free:bit.ly/3iv1fql
    FOLLOW US ELSEWHERE
    ---------------------------------------------------
    Facebook: / programmingelectronics...
    Twitter: / progelecacademy
    Website: www.programmingelectronics.com/
    Do you need to make some noise with Arduino? Maybe a simple tone for an alarm, maybe a beep to alert you when a specific input threshold is met, or maybe to play the Super Mario Brothers soundtrack to entertain your juvenile mind (it’s OK, we are all there too).
    Whatever your audible need, you will likely find the easiest, quickest and possibly the cheapest way to make some noise is using the tone() function and piezo speaker with your Arduino.
    ###This is exactly what you will learn in this lesson:
    1. A quick intro to piezo speakers (aka piezo buzzers)
    2. How to set up a simple piezo speaker circuit
    3. The basics and more of using the tone() function
    4. The limits you should know when using tone()
    ###Hardware You Will Need:
    * Arduino board, I am using an Arduino Uno [1]
    * Solderless breadboard [1]
    * Jumper wire [2]
    * Piezo speaker (aka piezo buzzer) [1]
    * At least 12 cm dental floss, with a thick wax coating (mint flavored works best) [1]
    ###A quick intro to piezo speakers (aka piezo buzzers)
    Ahh noise
.
    Birds make it, kids make it - it can be music to our ears or pure torture.
    We are going to use a piezo buzzer to make some noise with Arduino.
    A piezo buzzer is pretty sweet. It’s not like a regular speaker that you might think of. It uses a material that’s _piezoelectric_, it actually changes shape when you apply electricity to it. By adhering a piezo-electric disc to a thin metal plate and then applying electricity, we can bend the metal back and forth, which in turn creates noise.
    The faster you bend the material, the higher the pitch of the noise that’s produced. This rate is called frequency. Again, *the higher the frequency, the higher the pitch of the noise we hear*.
    So basically, by shocking the plate over and over really fast, we can make noise. I don’t know who comes up with this stuff, but they’re friggin’ mean.
    Now let’s set up this circuit.
    ###How to set up a simple piezo speaker circuit using Arduino
    It’s painfully easy to set up a simple piezo speaker circuit with an Arduino.
    1. Place the piezo buzzer into the breadboard so that the two leads are on two separate rows.
    2. Using jumper wires, connect the positive lead to Arduino digital pin 8 and the other lead to any Arduino ground pin. The case of the buzzer may have a positive sign (+) on it to indicate the positive lead (if not, then the red wire usually indicates the positive lead).
    That’s it.
    Let’s go ahead and jump into the Arduino sketch.
    ###The basics and more of using the tone() function
    The tone() function works with two arguments, but can take up to three arguments. Let’s address the two required items first:
    tone( pin number, frequency in hertz);
    1. The pin number that you will use on the Arduino.
    2. The frequency specified in hertz. Hertz are cycles per second.
    The frequency is an unsigned integer and can take a value up to 65,535 - but if you are trying to make tones for the human ear, then values between 2,000 and 5,000 are where our ears are most tuned.
    As an experiment, try changing the second argument in tone() to 100, 1000, 10000, 650000 and listen to the effect it has on the audio signal.
    Read More...
    programmingelectronics.com/an...
    About Us:
    This Arduino tutorial was created by Programming Electronics Academy. We are an education company who seek to help people learn about electronics and programming through the ubiquitous Arduino development board.

Komentáƙe • 110

  • @programmingelectronics
    @programmingelectronics  Pƙed 3 lety +1

    ****If you like this, I think you'll like the premium Arduino training we offer. You can check it out here**** bit.ly/3lHyzcB

    • @crypleman
      @crypleman Pƙed 3 lety

      i bought larger piezo speaker, is it posible to send pin where tone out to step up module, so my piezo got louder...?

    • @zaidamos1333
      @zaidamos1333 Pƙed 2 lety

      you all prolly dont care but does anybody know of a method to log back into an Instagram account..?
      I stupidly forgot the login password. I would love any tips you can give me.

  • @acatisfinetoo3018
    @acatisfinetoo3018 Pƙed 4 lety +66

    My left ear really enjoyed this...but the right one feel left out.

  • @TomBudin
    @TomBudin Pƙed 8 lety +8

    Dude you don't know how much this has helped me

  • @kobedde
    @kobedde Pƙed 7 lety +5

    Nice and clear tutorial. Thanks for this.

  • @JoeSmoeDoeLow
    @JoeSmoeDoeLow Pƙed 5 lety +3

    Thank you for this video. It was really helpful and informative.

  • @davidbennett7365
    @davidbennett7365 Pƙed 7 lety

    you are a fantastic teacher, Awesomely clear...nice work!

  • @roshanwickremasinghe7555
    @roshanwickremasinghe7555 Pƙed 7 lety +1

    Thank you very much for sharing your knowledge!

  • @sorenstorm
    @sorenstorm Pƙed 8 lety +2

    So nice! Thank you for your calm and thorough walkthrough. Great work ! Really appreciated

    • @sorenstorm
      @sorenstorm Pƙed 8 lety

      +SĂžren Storm btw - I did the dental floss thing. Really cleaned my teeths

  • @sumedhburbure4173
    @sumedhburbure4173 Pƙed 6 lety +2

    great presentation skills u got there!

  • @nathanking9771
    @nathanking9771 Pƙed 6 lety +1

    Nice job!

  • @mehmetcetin2926
    @mehmetcetin2926 Pƙed 7 lety

    thaks a lot :) it is great explaining

  • @vcguerrilla6438
    @vcguerrilla6438 Pƙed 5 lety +5

    My left ear enjoyed the musical tone

  • @rumingjiang9645
    @rumingjiang9645 Pƙed rokem +1

    my left ear enjoyed this video very much

  • @j0hmama
    @j0hmama Pƙed 4 lety +1

    you had me with dive bar.
    I liked the inclusion of limitations, and the annotation to explore erroneous sounds. perhaps a video response is in order.

  • @erdoganguner2394
    @erdoganguner2394 Pƙed 2 lety +1

    This is exactly what I needed for a diy sound wave generator with a buzzer for a school project!
    Also, even though it's mentioned in every comment bellow, great tutorial.

  • @damithsm1980
    @damithsm1980 Pƙed 6 lety +1

    Great ...Thank You.

  • @TheFlybyman
    @TheFlybyman Pƙed 2 lety +1

    good explination, thanks!

  • @py2pw
    @py2pw Pƙed 4 lety +1

    Your video helped me a lot, thanks Buddy !

  • @Nykho1409
    @Nykho1409 Pƙed 2 lety +1

    my left ear enjoyed it !

  • @Digitalmannen
    @Digitalmannen Pƙed 9 lety +32

    I only have sound in the left channel on this video, is that done on purpose?

    • @Digitalmannen
      @Digitalmannen Pƙed 9 lety

      ***** i now hear that if I turn the volume way up there is son on the right channel too, but it is very low volume

    • @programmingelectronics
      @programmingelectronics  Pƙed 9 lety +2

      ***** That was a production error on my end. I just got some new equipment that I am still figuring out. Shouldn't happen again - but thanks so much for bringing it to my attention!

  • @codybattery8370
    @codybattery8370 Pƙed 8 lety +1

    thanks man

  • @yousaftoki1599
    @yousaftoki1599 Pƙed rokem

    Amazing knowledge sir...

  • @someonetyping
    @someonetyping Pƙed 7 lety

    I've tried creating a pushbutton synth using the tone function, but the tone only seemed to play after releasing the pushbutton. Is there any way around this?

  • @cadillacescalade5428
    @cadillacescalade5428 Pƙed 3 měsĂ­ci

    Hi, could I use this for a bell sound with a 8ohm speaker?

  • @discoHR
    @discoHR Pƙed 5 lety +1

    Is there any tool out there which coverts an audio sample to an array of frequency-duration pairs for use with the tone function?

  • @Jared-vq8qg
    @Jared-vq8qg Pƙed 8 lety

    Is their any way to have more than one speaker playing at the same time when your using ultrasonic speakers. I think I have seen someone do something similar to that before, but I am not sure what steps they did to get to that result.

  • @ComandanteJ
    @ComandanteJ Pƙed 7 lety

    Does tone() work with regular "PC Speaker" .5w 8 Ohm speakers too? I guess it would be much quieter if it does...

  • @gekkougagrentninja6837
    @gekkougagrentninja6837 Pƙed 5 lety

    I need help please :(( I am trying this for my project. I already made a sketch for the piezo buzzer's sound but when I tried it with a 9V Battery, the patter doesn't work? Is there a way for it to work in 9V Batteries? Please I need help :((

  • @michaelcostello6991
    @michaelcostello6991 Pƙed 2 lety +1

    Could this be used for anti dog barking at 20KHz . What speaker/buzzer would be best for this ? What sound in db can it create

  • @shashankbhatta9786
    @shashankbhatta9786 Pƙed 4 lety

    are these buzzers waterproof?
    I want to use tham as mist maker by emitting ultrasonic sound.

  • @cadillacescalade5428
    @cadillacescalade5428 Pƙed 2 lety

    Anyway that I could get a bell sound like a railroad crossing sound ?

  • @andreamitchell4758
    @andreamitchell4758 Pƙed 6 lety

    ok but how do we make it useful? say i want to use keypad and have it emit a tone every time a key is pressed and not have the code interfere with the rest of the code?
    i am trying to make a garage door keypad with a keypad and relay and 2 LED's
    i want the pad to emit a tone every time a key is pressed and another tone if the code is wrong and yet another tone if it is wrong

  • @nirmalgurukothandaraman8200

    Sir can you help me in choosing resistors in circuit how to determine the ohms

  • @link9k
    @link9k Pƙed 3 lety +1

    great material! thanks for showing this! Appreciate your research on all specific details of the tone fn

  • @ESEG-bs1yp
    @ESEG-bs1yp Pƙed 8 lety

    well..I used passive buzzer but I don't if it's better than peizo buzzer.
    Thank u very much, u helped me :)

  • @captainkaveh1
    @captainkaveh1 Pƙed 6 lety +1

    Great Thank you, please upload a video how to create a sound like car horn sound.

  • @hindalkanderi3122
    @hindalkanderi3122 Pƙed 7 lety

    Hi!
    How can I make Arduino play a music note or a song?

  • @nazranzafran3807
    @nazranzafran3807 Pƙed 4 lety +1

    Thx

  • @Blinkation
    @Blinkation Pƙed 7 lety +14

    it's piezo not peizo, great tutorial btw, actually all your tutorials are great i watched them all and learned a lot.

  • @omkarkhade4602
    @omkarkhade4602 Pƙed 4 lety +1

    Great video..

  • @bagyofficial1083
    @bagyofficial1083 Pƙed 7 lety

    Hello.Can you help me?I have some problem.When I write :
    tone(peizoPin, 3000)
    and push verify button the aplication write to me :
    "tone"was not declared in this scope
    Can you help me?

  • @shashankbhatta9786
    @shashankbhatta9786 Pƙed 4 lety

    which model of piezo buzzer is that?

  • @noob-killer
    @noob-killer Pƙed 6 měsĂ­ci

    im using tone() without using pin 3 and 11, yet it still creates artifacts (the buzzer makes noise while not activated with tone(), and my led matrix's lights are dimmer and flicker at times). how to fix???

  • @rickmorenojr
    @rickmorenojr Pƙed 6 lety +1

    Great video. The video voiceover is only on the left speaker.

  • @BlazeTheCatMan
    @BlazeTheCatMan Pƙed 3 lety

    how do i use the random function with it? can you give help? :)

  • @iltonrotta
    @iltonrotta Pƙed 3 lety

    Can I use it to stop dog barking? thanks

  • @RanaRao_Chandrachur
    @RanaRao_Chandrachur Pƙed rokem +1

    *Best tutorial ever on the earth!!*
    BTW can u make the Chinese Cuckoo clock tone using Arduino?? 🙂 Because of how to make that "vintage Bell" sound and also the birds sound at the same time, I'm just confused, I mean the coding.. .🙂 I mean how I will know what frequency tone will be on for what seconds to generate the cuckoo sound?? that is my question!!

  • @robink.9459
    @robink.9459 Pƙed 6 lety +3

    4:23 "One Hert" ... lmao

  • @GanisChannel24
    @GanisChannel24 Pƙed 2 lety +2

    New subscriber♄

  • @centillion1684
    @centillion1684 Pƙed 2 měsĂ­ci +1

    Thank you

  • @thesloable
    @thesloable Pƙed 8 lety +1

    I'm following along your tutorials and I noticed that resistors were used in different ways. Sometimes voltage passing through, sometimes one end goes to the GND and sometimes one end is interrupting the flow and the other end goes to the GND. Is there any guideline/tutorial on how to use resistors in what kind of situation? Thanks.

    • @3dw3dw
      @3dw3dw Pƙed 8 lety

      Nice observation.
      it depends on what you are trying to accomplish.
      if you are using the resistor to limit current it will be in series with the load (like an led).
      otherwise it may be used as a pull up resistor to tie a pin to positive voltage or a pull down to tie a pin to ground ( used with buttons and switches to avoid pin float irregularities ).
      you should invest more in studying use of resistors. there are many clever tricks you will learn.

  • @andyhughes800
    @andyhughes800 Pƙed 7 lety

    how do i add a push button to this to make the tone start and stop when i want?

  • @wantafastz28
    @wantafastz28 Pƙed 5 lety

    Is there any way to make it do sound, instead of a tone? Such as saying the letter A, over and over again?

  • @bobogao6328
    @bobogao6328 Pƙed 5 lety

    Hi, i tried the same code and same pin. But duration does not work. I tried many times with different pins .please help!

  • @MyOwntuahur
    @MyOwntuahur Pƙed 5 lety

    nice

  • @shashankbhatta9786
    @shashankbhatta9786 Pƙed 4 lety

    waht happens if we dont use resistor?

  • @fbravo8686
    @fbravo8686 Pƙed 9 lety +1

    Nice! ..

  • @abhaykondru3570
    @abhaykondru3570 Pƙed 3 lety

    sir i used tone parameter its not working i mean iam not getting delay help me out sir please

  • @JimiTip
    @JimiTip Pƙed 5 lety

    Is the intro song an actual full length song? If so whats the name? Thanks

    • @programmingelectronics
      @programmingelectronics  Pƙed 5 lety +1

      The attribution link is at the end of the video. It was a remix of those tracks.

    • @JimiTip
      @JimiTip Pƙed 5 lety +1

      @@programmingelectronics thanks!

  • @razelldeguzman4176
    @razelldeguzman4176 Pƙed 8 lety +2

    i dont have 220 ohm resistor, can i use 560 ohm resistor?

  • @SemlerPDX
    @SemlerPDX Pƙed 5 lety

    "An easy way to make noise in the left audio channel when rendering a tutorial video" ;) Pro-Tip: assuming you already send your windows audio through a pro mixer like VoiceMeeter Potato -- tell the audio stream it's Mono, and it'll come out of both ears. Cheers!

  • @daletappy9327
    @daletappy9327 Pƙed 7 lety

    what frequency should i put to make a BUZZ sound?

    • @colewood8288
      @colewood8288 Pƙed 6 lety

      You need to sweep at a high frequency.
      For example: 800-1000Hz @ 120Hz will generate a buzz.

  • @MyBigThing2010
    @MyBigThing2010 Pƙed 7 lety

    just did this...super EASY! ...now my dog is pissed at me though haha

  • @AtomkeySinclair
    @AtomkeySinclair Pƙed 7 lety

    Do this:
    tone(peizoPin, 3000);
    delay(100);
    noTone(); [or what about tone(peizoPin, 0);] immediately turn off the tone
    delay(1000); [and now your tone doesn't overlap into the delay]
    So write a class/method or function called beeper(int pinout, int hz, int Tdelay);
    {
    tone(pinout, hz);
    delay(Tdelay);
    noTone();
    }
    - cheers -
    Now you can oscillate the oscillator so to speak without time corrections having
    to be calculated inline every single time you make the call to tone.

  • @diegop-s7943
    @diegop-s7943 Pƙed 6 lety +5

    What about the dental floss?

  • @kyleabril3856
    @kyleabril3856 Pƙed 4 lety

    Does it work on nano?

  • @sabrroemma
    @sabrroemma Pƙed 3 lety

    Dude im a german and i Unterstand it, pretty giod

  • @rabbythebeat
    @rabbythebeat Pƙed 6 lety +1

    how to make sound like ambulance siren using tone function

    • @IoTLearner
      @IoTLearner Pƙed 6 lety +1

      TRY THIS BRO :)
      void setup() {
      }
      void high(){
      for(int i=1000;i=1000;i--)
      tone(11,i,1000);
      delay(10);
      }
      void loop(){
      high();
      low();
      }

  • @mother-fng-bonswa3612
    @mother-fng-bonswa3612 Pƙed 6 lety

    why they didn't call it freq ..

  • @jono5891
    @jono5891 Pƙed 3 lety +1

    what is the dental floss for I'm so confused

  • @j0hmama
    @j0hmama Pƙed 4 lety +1

    how can I make notes?

  • @apinakapinastorba
    @apinakapinastorba Pƙed 7 lety +1

    "One hert" :D

  • @adilabusafa
    @adilabusafa Pƙed 4 lety +1

    ŰŁÙ‡Ù„Ű§ ÙˆŰłÙ‡Ù„Ű§ ÙˆÙ…Ű±Ű­ŰšŰ§.

  • @anonymoususer900
    @anonymoususer900 Pƙed 3 lety

    audio is only in left earphone and my earphones are not broken XD

  • @Anton-sz6ef
    @Anton-sz6ef Pƙed 5 lety

    Am I the only one that didn't knew that this even existed ?

  • @nikoslykouresis2275
    @nikoslykouresis2275 Pƙed 4 lety +1

    int piezoPin = 8;
    int del = 1000;
    void loop() {
    tone(piezoPin, 2500, 200);
    delay(del);
    del -= 20;
    }
    ...đŸ’„đŸ’„đŸ’„

  • @franctiekam3008
    @franctiekam3008 Pƙed rokem +1

    mississippi😂

  • @pacifiqueniyonkuru8447
    @pacifiqueniyonkuru8447 Pƙed 2 lety

    Hello can you give your email?

  • @planktonfun1
    @planktonfun1 Pƙed 3 lety

    2020 its not fantastic :(

  • @rupe82
    @rupe82 Pƙed 3 lety

    I have tinnitus that sounds like an 8800 tone.

  • @lioraharoni5747
    @lioraharoni5747 Pƙed 4 lety

    Man this is just so annoying that the sound of this video is Mino. It really hearts my ears.

  • @ayoubsbai6339
    @ayoubsbai6339 Pƙed 3 lety

    MAKE SOME NOISE, PUT YOUR HANDS UP IN THE AIR!!

  • @MikevomMars
    @MikevomMars Pƙed 3 lety

    My neighbours are breeders. Their children make enough noise 😑

  • @MyBigThing2010
    @MyBigThing2010 Pƙed 7 lety

    just did this...super EASY! ...now my dog is pissed at me though haha