Introduction: Electronic Air Buzzer

The Electronic Air Buzzer is an electronic instrument where your hand's distance from the table decides the tone to be played by the buzzer.

Step 1: MediaTek LinkIt One

I have just received my LinkIt ONE, which is a micro controller that includes everything (GSM, GPS, Bluetooth, audio pl, and more). Getting started with it was pretty easy, followed online tutorial provided on the manufactures website and there - it works out of the box with the Arduino IDE.

This project was basically trying it out, and check the PWN with a buzzer. It has a sonar that checks the hand's distance from it, and plays a tone based on the distance.

Step 2: Supplies!

  1. MediaTek LinkIt ONE
  2. HC-SR04 Sonar
  3. Buzzer (I took it out of an old toy)

Step 3: Wiring

Sonar:

  • Sonar Vcc connected to LinkIt ONE 5V Vcc.
  • Sonar GND connected to LinkIt ONE GND.
  • Sonar ECHO connected to LinkIt ONE Digital 11.
  • Sonar TRIGGER connected to LinkIt ONE Digital 12.

Buzzer:

  • One wire connected to LinkIt GND.
  • Second wire connected to LinkIt Digital 9 (PWN).

Step 4: Coding

Using the Arduino IDE use the following code (file is also included in the end):

#define SPEAKER_PIN 9

#define TRIGGER_PIN 12

#define ECHO_PIN 11

void setup() {

Serial.begin (9600);

pinMode(SPEAKER_PIN, OUTPUT);

pinMode(TRIGGER_PIN, OUTPUT);

pinMode(ECHO_PIN , INPUT);

}

int tone_ = 0;

void play() {

int i = 0;

while (i < 50) {

digitalWrite(SPEAKER_PIN, HIGH); delayMicroseconds(tone_ / 2);

digitalWrite(SPEAKER_PIN, LOW); delayMicroseconds(tone_ / 2);

i++;

}

}

void loop() {

long duration, distance;

digitalWrite(TRIGGER_PIN, LOW); delayMicroseconds(2);

digitalWrite(TRIGGER_PIN, HIGH); delayMicroseconds(10);

digitalWrite(TRIGGER_PIN, LOW);

duration = pulseIn(ECHO_PIN, HIGH);

distance = (duration/2) / 29.1;

if (distance >= 200 || distance <= 0) {

Serial.println("Out of range");

} else {

Serial.print(distance);

Serial.println(" cm");

Serial.println(distance/200.0 * 5);

tone_ = distance * 150;

play();

}

delay(50);

}

Step 5: Wrap Up

It works and it super nice :)

Next I'm going to add another sonar, so once sonar controls the tone, and second sonar the tempo.

Also adding couple of LEDs can make this project super cool.

Stay tuned for more :)

Aviv Mussali.