This Arduino Based Motion Dog Barking Alarm Circuit make dog sound when motion detects, it uses Arduino Nano, Pir sensor, Dog Sound Module, BC547 transistor, IC LM386 Amplifier Module and 8Ω Speaker.
When Pir senses human or animal move, then Arduino play dog bark sound to scare intruder, also this is simple and low cost security system.
Arduino Code:
int pirPin = 2; // PIR sensor connected to D2
int trigPin = 3; // BC547 base connected from D3
void setup() {
pinMode(pirPin, INPUT);
pinMode(trigPin, OUTPUT);
digitalWrite(trigPin, LOW);
}
void loop() {
int motion = digitalRead(pirPin);
if (motion == HIGH) {
digitalWrite(trigPin, HIGH); // trigger transistor ON
delay(5000); // play sound for 5 sec
digitalWrite(trigPin, LOW); // stop sound
}
else {
digitalWrite(trigPin, LOW); // keep off when no motion
}
}
Code Explanation:
- Pir sensor output connect to pin D2 of Arduino.
- when there is no motion then Pir is low.
- when motion detect then Pir is high.
- Arduino read this signal.
- if signal is high then Arduino send high to D3 pin.
- D3 go to base of BC547 transistor through 10k resistor.
- BC547 switch ON and connect play pin of dog sound module to GND.
- Through this it starts with dog sound playback.
- delay(5000) keep sound playing for 5 sec.
- after 5 sec the Arduino send low to D3, transistor goes OFF and sound stops.
- If Pir does not detect motion then D3 stays low and sound stay OFF.
Circuit Working:

Parts List:
| Components | Values | Quantity |
|---|---|---|
| Resistors | 10k 1/4 watt | 1 |
| Semiconductors | Arduino Nano | 1 |
| PIR Motion Sensor | 1 | |
| Dog Barking Sound Module | 1 | |
| IC LM386 Amplifier Module | 1 | |
| Speaker 8Ω from 0.25W to 2W | 1 |
Pir sensor watches the area and when someone moves then Pir sensor output goes high.
Then Arduino read this from D2 and Arduino then send high signal from D3 to Q1 BC547 transistor base; after that BC547 switches ON and connects dog sound module to play pin to ground.
Now dog sound module play dog bark sound and then sound goes to LM386 amplifier module and LM386 amplify sound and sends to speaker.
Further, speaker make loud bark noise and sfter some time sound stops and circuit waits again.
Furthermore, a USB connection or the 5V pin powers the Arduino.
Formulas and Calculations:
Following are the basic formula for Motion Dog Barking Alarm Circuit:
output power approx = (V^2) / (2 * Rload)
for 5V and 8ohm speaker power = (25)/(16) = 1.56W max theoretical
delay time in code = delay(ms) value
example:
- V is 5V
- Rload is 8 ohm
P = (5^2)/(2*8) = 25/16 = 1.56 watt approx
How to Build:
To build a Arduino Based Motion Dog Barking Alarm Circuit follow the below steps for connections:
- First, gather all the parts as shown in circuit diagram
- Next, Pir sensor Vcc to Arduino 5V, Pir sensor GND pin connect to Arduino GND and then pir sensor out pin connect to Arduino D2
- Now dog sound module Vcc pin connect to 5V, dog sound module GND pin connect to Arduino GND and dog sound module play pin connect to BC547 collector pin of Q1 transistor
- Also, BC547 base pin connect to Arduino D3 through 10k resistor and BC547 emitter pin to GND
- Then LM386 module input pin connect from dog audio out pin, LM386 module GND pin connect to GND and then LM386 module Vcc pin connect to 5V
- Finally, connect one end of 8 ohm speaker with the output connector of the LM386 amplifier module
Conclusion:
Overall, the Arduino-Based Motion Dog Barking Alarm Circuit scares thieves by playing a fake dog bark, also, this project provides a simple and low-cost security alarm solution.
Moreover, we can place the circuit at a door or in a garden and beginners can easily build it.