Alana Balagot
Published © GPL3+

Car Sentry

I park my car on the street and it has been broken into a lot. I built a robot sentry/scarecrow that scares people away and takes photos

AdvancedFull instructions provided3 days1,184
Car Sentry

Things used in this project

Hardware components

Spresense boards (main & extension)
Sony Spresense boards (main & extension)
×1
Spresense camera board
Sony Spresense camera board
×1
Spresense LTE extension board
Sony Spresense LTE extension board
×1
12v relay
×1
RCWL-0516 Motion Detection Sensor
×2
12V Red LEDs
×1
12V Fuse Tap
×1
CNC Shield
×1
Stepper Motor
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Sentry Circuit

Circuit diagram for the Sentry circuit.

Code

Robot Sentry V1

Arduino
Arduino code for the Robot Sentry for Spresense
#define enablePin 2 //Enable pin for CNC shield
#define dirPin 6 //Dir pin for CNC shield
#define xPin 5 //Pulse pin for CNC shield
#define relay 9 //LEDs are connected to this relay
#define radarL 3 //Left Radar
#define radarR 7 //Right Radar

void setup() {
    pinMode(enablePin, OUTPUT);
    pinMode(dirPin, OUTPUT);
    pinMode(xPin, OUTPUT);
    pinMode(relay, OUTPUT);
    pinMode(radarL, INPUT);
    pinMode(radarR, INPUT);
    digitalWrite(radarL, LOW);
    digitalWrite(radarR, LOW);
    digitalWrite(enablePin, LOW);
    digitalWrite(dirPin, HIGH);
    pinMode(LED_BUILTIN, OUTPUT);
    Serial.begin(115200);
}

void loop() {
    int turnWidth = 100;
    int delLength = 20;
    
    if(digitalRead(radarL) == HIGH)
    {
      Serial.println("radar L");
      digitalWrite(relay, HIGH); //turn on LEDs
      digitalWrite(enablePin, LOW); //enable motor
      digitalWrite(dirPin, LOW); //look left
      for(int i = 0; i < turnWidth; i++)
      {
         digitalWrite(xPin, HIGH);
         delay(delLength);
         digitalWrite(xPin, LOW); 
      }
      digitalWrite(enablePin, HIGH); //disable motor
      delay(2000);
      digitalWrite(relay, LOW); //turn off LEDs
      //TODO take photo
      //TODO upload photo with LTE
    } 
    else if(digitalRead(radarR) == HIGH)
    {
      Serial.println("radar R");
      digitalWrite(relay, HIGH); //turn on LEDs
      digitalWrite(enablePin, LOW); //enable motor
      digitalWrite(dirPin, HIGH); //look right
      for(int i = 0; i < turnWidth; i++)
      {
         digitalWrite(xPin, HIGH);
         delay(delLength);
         digitalWrite(xPin, LOW); 
      }
      digitalWrite(enablePin, HIGH); //disable motor
      delay(2000);
      digitalWrite(relay, LOW); //turn off LEDs
      //TODO take photo
      //TODO upload photo with LTE
    }else
    {
      Serial.println("no movement");
      digitalWrite(relay, LOW);
      digitalWrite(LED_BUILTIN, LOW);
      digitalWrite(enablePin, HIGH);
      digitalWrite(relay, LOW);
      delay(2000);
    }
    delay(200);
    
}

Credits

Alana Balagot

Alana Balagot

2 projects • 3 followers
Maker/Musician/Developer

Comments