Arduino KY-012 Active buzzer module

From

Jump to: navigation, search

WARNING this page is a copy/past of a bad google translation so it might contain errors. If you see a error help us to make it better and log in and change it. Big thanks!

Arduino KY-012 Active buzzer module Sku 135036 2.jpg

Buy this sensor or kit.


Buzzer Module

This is a active buzzer so its easy in use. You just apply voltage to the buzzer and it makes sound. Disadvantage is that you can't determine the frequency of the sounds, for this you need a passive buzzer.

Schematic

Module pin - = GND Module pin S = +5V

Connection to Arduino

  • Arduino digital pin 8 --> Module pin S
  • Arduino GND --> Module pin -

Example code

//Example code KY012 active buzzer
int speakerPin = 8;
void setup () {
  pinMode (speakerPin, OUTPUT);
}
void loop () {
  analogWrite (speakerPin, 255);
  delay (50);
  analogWrite (speakerPin, 0);
  delay (10);
}