Assignment 2a

Hello everyone!

I will explain how you can use your potentiometer to control your buzzer’s volume!

You can combine the Assignment 2b with this one and build your own sound detection experiment!

Note:  If you are just getting started with Arduinos for the first time, you probably should begin on this page:  https://cansarlak.wordpress.com/set-up-arduino/

Step 1.

Let’s begin with the hardware side. We need to connect our potentiometer, button and buzzer to our board. You do not need to do that if you have not break up your sensors and the Arduino board from the initial Printed Circuit Board (PCB).

If you have already broke it up, you can use the grove cables to connect sensors to the board. The most important thing is to make sure the ground pin of the sensor goes to the ground pin of the board and they are connected by a black line. This is how I connected my potentiometer to my board.

Ground pins are connected by a black wire

Step 2.

Now, we need to download an Arduino library named Volume to help us control the volume and the frequency of the buzzer. Here is a link to the github page for the library :

Although the Github page explains what to do, I will still try to explain you the steps to download it and I will share my Arduino code with you at the end.

Step 3.

The first step is adding the library to your Arduino. Here is one way how to do it:

Sketch –> Include Library –> Manage Libraries

Manage libraries

Then type ‘Volume’ and look for a library created by Connor Nishijima.

Volume by Connor Nishijima

Install this one and close your Arduino IDE and reopen it.

Step 4.

Here is a screenshot from the Github explaining how to use this library!

How to use Volume library

Side note: please don’t forget to use vol.delay() instead of delay().

Step 5.

Since, we have the library ready, we can start coding! I will keep it very simple and add comments to my code. I recommend using this code and alter some pins as necessary and test out that your system works.

Step 6.

Now, you are successfully controlling the volume of your buzzer with a potentiometer! Here is a video of me doing it.

Now, you can combine this code with Assignment 2b and create your own sound detection test!

Take care!

Design a site like this with WordPress.com
Get started