Introduction: Arduino YL-44 Buzzer Module

About: Hello, My name is Samuel, I am a student. I love micro controllers like arduino, they are my favorite interest. I also do geocaching, a worldwide treasure hunt game. I hope you enjoy my instructables! Samuel

Welcome to this tutorial!

So about a time ago I sat and looked around at my favorite site for ordering all kinds of arduino sensors, boards and much more. You might already have guessed it, but I am of course speaking about I just was looking and an actuator got my eyes. It was a buzzer module which was great for a future project. You can for example make it buzz every time you start your program. Although once I got it home, I was not really prepared for how to deal with this new unit. This might sound kind of stupid, but I am just a newbie to arduino. Got my genuine ardunio UNO for about a month or two ago, so bare with me.

After searching google, contacting seller and searched on google again, I did not find a solution. Then finally the seller provided me with what I needed, a square wave.

Now, I am going to show you how to connect this module and speak with it, sorry, make it understand my crappy code.

Step 1: Parts

Start by getting the required parts:

YL-44 buzzer (1$)

Any arduino board really (3-15$ depending on which one you get)

A couple of jumper wires (2-3$)

Step 2: Connections

Notice that I am using the arduino MEGA, but you can use any board you would like, for example, this code works on both the UNO and the Nano.

Your connections should be like the pictures and as following:

VCC -> Arduino 5V

I/O -> Any arduino PWM pin (I used 3)

GND -> Arduino GND

Step 3: Your Code

Now your code is easy as ABC, although we will create our own fast function to interact more easily.

This code worked great for me without any errors, enjoy!

Refer to Comments for explanation

//Code written by Samuel.

int buzzerPin = 3; //Define buzzerPin

void setup() { pinMode(buzzerPin, OUTPUT); //Set buzzerPin as output beep(50); //Beep beep(50); //Beep delay(1000); //Add a little delay


void loop() { beep(50); //Beep every 500 milliseconds delay(500); }

void beep(unsigned char delayms) { //creating function analogWrite(buzzerPin, 20); //Setting pin to high delay(delayms); //Delaying analogWrite(buzzerPin ,0); //Setting pin to LOW delay(delayms); //Delaying }

Step 4: Finished

Now I hope this helped you, and that your YL-44 is working now. Thanks for reading and as always, please favorite and subscribe for more tutorials.