Muhammad_Munir
Published © GPL3+

Welcome Audio by using PIR sensor

How to make Welcome Audio by using PIR sensor

BeginnerFull instructions provided13,085
Welcome Audio by using PIR sensor

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
SD card module
×1
BD139 Transistor
×1
Breadboard (generic)
Breadboard (generic)
×1
PIR Sensor
×1
3watt Speaker
×1
Jumper wires (generic)
×1

Story

Read more

Schematics

sd_card_connection_lWcdPd77JX.jpg

Code

Code

Arduino
#include "SD.h"
#define SD_ChipSelectPin 4
#include "TMRpcm.h"
#include "SPI.h"

TMRpcm tmrpcm;

void setup()
{
  

pinMode(7,INPUT);
delay(500);
}

void loop()
{

if(digitalRead(7)==HIGH)
{
 
  AudioPlay();
  delay(3000);
  }
  }

void AudioPlay()
{ 
tmrpcm.speakerPin = 9;
Serial.begin(9600);
if (!SD.begin(SD_ChipSelectPin)) {
Serial.println("SD fail");
return;
}

tmrpcm.setVolume(5);
tmrpcm.play("welcome.wav");
}

Credits

Muhammad_Munir

Muhammad_Munir

77 projects • 48 followers
I am Arduino programmer, also expertise in ESP32 and 8266 wifi modules.

Comments