Walid Mafuj
Published © CC BY-NC

Android Motion Detector Camera with Arduino/MCU

Do you want to tighten your security? Want to know who is entering your room and capture their picture with an old smartphone and Arduino?

BeginnerFull instructions provided1 hour26,405
Android Motion Detector Camera with Arduino/MCU

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
White led
×1
LDR
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Story

Read more

Schematics

Wiring

Code

Android motion detector camera with Arduino

C/C++
Arduino code , Extension is .ino
#define pingTrig 6 
#define pingEcho 7 

int cameratrigger = 2 ;
int led = 3 ;
void setup()
{Serial.begin(9600);
  pinMode(pingTrig, OUTPUT);
  pinMode(pingEcho, INPUT);
delay(200);
  pinMode(led, OUTPUT);
pinMode(cameratrigger, OUTPUT);
  

}

void loop()
{
  long duration, inches, cm;
  
  digitalWrite(pingTrig, LOW);
  delayMicroseconds(2);
  digitalWrite(pingTrig, HIGH);
  delayMicroseconds(10);
  digitalWrite(pingTrig, LOW);
  
  duration = pulseIn(pingEcho, HIGH);
  
  cm = duration / 29 / 2;
  
  Serial.print("-->");Serial.println(cm);
  if(cm < 30 ){
digitalWrite(cameratrigger,HIGH);
digitalWrite(led,HIGH);    
    delay(200);
    digitalWrite(cameratrigger,LOW);
digitalWrite(led,LOW);    
delay(200);}} 

Credits

Walid Mafuj

Walid Mafuj

1 project • 15 followers
Wait!!do you get bored by seeing common/easy electronics project?Let us show you some unique interested project which you didn't see before.

Comments