Bird Sound Generator Circuit using Arduino
This is the schematic diagram of the birds sound generator. Connect 1 NPN transistor BC547, emitter pin of this transistor is conned with the 5V supply and a 10K resistor is connected with Ground to pin no 2 of Arduino. Connect A push button switch between the pin no 2 and 5v VCC supply. A speaker is connected with the collector of BC547 and Ground.Â
Arduino Program for Birds Sound Generator
int buzzer = 12; int butt = 3; int count = 10; int count2 = 5; int i; void setup() { Â // put your setup code here, to run once: pinMode(butt,INPUT); pinMode(buzzer,OUTPUT); } void loop() { if(digitalRead(butt)==HIGH){ Â Â Â while(count2 >0){ for( i = 300; i>0; i--){ Â Â digitalWrite(buzzer,HIGH); Â delayMicroseconds(i); Â digitalWrite(buzzer,LOW); Â delayMicroseconds(i); Â } delay(100); Â Â Â count2 = count2 -1; Â Â Â Â Â } Â Â Â Â Â count2 = 5; Â Â Â Â Â Â Â Â while(count >0){ Â Â Â for( i = 0; i <300; i++){ Â digitalWrite(buzzer,HIGH); Â delayMicroseconds(i); Â digitalWrite(buzzer,LOW); Â delayMicroseconds(i); Â } Â Â Â count = count -1; Â } count = 10; for( int i2 = 300; i2>0; i2--){ Â digitalWrite(buzzer,HIGH); Â delayMicroseconds(i2); Â digitalWrite(buzzer,LOW); Â delayMicroseconds(i2); Â } delay(400); Â Â while(count2 >0){ for( i = 300; i>0; i--){ Â Â digitalWrite(buzzer,HIGH); Â delayMicroseconds(i); Â digitalWrite(buzzer,LOW); Â delayMicroseconds(i); Â } delay(400); Â Â Â count2 = count2 -1; Â Â Â Â Â } Â Â Â Â Â count2 = 5; Â Â Â Â Â Â Â Â while(count >0){ Â Â Â for( i = 0; i <300; i++){ Â digitalWrite(buzzer,HIGH); Â delayMicroseconds(i); Â digitalWrite(buzzer,LOW); Â delayMicroseconds(i); Â } Â delay(100); Â Â count = count -1; Â } count = 10; for( int i2 = 300; i2>0; i2--){ Â digitalWrite(buzzer,HIGH); Â delayMicroseconds(i2); Â digitalWrite(buzzer,LOW); Â delayMicroseconds(i2); } } }
 Video
Also Read
-
Single Touch ON OFF Switch Using 555 And 4017
-
Multi-Pattern LED Chaser
-
Arduino Remote control AC Dimmer
-
Distance Measure Using Ultrasonic Sensor
-
Delay ON Timer circuit using transistor
-
What is NOT gate (Inverter)