Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
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 hour53,081
Android Motion Detector Camera with Arduino/MCU

Things used in this project

Hardware components

Arduino UNO
Arduino 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

2 projects • 26 followers
Wait!! Do you get bored by seeing common/easy electronics project?Let`s show you some unique interesting project which you didn't see before

Comments