Arduino Tutorial 24: Understanding Passive Buzzers

preview_player
Показать описание
You guys can help me out over at Patreon, and that will help me keep my gear updated, and help me keep this quality content coming:

In this lesson we show you how to introduce sound into your Arduino project using a Passive Buzzer. The advantage of a passive buzzer is that you can control the tone by adjusting the rate at which you switch it on and off.

You can get the kit I am using for this series at the following link:

You can follow these lessons on our WEB site HERE:

You can also follow there lessons at our WEB site. This lesson is HERE:

#Arduino
Рекомендации по теме
Комментарии
Автор

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!

borymcpherson
Автор

Those beeping noises made my bird go absolutely bonkers 😅.

henderic
Автор

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).

Sheredo
Автор

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

tashadurrahman
Автор

Hey paul! Really loving this series. I'm not sure if your musically inclined at all, but as a musician myself is trying to get into electrical engineering, the reason those first few buzzes you were making "sound like music notes" as you put it is because they actually ARE musical notes! When you were tinkering around with the delay time and setting it fro my 1ms to 2ms and 3ms and so on, you are actually creating what's called an Overtone Series of notes! It's one of the fundamental Bridges between sound waves and our modern understanding of music. You may have already known this, but I figured I would point it out as a shout out to any other musically inclined engineers!

dancorwin
Автор

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.

mse
Автор

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.

simontopley
Автор

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.

carlos
Автор

Math has never been my strongest skill! But after playing with this circuit and tweaking the formula numerous times, I have a much better understanding of what's happening! Thanks Paul!!

gilnasty
Автор

Mr.McWhorter I am very thankful that your channel popped up in my Youtube 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
Автор

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.

RahulMishra-ovnr
Автор

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.

octogintillion
Автор

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.

Doodad
Автор

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.

jstro-hobbytech
Автор

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!

FF
Автор

Paul you are brilliant and I went way over the top with the homework built a 9 button tactile switch keyboard in the key of A. Icalculated for major triads for A D and E major 3 rows for A C# and E 2nd row D F#.... and E G
A microsecond delay off 2240 for A . So C# delay for mark and space would be 12th root of 2 = 1.0596 raised to the power of 4 and inverted and multiplied by 2240. The idea of for this concept came from 1976 when a guitar student built a guitar but equally spaced the frets 1 inch apart absolutely unplayable. I did not know the equation. He was not happy and smashed the guitar to pieces outside my flat. Well move forward to 2019 and I solved the conundrum (from first principles without using the internet) as above but instead of 2240 delay. The 4th fret position of A is string length is 25 inches x 1/ (12th root of 2 raised to the power of 4 x 110 hz )

MardinBodley
Автор

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<duration;i++){
digitalWrite(outPin1, HIGH);
delayMicroseconds(note);
digitalWrite(outPin1, LOW);
delayMicroseconds(note);
}
delay(pause);
}

void loop() {
note(semiquaver, c, dt);
note(semiquaver, d, dt);
note(semiquaver, e, dt);
note(semiquaver, f, dt);
note(quaver, g, dt);
note(quaver, g, dt);
note(semiquaver, a, dt);
note(semiquaver, a, dt);
note(semiquaver, a, dt);
note(semiquaver, a, dt);
note(crotchet, g, dt);
note(semiquaver, a, dt);
note(semiquaver, a, dt);
note(semiquaver, a, dt);
note(semiquaver, a, dt);
note(crotchet, g, dt);
note(semiquaver, f, dt);
note(semiquaver, f, dt);
note(semiquaver, f, dt);
note(semiquaver, f, dt);
note(quaver, e, dt);
note(quaver, e, dt);
note(semiquaver, g, dt);
note(semiquaver, g, dt);
note(semiquaver, g, dt);
note(semiquaver, g, dt);
note(minim, c, dt);
}

rakowumusic
Автор

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.

robertnelson
Автор

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.

damonbostrom
Автор

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

danwolfe