Arduino Tutorial 24: Understanding Passive Buzzers

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ก.ย. 2024

ความคิดเห็น • 407

  • @borymcpherson9759
    @borymcpherson9759 4 ปีที่แล้ว +143

    Boy I had a hard time with this session! I am 71 years old and about half deaf and I could just barely hear any of the tones from the passive buzzer. I just kinda had to take your word for this one. Hope I can do better on the next lesson. I am really enjoying have somethinge to do while being shut-up in my house, due to this virus. Thanks for your time and effort!

    • @BRP42
      @BRP42 3 ปีที่แล้ว

      The pickup on the microphone wasn’t great.

    • @arlo4051
      @arlo4051 3 ปีที่แล้ว +11

      Consider yourself lucky, with Tinnitus I get to hear the passive buzzer full volume, 24/7, with it turned off, in a drawer. As for the buzzer on the bread board can't get it loud enough to hear over the one in my head.

    • @ayushmanjain4008
      @ayushmanjain4008 3 ปีที่แล้ว +3

      Just slightly touch the buzzer and do not cover the top. You would be able to feel the tone

    • @MaxRelativo
      @MaxRelativo 3 ปีที่แล้ว +2

      Congrats, Bory! I think most of the guys of your age should be so pro-active!

    • @frankswift5119
      @frankswift5119 3 ปีที่แล้ว +2

      I'm in my seventy's and I cannot hear any of the sounds but my wife can.

  • @Sheredo
    @Sheredo 10 หลายเดือนก่อน +8

    Hi Paul, great lesson as always!
    In case someone, like me, is watching only now, 2 things:
    1) Just to make sure I did the equation correctly, I printed the value of both my tone and my potval, exptecting that:
    -If potval=0, then tone=60.
    -if potval=1023, then tone=10.000
    Initially I had problems 'cause when potval was equal to 1023, my tone was something like 9.670
    Then I realized that I set the tone as an INT instead of a FLOAT!
    In the video you did the same, but withot the serial monitor I think you didn't realize this.
    Changing the tone into a FLOAT made everything right.
    2) Even though my math was correct, the tone I was hearing seemed a lot different than yours.
    I discovered that it was due the serial.print I put in the code.
    Reading the comments of this video, I discovered that I could keep the print if I changed the baud rate of the serial monitor into something higher! (1.000.000 was the minimum to not have distortion).

    • @simpjkee
      @simpjkee 5 หลายเดือนก่อน +1

      I was having all these issues as well.

    • @simpjkee
      @simpjkee 5 หลายเดือนก่อน +1

      I tried this again tonight. With the higher baud rate it sounds much better, but it still sounds very distorted for me. It sounds like something an experimental prog rock band would do like Pink Floyd or something. It's doesn't sound anything like a tone a flute or something would make.

    • @MarvelBi
      @MarvelBi 4 หลายเดือนก่อน +1

      Dude thank you so much I thought it was just ne

  • @tashadurrahman
    @tashadurrahman 4 ปีที่แล้ว +28

    I did the the homework assignment and it went perfectly well! YAAYYYYY!

  • @m00se22
    @m00se22 4 ปีที่แล้ว +23

    I was able to make a little alarm and authentication circuit depending on whether the user enters a correct password or not using the serial monitor. Thanks for putting this information out there! With what I've learned from you, I feel comfortable taking on my own projects more so than before with Arduino.

  • @simontopley4771
    @simontopley4771 10 หลายเดือนก่อน +1

    Confess, i did struggle with this one somewhat, i get stuck on the maths, working out these formulae at my age isn't so easy.
    Thanks again.

  • @kananabdlyv
    @kananabdlyv ปีที่แล้ว +8

    Mr.McWhorter I am very thankful that your channel popped up in my TH-cam recommendations. I was looking for a good Arduino teacher, and in a short period of time I found you. Although I had a great experience with programming before learning Arduino, your videos really helped me to actually visualize the process happening behind my code. I carefully listen to your homeworks, and more importantly, do not cheat :) I especially liked this lesson's homework (very enjoyable). Thank you for everything so far.

    • @kananabdlyv
      @kananabdlyv ปีที่แล้ว +1

      Also thanks for liking my comment 🙏

    • @S24W2
      @S24W2 ปีที่แล้ว

      Me too 😊

  • @RahulMishra-ov4nr
    @RahulMishra-ov4nr 2 ปีที่แล้ว +3

    This is the first time I didn't do the project on my own but later realized I could've done it if I tried harder. Great videos keep up the good work.

  • @236Doodad
    @236Doodad 3 ปีที่แล้ว +1

    1:11 It's actually silicone dielectric potting and not black tape on the bottom of the active buzzer. Only pointing this out in case someone wants to know this; I'm not just being a pedantic jerk for the sake of it. Loving the series so far, I've learned so much.

  • @jstro-hobbytech
    @jstro-hobbytech 3 ปีที่แล้ว +5

    figured it out! most personally rewarding lesson yet. thank you so much Paul, you have no idea what these classes are doing for my mental health.

    • @paulmcwhorter
      @paulmcwhorter  3 ปีที่แล้ว +19

      Actually, it is incredibly good for mental health to create something. Build something, grow something, cook something, make something. All incredibly healthy. I think a lot of people on lock down are binging on Netflix, silly cat videos, and inappropriate internet content, and really think it is driving people into depression and mental illness.

  • @octogintillion
    @octogintillion ปีที่แล้ว +1

    I got the formula right, but I did it way less elegantly. 😅The way I thought it out is that you have to go from potVal=0 to tone=60, and the only way to do that is to add 60 to 0. Then if you would continue with the 10000/1023 like we did previously to get tone=10,000 for potVal=1023, you would actually end up with 10060 since you added 60 before. So I just subtracted 60 from 10,000 to get the value to divide by 1023.
    I love that you show the "right" way to solve problems like this! Keep up the great work.

  • @rakowumusic5143
    @rakowumusic5143 2 ปีที่แล้ว +3

    Such a great content. I have already learned so much about the circuits. For those who like to make music :)
    int outPin1 = 13;
    int c = 472;
    int d = 420;
    int e = 375;
    int f = 353;
    int g = 315;
    int a = 280;
    int b = 249;
    //delay
    int dt = 100;
    int minim = 2000;
    int crotchet = 1000;
    int quaver = 500;
    int semiquaver = 250;
    void setup() {
    pinMode(outPin1,OUTPUT);
    }
    void note(int duration,int note,int pause){
    for(int i=0;i

    • @rakowumusic5143
      @rakowumusic5143 2 ปีที่แล้ว +1

      (I have also made pirates of the caribbean :D)

    • @XHuang-hv5cj
      @XHuang-hv5cj 2 ปีที่แล้ว

      Nice work! how long did this take you?

    • @itimariu
      @itimariu หลายเดือนก่อน

      Thank you :) I downloaded and tried it.

  • @426F6F
    @426F6F ปีที่แล้ว +3

    That formula took me like 10 mins to work out on my own 😅 I like this form of logical thinking though, it's good practice!

  • @Anonymous-yy5qr
    @Anonymous-yy5qr 3 ปีที่แล้ว +1

    The satisfaction that I get after doing your assignment without your help is immeasurable ❤️

  • @robertnelson1802
    @robertnelson1802 3 ปีที่แล้ว +2

    I used variable for buzzH, buzzL, potH & potL (all integers adn it still seemed to work) then used a variable based equation. I also put print statements in the loop but had to take them out as they were causing the tone generator to just click. Took me a little while to realise that it was the print statements that were doing that. Keep up the great work - loving the course.

    • @JohnB-r6c
      @JohnB-r6c ปีที่แล้ว

      Wondering why with a delay after the print code (Serial.print(); with delay after creates only clicks?? Without delay, no clicks! delays of 500, and 1000 ms. the clicks occur.

  • @njsk8rdan
    @njsk8rdan ปีที่แล้ว

    I am having fun going along with these videos. When you said "that's annoying I am going to unplug it" I said "that's why I added a 'while(potVal>1000)' statement. Wanted to make sure I could get to somewhere on the potentiometer where it wouldn't make any sound. 🤣

  • @jasonbrown2674
    @jasonbrown2674 11 หลายเดือนก่อน +1

    I got it! Amazed myself. Thanks Paul, great lesson 👍

  • @danwolfe7665
    @danwolfe7665 3 ปีที่แล้ว +5

    Loved the homework assignment, really made me think and do a little math. I did it opposite mathmatically so my equation was Y=-9.7165(X)+10000

  • @carlos2004
    @carlos2004 4 ปีที่แล้ว +48

    for anyone doing the Serial.println(potVal) command, i think it messes up the timing for the tones. even when using numbers and not using the potVal, i couldn't get mine to work. but as soon as i deleted the println command, the tones worked perfectly with value, and the potVal.

    • @mengkin5836
      @mengkin5836 4 ปีที่แล้ว +14

      heyy, i had this problem too and i found out its due to the baud rate, as you increase the baud rate the sound will get better, i was shocked too when i finally found out

    • @TheKverbeeck
      @TheKverbeeck 4 ปีที่แล้ว +5

      Thank you Meng and Carlos, that solved the issue i had. Printing more text (data) per line deforms the tones even more.
      String msg = "Delay (Tone) is: ";
      Serial.println(msg + buzzTimepot);
      So i changed the baudrate to 2000000 and now all is well.

    • @joeb.fromsydneyaustralia5313
      @joeb.fromsydneyaustralia5313 4 ปีที่แล้ว +1

      I had the same problem... getting rid of the Serial fixed it.

    • @trakeC
      @trakeC 4 ปีที่แล้ว +12

      I had the same issue. And just fyi instead of deleting your code just go through and add // in front of the lines of code you are unsure about instead of deleting it. That will make it a note and not part of the process. This way you can verify an action before fully acting on it. It's a common practice in code troubleshooting. Other languages have different commands but in this case its //

    • @chrisjohnson6765
      @chrisjohnson6765 3 ปีที่แล้ว

      A good debugging process for this is to use the // comment lines in front of the suspect line to test it without deleting it.

  • @TMRu22311
    @TMRu22311 3 ปีที่แล้ว

    This was a fun lesson, reminded me of the "Library Tormentor" project I did in high school many years ago (1986). I added a switch to the buzzer to turn it on/off and my cats thanked me for it :D

  • @muhammadrafiqulislamkhan6994
    @muhammadrafiqulislamkhan6994 3 ปีที่แล้ว

    Few day I busy with my room construction resetup that is why I can not attend your lesson but I am back. And would say you are a Messaih for me. I do not understand why I understand your all words so easily. What is the reason? I have tried another Arduino video but as you no one for me. You are a perfect teacher. Day after day overwhemingly I just watch and learn from you. You are such a kind teacher. Thanks for you. God bless you.

  • @hasan-motam
    @hasan-motam ปีที่แล้ว +1

    This assignment helped me to understand passive buzzers. Thanks Paul.

  • @erikburman530
    @erikburman530 2 ปีที่แล้ว

    Holy Moly! At 61 years of age this is the first time since high school algebra that I've truly understood how to apply the equation for a straight line. That sad little equation has been lying dormant in some cobwebbed recess of my mind until today.

  • @stefannilsson7692
    @stefannilsson7692 7 หลายเดือนก่อน

    Thanks for the good examples with different calculations. They help very well. Thank you very much for that

  • @the_real_sauce_boss
    @the_real_sauce_boss 2 ปีที่แล้ว

    This was my favorite lesson so far, I struggled trying to make sure that the delaytime never dropped below 60, but the coffee helped me get through it! Thank you so much for these videos, they make it so much easier for beginners like me to learn. I enjoy them so much I spent 8 hours watching your videos yesterday!

  • @StefanEckhardt-y6r
    @StefanEckhardt-y6r ปีที่แล้ว +2

    Hello Paul, I tried the excercise on my own, as you recommended....but got a difference in solving the excercise. You said....if you turn the potentiometer to the left, have a delay of 10.000 microseconds....to the right 60 microseconds? Right? If yes, to the potentiometer to the left will return a potValue of 0. So the combination of x and y will be: if the potValue will be zero, the delay should be 10.000 microseconds...and vice versa to the right....potValue 1023 will return a delay of 60. The equation will then be different: y=-9,7165+10.000.
    If I misunderstood your instructions....nonetheless a big thanks, because the result was: I LEARNED IT!! Best regards!

  • @techbymo
    @techbymo 2 ปีที่แล้ว

    I hadn't done math in a long time and this homework assignment shook some rust off of my brain but glad I could do it on my own with some minor issues haha

  • @michaeljenkins2345
    @michaeljenkins2345 3 ปีที่แล้ว +1

    The Elego kit is a wonder in packing engineering and a physical paradox all in one! Items are packed so full of stuff and yet so neatly, but once you remove items, you'll never get them all back in the way it was. I have used a separate tool tray that is now full, as well as the Elego kit tray which is somehow still full! Mind blown!

  • @damonbostrom6857
    @damonbostrom6857 7 หลายเดือนก่อน

    I'm really getting a lot out of this series! I've worked through each tutorial so far. Thank you for producing this class! I hope that you will cover midi compliance eventually.

  • @henderic0
    @henderic0 3 ปีที่แล้ว +29

    Those beeping noises made my bird go absolutely bonkers 😅.

    • @itimariu
      @itimariu หลายเดือนก่อน

      Heh, I was joking that I built a cat-waker-up'er.

  • @paulrockwell9914
    @paulrockwell9914 3 ปีที่แล้ว

    I'm an experienced software guy (dusting off some long-dormant C coding) making the foray into circuits and microcontrollers now that I'm retired. Nice progression from the relatively short lesson 23 to lesson 24 with the passive buzzer. Love it when lessons have a logical progression.

  • @dubrocadidier4583
    @dubrocadidier4583 2 ปีที่แล้ว

    This was fun . I had the mathematics right but was confused between the delay and delayMicroseconds. It is NOW clear from your explanations . Thanks Paul , you are a blessing .

  • @robjameson7965
    @robjameson7965 4 ปีที่แล้ว +1

    'Passive', the "BLUE LED" of the buzzer world! Todays a special day! : )

  • @CarolMartinYoutuable
    @CarolMartinYoutuable 2 ปีที่แล้ว

    Math has always been a weak point for me but thanks to your lessons, I've been able to do this. I was able to do the homework without any help other than the comments below when I didn't get the right tones because of the print statements in my code and the low baud rate. When I removed the print statements (or at least narrowed them to one print statement) it all worked beautifully. Thanks again Paul

  • @InfectedCreations
    @InfectedCreations 3 ปีที่แล้ว

    If you try this don,t print anything to your serial monitor because this has influence on your tone. ✌👍 Another great tutorial. Boom.😊🤣

  • @iplayflute
    @iplayflute 3 ปีที่แล้ว

    Tip on how to boost the volume of your buzzer: tear out a piece of paper and place it above the buzzer, the larger diaphragm results in more vibration.

  • @berlinjackson1847
    @berlinjackson1847 3 หลายเดือนก่อน

    I just turned 71 also. Im with you on that

  • @michaeldrake2512
    @michaeldrake2512 2 ปีที่แล้ว

    These buzzer ones I definitely hooked a switch up to reduce how much buzzing I actually had to endure haha. Hot tip for anyone else.

  • @eurekaibanez3697
    @eurekaibanez3697 3 ปีที่แล้ว

    Thank you sir only all your works I did successfully to be operational.

  • @erygion
    @erygion 4 ปีที่แล้ว +2

    Great video Mr. Mcwhorter. My wife ran away! She doesn't like piezo speakers at all, thank you.

    • @MrJohnjamesboyd
      @MrJohnjamesboyd 4 ปีที่แล้ว +1

      So did my wife, but with my industrial deafness I didn’t realise it was working lol

  • @Traxonen
    @Traxonen 2 ปีที่แล้ว

    Really interesting video. I'm lerning fast and easyly! Thanks a lot!

  • @ErlankBru
    @ErlankBru 6 หลายเดือนก่อน

    This was a very cool assignment!🤠

  • @fetchfooldin3252
    @fetchfooldin3252 3 ปีที่แล้ว +2

    I've just learnt how to fuse between math and programs. I diiid the assignment before completing the video. But forgot +60 in the equation (-_-;)
    Thank you so muuuuch

  • @jasonford1
    @jasonford1 4 ปีที่แล้ว

    For extra credit, I looked up the tone() function and discovered it ranges from 31Hz to 4978Hz. I plotted tone on the y-axis and potentiometer values of 0 to 1023 on the x-axis. I then used y=mx+b to convert the potentiometer signal to a tone between 31Hz and 4978Hz with one exception. I made 31Hz == noTone(). Now my ears can rest! Time to pause having completed 19-24 and 48/49 today. It has been a great day of learning! I look forward to photoresistors and photodetectors next.

  • @syedibraheemzeeshan806
    @syedibraheemzeeshan806 ปีที่แล้ว +3

    It is so heart breaking that as more and more we go deeper in lessons, Views are also getting shorter. Very little people are commited :(

  • @stevemorgan3597
    @stevemorgan3597 4 ปีที่แล้ว

    Hi Paul. I like the way you teach. Good explanations and visuals. I learned a long time ago in calculus courses to draw diagrams and graphs because it helps with the math. Once the formulas are determined, it makes the programming so much easier. Thanks for all you do.

  • @zudzifudushzy
    @zudzifudushzy 2 ปีที่แล้ว

    That homework was super fun!
    I think you said 60 and 10000 in your assignment the other way around than in your solution, but that doesn't really matter :D
    I tried to work with as many variables as possible and added Serial.print with a high baudrate to have a look at the values. The high baudrate is to not mess up the timing of the tones.
    Here is my version of the homework:
    int buzzPin = 8;
    int buzzTime;
    float rightFreq = 60;
    float leftFreq = 10000;
    int potPin = A1;
    int potVal;
    void setup() {
    // put your setup code here, to run once:
    pinMode(buzzPin, OUTPUT);
    pinMode(potPin, INPUT);
    Serial.begin(2000000);
    }
    void loop() {
    // put your main code here, to run repeatedly:
    potVal = analogRead(potPin);
    buzzTime = ((rightFreq - leftFreq) / 1023 * potVal + leftFreq);
    Serial.print(potVal);
    Serial.print(" ");
    Serial.println(buzzTime);
    digitalWrite(buzzPin, HIGH);
    delayMicroseconds(buzzTime);
    digitalWrite(buzzPin, LOW);
    delayMicroseconds(buzzTime);
    }

  • @GraveGear
    @GraveGear 4 ปีที่แล้ว

    Completely forgot to plug everything into the equation after I found the slope. Was trying to convert with just "m"! Thanks for the video!

  • @krishamsub.subedichhetri5895
    @krishamsub.subedichhetri5895 3 ปีที่แล้ว +1

    I think instead of digital write if we analogwrite we can also use a potentiometer to vary the loudness of the buzzer, because the higher the voltage/Amplitude the louder the sound.

  • @ijlie
    @ijlie 3 ปีที่แล้ว

    Hi Paul, combined tutorial 18 and this one to have the buzz time asked for in the serial monitor. Gave me fast interaction and saved some upload time.

  • @ronaldjensen2948
    @ronaldjensen2948 3 ปีที่แล้ว

    The frequency you get out of his code is 1/(2*buzzTime2 * 1e-6). For example, if buzzTime2 is 80, the frequency is 6250 Hz.

  • @shvideo1
    @shvideo1 4 ปีที่แล้ว +3

    A. Very cool and fun project. Thank you for the math as well.

  • @alanford7933
    @alanford7933 3 ปีที่แล้ว

    Really good. I used Serial.println (with the good old trusty 9600 Baud rate) and realized that I was not starting at 60. Then went back and included it. Good to do the homework and pick up own mistakes.

  • @davidransier
    @davidransier ปีที่แล้ว +1

    I struggled a bit with this lesson. It turns out that I had three Serial.Print statements to help debug the resistor value versus the Buzzer timer value. I was outputting 60-10000 microseconds properly but it sounded awful - then I removed the print statements and all was good. Those dang print statements are s-l-o-www! It was a good debugging exercise!

    • @paulmcwhorter
      @paulmcwhorter  ปีที่แล้ว

      Yes print statements are really slow and will affect your timing on things.

  • @lloydbotway5930
    @lloydbotway5930 3 ปีที่แล้ว

    This works quite well. More fun: check out the tone() function, which does much of this automatically.

  • @pradeepdube1398
    @pradeepdube1398 ปีที่แล้ว

    Hi Paul, Looks like I got confused with the terminology of ALL THE WAY LEFT and ALL THE WAY RIGHT you used. I understood it like this
    1. delay = 10000 microseconds (when voltage V =0)
    2. delay = 60 microseconds (when voltage V = 1023)
    Good thing is this created a line with slope towards right which was little difficult to create the equation. had to recall my mechanical engineering lectures from university as well as go through your previous Math notes I took. I was able to get the equation finally. delay = (-9940./1023.)*(voltage-1023.)+60;
    I printed over serial monitor to check my math part and formula calculation Arduino is doing in the background. Got perfect 10000 delay at 0V and 60 delay at 5V (1023 in Arduino).
    Rotating the potentiometer sounded like a world war siren... LOL..

  • @Dieselfitter01
    @Dieselfitter01 5 ปีที่แล้ว

    Fantastic lesson on the passive buzzer. So much can be the influence on the buzzer with this kit. Oh BTW my AI parts started to arrive today, through your links that is. Case with fan, Micro card, Jetson Nano, Pi Camera, 110 power supply and the WiFi. I am expecting the Webcam tomorrow. The wireless keyboard and mouse were too far off for me to wait for so I will try what I already have and if that fails I will hit the local store. This AI Project is something I think everyone here would be interested in. Great content as always and look foreword to whats in store next.

    • @paulmcwhorter
      @paulmcwhorter  5 ปีที่แล้ว

      I will admit I have been pulling my hair out on the nano the last couple of weeks, and almost ready to give up, but think I got some stuff figured out today. Bleeding edge technology which means it is not all figured out yet. Really want to do a series on this now. I have gotten some pretty cool things going now.

  • @nobleforks8911
    @nobleforks8911 ปีที่แล้ว +1

    did the same thing with a LDR as well to show my 5YO(whom is very interested in the projects that I do), so he could play with it without ruining my pot(wouldn't be the first one he wrecked).

  • @dannycollins5698
    @dannycollins5698 ปีที่แล้ว +1

    Thank you!

  • @prussianblue222
    @prussianblue222 3 ปีที่แล้ว

    First, GREAT series. I am a hardware guy and learning to program is going well with your help. HOWEVER, it seems that timers in Arduino, maybe especially the older UNO (mine is 10 years old?) are really finicky. I was having lots of problems with this assignment and I had the serial monitor turned on so that I could see what was happening with all my values. Serial monitor seemed fine but the tones were jumping, not smooth. Was pulling my hair out until I turned off the serial monitor then Voila! It worked perfectly. Just something to watch for.

  • @billcrow5403
    @billcrow5403 4 ปีที่แล้ว +1

    Great video. I change the toneVal around and played with those

  • @danbishop4035
    @danbishop4035 4 ปีที่แล้ว

    I appreciate learning and practicing the math...I had a careless moment and i used a period in void setup "pinMode(potPin.INPUT);" instead of "pinMode(potPin,INPUT);" which generated an exit status 1 Error compiling for board Arduino Uno. Nothing a few moments of debugging couldn't cure.

  • @johnk2743
    @johnk2743 4 ปีที่แล้ว

    Today my "The Most Complete Starter Kit" arrived so finally I could use the buzzer! Up until now was able to use components that I already had. Great kit, should have bought this together with my first Arduino! Lot's of thing I collected earlier but this kit is something else!
    The icecoffee is not for me, I stick to the hot variant. No sugar, no cream and strong! My viewing binge from the first video up to this one was fun and very informative! The (hot) coffee, my impatience and holding my breath (and some shouting at the screen as well, I confess) made it an intesive journey. In these pandemic times it's fun to play around with this Arduino stuff (while learning as well) and the partial lockdown we're under (I'm from the Netherlands) makes it a great way to spend the time at home. Your coding standards I recognize from my early coding days with Clipper.
    Thanks a lot for your teaching, it's fun, informative and very well produced! I wonder what tools you use making your video's. Thank you so much Paul!

  • @aynursunagatullin7029
    @aynursunagatullin7029 3 ปีที่แล้ว

    I was doing the homework, and I was going good, but darn I forgot the +60! Anyway, this was fun here was my code!
    int buzzPin=7;
    float buzzVal;
    int potPin=A8;
    int potVal;
    void setup() {
    // put your setup code here, to run once:
    pinMode(buzzPin,OUTPUT);
    pinMode(potPin,INPUT);
    Serial.begin(9600);
    }
    void loop() {
    // put your main code here, to run repeatedly:
    potVal=analogRead(potPin);
    Serial.println(potVal);
    buzzVal=(-9940./-1023.)*potVal;
    digitalWrite(buzzPin,HIGH);
    delayMicroseconds(buzzVal);
    digitalWrite(buzzPin,LOW);
    delayMicroseconds(buzzVal);
    }

  • @louandpaulanickles7172
    @louandpaulanickles7172 4 ปีที่แล้ว +1

    I did my math a little differently in the homework, but got the same results. I did part of the calculation outside of the program then entered the quotient directly in the program. I used buzzVal=((potVal*9.7165)+60);. Tell me, what is the purpose of the decimal point after your whole numbers in the calculation?

  • @michaeljenkins2345
    @michaeljenkins2345 3 ปีที่แล้ว

    Well it seems I was at least part of the way through this lesson, but Im going to start back from scratch just to be thorough. Ive had 2 (two!) iced coffees today!

  • @fransvanenschot3286
    @fransvanenschot3286 2 ปีที่แล้ว

    Hoi Paul,
    i like the way you explain everything from this tutorial step by step, so it is to following for everyone.
    aim already an experienced user, but i still like the way you explaining everything way.
    For a basic course it is the perfect way to learning, but maybe it is also a good idea to make also an tutorial with the arduino together with ethernet and HTML language, and build it up step by step.
    Another good idea is an step by step tutorial Arduino together with a big oled display what can used as HMI .
    I think this are tutorials were advanced users are waiting for, especially when you teach it in the same way as this tutorial, a few lessons for connecting the ethernet board , html for LEDS, html, for sliders, html for displaying, html for graphics, etc.
    thanks in advance, and go further with the good work.

  • @jnorris8649
    @jnorris8649 ปีที่แล้ว +1

    I would’ve used the map() function for the tone & potentiometer value. Good algebra refresher, though.

  • @pierrick1705
    @pierrick1705 3 ปีที่แล้ว

    i had to go get a refresh on Khan Academy about Algebra, Linear equations & graphs but im right back!

  • @davebroster5560
    @davebroster5560 2 ปีที่แล้ว

    I noticed that when you set the assignment you wanted the Low tone (10000) to be with the pot to the left and the high tone (60) all the way to the right, so that the tone increases as you turn the pot clockwise.
    I achieved this with a slight modification to the equation as shown below:
    Original: toneVal = (potVal * ( 9940 .0/ 1023.0) ) + 60;
    Reversed: toneVal = 10000 - (potVal * ( 9940 .0/ 1023.0) );
    I also used two floats for my maxVal (10000.0) and minVal(60.0) and used these in my equation so I could easily play about with the range, below is my working code for the calculations:
    //Read In the Raw Pot Value
    potVal = analogRead(potPin);
    //Calculate the increment dictated by the range
    buzzInc = (maxVal - minVal) / 1023.0;
    //Now calculate the toneVal from maxVal, potVal and buzzInc
    toneVal = maxVal - (potVal * buzzInc);
    Hope this is useful for the other viewers

    • @abufunaisan2787
      @abufunaisan2787 ปีที่แล้ว

      this is the comment I've been searching for. I thought I was the only one that observed the discrepancies.

    • @Julia-xd8qw
      @Julia-xd8qw ปีที่แล้ว

      You're right, same method as you, in this case, toneVol=10000-9940./1023.*potVol; 60 is the highest tone, 10000 is the lowerst.

  • @theteenengineer7589
    @theteenengineer7589 5 ปีที่แล้ว +2

    Great content Paul!

  • @danielsaenz5570
    @danielsaenz5570 ปีที่แล้ว

    Great lesson! I think I prefer using the tone() function though, I was able to make so much different music notes with it! It was awesome!

  • @steveholt8991
    @steveholt8991 3 หลายเดือนก่อน

    Homework done without much problem.

  • @atulkallianpur7725
    @atulkallianpur7725 2 ปีที่แล้ว

    The tone generator for my doggy barking :D

  • @doverivermedia3937
    @doverivermedia3937 ปีที่แล้ว

    BOOM ! ... "I need you to.. " PROVE ! you've "READ THIS TILL THE END"
    Respond with "PhilVal" contents..... hehe.
    Boy this one I had to scratch my head. Didn't cheat ! but I had to refer back to my lesson 15, graph notes (dimmable LED+Pot). The starting at '0,60' was different though and I had to look on a maths web-site to recap how to deal with non 0,0 starting points (was around 20yrs ago I last did that haha).But easy, when you refresh. It's really satisfying to do these lessons Paul, and I totally subscribe to the method of "doing it for yourself" to learn. At the risk of sounding like a 'smart arse' (which I'm certainly not), would I be right in thinking your original HW task should be stating "All the way to the left is a tone of 60" (not 10,000), assuming all the way to the left is Anti-clockwise ie 'off' ) ? Interestingly, I did a serial.Print of the PotVal and ToneVal just to see that the equation worked before any of the audible stuff. The values seemed 'switched' from your homework instruction. (PhilVal="Fear not, I absolutely WILL keep doing the Maths & Physics !") ... My 'meddling' with adding the serial.prints I think screwed up the audible delays, so removed before completing the audible bit, which was also a good learning point. Great video, Thank you so much Paul. I'm now embarking on the next ... (senior guy, Phil from England)

  • @kennystewart7969
    @kennystewart7969 7 หลายเดือนก่อน +1

    Paul, I'm being honest here, I cheated with the maths, why? because it's been a long, long time since I was at school and did any real maths. I'm showing my ignorance here (only way to learn) but just googled that it and appears to be called a linear equation. So, algebra is now on my to-do list, no big deal as I look forward to that as well, keep the maths coming, trust me I understand why its needed. Cheers

  • @dougnash6316
    @dougnash6316 5 ปีที่แล้ว +1

    Very strange but I finally had to rewire the board in the exact same way and it worked properly. The board obviously got hung up somehow and resetting, rewriting and swapping didn't help. Sometimes you have to rebuild from scratch.

  • @Александр-р3э3м
    @Александр-р3э3м 4 ปีที่แล้ว

    Great lesson! Thanks, Paul for making them!
    P.S. I have done the assignment before watching you doing that

  • @persoonsaini4794
    @persoonsaini4794 4 ปีที่แล้ว

    Plz keep doing the good work. You are absolutely amazing.

  • @raviyadav-rc1br
    @raviyadav-rc1br 4 ปีที่แล้ว +1

    Sir please make videos on relay and wireless connection

  • @sugumarprabhakaran3378
    @sugumarprabhakaran3378 3 ปีที่แล้ว

    Hi Paul! I'm loving your series - thank you so much!. I bought myself an ELEGOO kit and have been following along. Just one thought: i think it would be great if you could make a video on the physics behind how the passive buzzer works. Thanks again,

  • @samhat41
    @samhat41 4 ปีที่แล้ว

    Very good lesson as always, keep up the great work!

  • @ericb20032000
    @ericb20032000 3 ปีที่แล้ว

    For anyone having problems with the math, I suggest looking into the map function.
    mappedValue = map(variable name to map, minVal, maxVal, newMinVal, newMaxVal)

    • @paulmcwhorter
      @paulmcwhorter  3 ปีที่แล้ว +2

      NO! For anyone having trouble with the math, I suggest LEARNING THE MATH. I teach how to do it in this and other lessons. Is is like saying, those who dont want to learn to program just copy and paste his code. This channel is about LEARNING and part of that learning, is learning how to do the math.

  • @richardstewart4135
    @richardstewart4135 4 ปีที่แล้ว

    Another Great Video!! the homework was a bit challenging, but it was worth it to get that buzzer to make that terrible noise. Up there with squeaking chalk on a board. ;). Anyway, thanks again for the educational lesson and I look forward to the next

  • @johnm4962
    @johnm4962 3 ปีที่แล้ว

    hi paul i feel like it would be to much to convert this into a metal detector circuit lol cool project thanks

  • @youssefshepl6892
    @youssefshepl6892 4 หลายเดือนก่อน

    I would like to confirm that in a linear equation, the independent variable, which in this case is time (timeT), should be placed on the x-axis, while the dependent variable should be placed on the y-axis. If there are any corrections or additional insights regarding this understanding, I would greatly appreciate your guidance.

    • @paulmcwhorter
      @paulmcwhorter  4 หลายเดือนก่อน +1

      That is correct.

  • @alicewang6342
    @alicewang6342 3 ปีที่แล้ว

    Paul, I love you demonstrate the math for us! I am in my 40’s with very limited math and physics foundation, it is important for me to understand where the numbers come from before I start coding! Btw, can I ask a very stupid question: how do you know 1023 (5V) is equal to 10000hz rather than other numbers?

  • @dcar1234
    @dcar1234 3 ปีที่แล้ว +1

    When you gave the home work originally did you say it backwards? You said all the way to the L you wanted 10K and all the way to the right you wanted 60? Would that not have been a negative slope?

  • @7dskei379
    @7dskei379 3 ปีที่แล้ว

    Here's a cool sounding one with the passive buzzer hooked up!
    int buzzPin = 8;
    void setup() {
    pinMode(buzzPin, OUTPUT);
    }
    void loop() {
    for (int i = 0; i < 100; i++) {
    buzzWithDelay(i);
    }
    for (int i = 100; i > 0; i--) {
    buzzWithDelay(i);
    }
    }
    void buzzWithDelay(int delayTime) {
    for (int i = 0; i < 1000; i++) {
    digitalWrite(buzzPin, HIGH);
    delayMicroseconds(delayTime);
    digitalWrite(buzzPin, LOW);
    delayMicroseconds(delayTime);
    }
    }

  • @neillaw2121
    @neillaw2121 2 ปีที่แล้ว

    I am still working through the tutorials. Sometimes 3 in a row, sometimes none for a few days.
    I have been searching the web for an answer to why ALL my sketches, interupt when connected to the PC. This passive buzzer program for example, I worked through it, i get the tone and periodically it stops and starts again. In the RGB the light goes out and comes on again. In the binary counter it would start, stop at some point, then start again. I also noted the busy LED on the UNO board flashing occasionally. So I believe it must be communicating with the PC, and halting the program while it exchanges data with the PC. If I disconnect from the PC and run off the 9V battery it doesnt happen.
    I also have trouble uploading from PC to the UNO board. I have to click quite a few times, I get the orange, COM port was busy quite a few times, then eventually it goes in, reinforcing my thinking on the COM chatter interferring with desired operations.
    Any tips on settings I can adjust anywhere to stop the interupts on running programs and uploads?

  • @PRR5406
    @PRR5406 2 ปีที่แล้ว

    This lesson is tough when I'm not wearing hearing aids!

  • @Idotry1
    @Idotry1 3 ปีที่แล้ว +2

    I am 72 and thought I could not hear the tones, turned out my pot would not work until I changed the int potPin A1 to float potPin A1 and "BOOM"

  • @426F6F
    @426F6F ปีที่แล้ว +2

    I wanted to print my tone in the Serial monitor but it only seems to be able to reach its highest when I use a high Baud rate and I have no idea why. Also, if I don't use the Serial monitor it sounds perfect. I guess the action of printing the value in the while loop introduced a tiny delay which distorts or lowers the frequency.

    • @samueltheprogrammer6145
      @samueltheprogrammer6145 ปีที่แล้ว

      yes, that is right, when you put "Serial.println()" in your code it slows down the speed of your Arduino a lot.
      Samuel

  • @markowens5446
    @markowens5446 ปีที่แล้ว +1

    can't wait to get to micro python

  • @billhall6673
    @billhall6673 7 หลายเดือนก่อน

    I was even yelling at you to put the semi-colon on equation line. lol 4 years later.

  • @mester.mechanic
    @mester.mechanic ปีที่แล้ว

    love you paul

  • @henryf.burger5957
    @henryf.burger5957 2 ปีที่แล้ว

    The kit arrived cost now $58 plus ship total of $63. After following instructions, it removed my present compiler/editor taking with it all my installed libraries. Does not show UNO R3 in the of devices, just UNO devices as before. It did install a USB drive.

  • @freetjen
    @freetjen ปีที่แล้ว

    After removing the Serial.println(buzzervalue) and adding the delay after digitalwrite Low, the sounds seems much better, but still not that high as in vid

  • @tameraziz2104
    @tameraziz2104 4 ปีที่แล้ว

    Thanks Paul.

  • @gabrielhamrle2779
    @gabrielhamrle2779 3 ปีที่แล้ว +1

    Is there a way to download music on arduino and played with passive buzzers?

  • @noahgeer3090
    @noahgeer3090 2 ปีที่แล้ว

    Paul: 'I CANNOT do math in my head... '
    Paul: '(In his mind) that sounded stupid...'🤔
    Paul: 'on camera...'
    Me: 'sounds like EXCUSES paul!'
    LOL🤫😂