Course Content
The Arduino UNO
In the following three lessons, you will get to know your microcontroller - the Arduino UNO. You will learn more about its history, its functions, and most importantly: how to power it.
0/3
The Arduino IDE
For beginners, the Arduino IDE (Integrated Development Environment) is usually the first choice – and for good reason. You can program all Arduino boards with it and manage libraries for sensors, displays, etc. It also features the "Serial Monitor," where you can output data and troubleshoot.
0/2
Your first sketch
In the following lessons, you'll get to know the basic structure of an Arduino sketch and write your own programs. Let's get started!
0/2
The Serial Monitor
Now let's turn our attention to the Serial Monitor – a feature of the Arduino IDE that you will use in virtually every one of your projects.
0/2
Variables
No programmer can avoid variables. In the following lessons, you'll learn what types there are and what you can do with them.
0/3
Controlling an LED
Now it's time for more hardware! In the next lessons, you'll connect an LED to your Arduino. You'll first turn it on and off with a button. After that, you'll build a dimmer to control the brightness of the LED.
0/6
Lie Detector
Discover the entertaining side of electronics by building your own simple lie detector with your Arduino. This fun project uses basic components to measure skin resistance changes when someone might be telling a fib, perfect for adding some playful suspense to your next gathering with friends.
0/1
There’s music inside!
Your Arduino can do much more than "just" make LEDs shine at different brightness levels. For example, it can make music. In the following lesson, you'll learn how to use a piezo buzzer and coax some charming tones out of it.
0/3
A Theremin with Ultrasound
Do you want to make a bit more music? In this lesson, you'll build a theremin that you operate with your HC-SR04 ultrasonic sensor. You move your hand toward and away from the sensor - your Arduino calculates the pitch of the tones from the distance, which are then played through your piezo buzzer.
0/5
The Sound Sensor
Ready to explore how your Arduino can respond to sounds? In this lesson, we'll connect a sound sensor to your Arduino and learn how to make it respond to both digital noise detection and analog volume levels.
0/1
Build an Alarm System
In this project, you will build your own alarm system. It consists of three components: the sound sensor, which you have just learned about, the active piezo buzzer, and the RGB LED.
0/2
The DHT11 Temperature Sensor
Let's move on to another component that you'll certainly use in many projects: the temperature sensor. In this case, the popular DHT11, which can measure not only temperature but also humidity.
0/3
Arduino Course for Beginners

In this lesson, you’ll learn how to connect the sound sensor (KY-037) and how to process sounds both in analog and digital form with your Arduino UNO.

Structure of the Sound Sensor

The most important components of the sound sensor you’ll learn about here are: the microphone, a comparator (in this case the LM393, which compares two voltages), and a potentiometer (to adjust the threshold value). You connect the sensor using at least 3 of the 4 pins – anode, cathode, analog and/or digital output.

Sound Sensor on Arduino

 

Connection to the digital output

You can connect the sound sensor to your Arduino in two ways – analog or digital. The digital connection is useful when you want to trigger something as soon as a loud noise is detected. This could be, for example, a knock on the door, or a bang. Here’s how to connect your sensor:

Geräuschsensor am Arduino

 

Power your sensor using the pins + and G (for Ground, or minus) and connect the digital output (DO) to digital pin 3 on the Arduino. Next, connect the analog output (AO) to pin A1 on the Arduino. And that’s it.

___STEADY_PAYWALL___

Now copy the following sketch and upload it to your Arduino UNO.

const int sensor = 3;
const int led = LED_BUILTIN;
int noise  = 0;

void setup() {

pinMode(sensor, INPUT);
pinMode(led, OUTPUT);
Serial.begin(9600);

}

void loop() {

noise = digitalRead(sensor);
Serial.println(noise);

if (noise == 1){
  digitalWrite(led, HIGH);
}else{
  digitalWrite(led, LOW);
  }
}

 

If the internal LED of the Arduino is now constantly lit, it means that the sensor is continuously detecting a sound. Now take a small screwdriver and turn the screw on the potentiometer to the left – until the LED goes out.

Make a loud noise directly next to the microphone – for example, snap your fingers. The LED should light up briefly. If not – turn the screw slightly to the right again. With a little sensitivity, you will find the right fine adjustment. You can also track in the Serial Monitor whether the sensor detects a sound: in “silence” you will see a zero there, and a 1 when there is a sound.

And now the analog output

When you connect the sound sensor in analog mode, you get real-time feedback on the volume. For example, you can make an LED light up as soon as a volume you determine is exceeded.

You have already connected the analog output (AO) of the sensor to your Arduino. Now upload the following sketch.

const int sensor = A1;
const int led = LED_BUILTIN;
int noise  = 0;

void setup() {

pinMode(sensor, INPUT);
pinMode(led, OUTPUT);
Serial.begin(9600);

}

void loop() {

noise = analogRead(sensor);
Serial.println(noise);

if (noise > 200){
  digitalWrite(led, HIGH);
}else{
  digitalWrite(led, LOW);
  }
}

 

To better track the volume, start the Serial Monitor and observe the sensor values there. Again, some fine adjustment is necessary. Set the potentiometer so that you see values in the serial monitor that are slightly below 200. Now, if you make a noise that is loud enough for the value to shoot above 200, the internal LED of the Arduino will light up.

So you see, it’s not enough here that a sound is detected. This sound must also be loud enough to turn on the LED.

In the next lesson, you’ll build an alarm system with the sound sensor. You will represent the volume with an RGB LED, and as soon as a certain volume is exceeded, an alarm signal will sound from the piezo buzzer.

We don't track you. Enjoy your cookies while making awesome projects!