Security Drone | Under the smart home project.

The security drone is a smart surveillance drone which can be locked on suspects to track them through traffic or areas where police vehicles cannot reach. The drone is equipped with high-speed motors for better stability and range.

Check out the blog page for more information about the project.

Blog Editor(Beta)

Here you can edit or create blog content and request an upload for the same.

Bridging the tech gap.

TINKER YOUR BLOGS HERE!

UNDER CONSTRUCTION /!\

Suggestions

Drop your valuable suggestions here:

Bridge the tech gap.

Enroll with us

Enroll with us to be a part of the upcoming tech world.

Bridge the tech gap.

Subscription

Buy your access to the world of upcoming tech.

Bridge the tech gap
Please Pay Using the link below to activate the subscription

Basic subscription:

Features:

  • Storage: 20 GB
  • 2 blogs
  • Partially Customizable
  • Reach moderate audience

Premium Subscription

Features:

  • Storage: 100 GB
  • 10 blogs
  • Full Authority
  • Reach quality audience
  • Design assistance
  • Plagiarism testing

Connect

Connect with us here and we will connect you with the world of technologies.

Bridge the tech gap.
Clicks the social links below to connect with ASENSE

Enroll to our website here:

Blogs

Find here the blogs of projects and ideas uploaded by ASENSE subscribers.

Bridge the tech gap.

Smart Lock:

The “Smart Lock” is an Arduino and Raspberry PI powered door lock system, capable of providing high-level security against thefts and is equipped with pressure and impact detection sensors.

It has an interactive warning system with false pressure detection

Material used:

  • Arduino (UNO in my case)
  • Raspberry Pi (ZeroW in my case)
  • Jumper Wires
  • Breadboard (for prototyping)
  • Lock mechanism (Similar to the one used in latches)
  • Servo motors
  • Relay (For actuating security lights and alarm)
  • Speakers (user-friendly experience)
  • Camera (Face recognition)
  • Sound receiver (User interaction)

This is the basic code for the pressure detection and siron trigger:

#include<Servo.h>
Servo lock;
#include <SoftwareSerial.h>// import the serial library
SoftwareSerial serial(0,1); // RX, TX
char BluetoothData=0;



void setup(){
  Serial.begin(9600);
  pinMode(3,OUTPUT);
  lock.attach(4);
  lock.write(160);
  digitalWrite(3,0);
  delay(1000);
  digitalWrite(3,1);
  delay(1000);
  digitalWrite(3,0);
  delay(1000);
  digitalWrite(3,1);
  Serial.println("The Door Is Locked");
  
}



void loop(){
    if(Serial.available() > 0)  {
BluetoothData=Serial.read();

   if(BluetoothData=='♀'){   
      lock.write(160);
      digitalWrite(3,HIGH);
      delay(2000);
      delay(10);
      Serial.println("LOCKED");
 
      }
      else{
        digitalWrite(3,LOW);
        lock.write(160);
      }
  if (BluetoothData=='§'){
  lock.write(76);
  delay(10);
  digitalWrite(3,HIGH);
  delay(2000);
  digitalWrite(3,LOW);
  Serial.println("UNLOCKED");

  }
  else{
    lock.write(160);
    digitalWrite(3,HIGH);
    Serial.println("INTRUDER ALERT");
  }

}
}

void green(){
  digitalWrite(3,1);
}

void red(){
  digitalWrite(3,0);
}
Pressure plate- Triggers the alarm when pressure increases the secure level.
Assembled

Pollution Notifier:

The pollution notifier runs on an Arduino UNO which notifies you when you enter an area of higher pollution level. You can wear the provided mask which actively purifies the air you breathe in.

The device is portable and wearable. Has aero side effects due to the use of a natural substance like activated carbon.

Material Required:

  • Arduino (UNO in my case)
  • Gas sensor
  • LCD 16 X 2
  • Buzzer
  • Mask
  • Activated carbon
  • Silicon Pipe
  • Fan
  • 9 v Battery
Prototype phase

SECURITY DRONE:

The security drone is a smart surveillance drone which can be locked on suspects to track them through traffic or areas where police vehicles cannot reach. The drone is equipped with high-speed motors for better stability and range.

Material Used:

  • Arduino
  • Gyroscope
  • accelerometer
  • Brushless DC motors (11.0 V)
  • FPV Camera
  • Remote Control
  • GSM (for radio connectivity)
  • Carbon Fibre Body

FLIGHT CONTROL CODE:


#include <PinChangeInt.h>
#include <Servo.h>
#include "I2Cdev.h"
#include <PID_v1.h>

static uint16_t unThrottleIn;
static uint16_t unPitchIn;
static uint16_t unRollIn;

#include "MPU6050_6Axis_MotionApps20.h"
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
    #include "Wire.h"
#endif

int outputTL, outputTR, outputBR, outputBL, auxTL, auxTR, auxBR, auxBL;
int mpuYaw, mpuPitch, mpuRoll;


int motorGain = 70;



int power = 0;


#define MPU_STABILIZER_ACTIVATION 2


#define THROTTLE_IN_PIN 3 // Gas
#define PITCH_IN_PIN 4 // Elevator
#define ROLL_IN_PIN 5 // Aileron



#define MOTORTL_OUT_PIN 8
#define MOTORTR_OUT_PIN 9
#define MOTORBR_OUT_PIN 11
#define MOTORBL_OUT_PIN 13

Servo servoMotorTL;
Servo servoMotorTR;
Servo servoMotorBR;
Servo servoMotorBL;

float kp = .20;
float ki = .040;
float kd = .100;


double PitchaggKp=.40, PitchaggKi=0.02, PitchaggKd=.9;
double PitchconsKp=.53, PitchconsKi=0.02, PitchconsKd=0.12;

double RollaggKp=.40, RollaggKi=0.02, RollaggKd=.9;
double RollconsKp=.53, RollconsKi=0.02, RollconsKd=0.12;



#define OUTPUT_LIMITS 30

double pitchSetpoint, pitchInput, pitchOutput;
double rollSetpoint, rollInput, rollOutput;


//Specify the links and initial tuning parameters
PID pitchPID(&pitchInput, &pitchOutput, &pitchSetpoint, PitchconsKp, PitchconsKi, PitchconsKd, DIRECT);
PID rollPID(&rollInput, &rollOutput, &rollSetpoint, RollconsKp, RollconsKi, RollconsKd, DIRECT);

MPU6050 mpu;

bool dmpReady = false;
uint8_t mpuIntStatus;
uint8_t devStatus;
uint16_t packetSize;
uint16_t fifoCount;
uint8_t fifoBuffer[64];

Quaternion q;
VectorInt16 aa;
VectorInt16 aaReal;
VectorInt16 aaWorld;
VectorFloat gravity;
float euler[3];
float ypr[3];



#define THROTTLE_FLAG 1
#define PITCH_FLAG 1
#define ROLL_FLAG 1

volatile uint8_t bUpdateFlagsShared;

volatile uint16_t unThrottleInShared;
volatile uint16_t unPitchInShared;
volatile uint16_t unRollInShared;

uint32_t ulThrottleStart;
uint32_t ulPitchStart;
uint32_t ulRollStart;

volatile bool mpuInterrupt = false;
void dmpDataReady() {
    mpuInterrupt = true;
}

void setup(){
      

  pitchInput = 0;
  rollInput = 0;

  pitchPID.SetMode(AUTOMATIC);
  rollPID.SetMode(AUTOMATIC);
  pitchPID.SetOutputLimits(0, OUTPUT_LIMITS);
  rollPID.SetOutputLimits(0, OUTPUT_LIMITS);
  
  #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
      Wire.begin();
      TWBR = 24;
  #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
      Fastwire::setup(400, true);
  #endif
    
  Serial.begin(115200);
  Serial.println("multiChannels");

  servoMotorTL.attach(MOTORTL_OUT_PIN);
  servoMotorTR.attach(MOTORTR_OUT_PIN);
  servoMotorBL.attach(MOTORBL_OUT_PIN);
  servoMotorBR.attach(MOTORBR_OUT_PIN);

  PCintPort::attachInterrupt(THROTTLE_IN_PIN, calcThrottle, CHANGE); 
  PCintPort::attachInterrupt(PITCH_IN_PIN, calcPitch, CHANGE);
  PCintPort::attachInterrupt(ROLL_IN_PIN, calcRoll, CHANGE);

  arm();
  
  mpu.initialize();
  Serial.println(mpu.testConnection() ? F("MPU6050 connection successful") : F("MPU6050 connection failed"));
  devStatus = mpu.dmpInitialize();
  mpu.setXGyroOffset(220);
  mpu.setYGyroOffset(76);
  mpu.setZGyroOffset(-85);
  mpu.setZAccelOffset(1788);
  
  if (devStatus == 0) {
        mpu.setDMPEnabled(true);
        attachInterrupt(0, dmpDataReady, RISING);
        mpuIntStatus = mpu.getIntStatus();
        dmpReady = true;
        packetSize = mpu.dmpGetFIFOPacketSize();
    } else {
        Serial.print(F("DMP Initialization failed (code "));
        Serial.print(devStatus);
        Serial.println(F(")"));
    }
  
}

void loop() {

  static uint8_t bUpdateFlags;

  if (!dmpReady) return;
    while (!mpuInterrupt && fifoCount < packetSize) {
    }
    mpuInterrupt = false;
    mpuIntStatus = mpu.getIntStatus();
    fifoCount = mpu.getFIFOCount();
    if ((mpuIntStatus & 0x10) || fifoCount == 1024) {
        mpu.resetFIFO();
    } else if (mpuIntStatus & 0x02) {
        while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount();
        mpu.getFIFOBytes(fifoBuffer, packetSize);
        fifoCount -= packetSize;
    }

  mpu.dmpGetQuaternion(&q, fifoBuffer);
  mpu.dmpGetGravity(&gravity, &q);
  mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
  
  mpuYaw = ypr[0] * 180/M_PI;
  mpuRoll = ypr[1] * 180/M_PI;
  mpuPitch = ypr[2] * 180/M_PI;

  if(bUpdateFlagsShared) {
    
    power = 0;
    noInterrupts();
    bUpdateFlags = bUpdateFlagsShared;
    
    if(bUpdateFlags & THROTTLE_FLAG) {
      unThrottleIn = unThrottleInShared;
    }
    if(bUpdateFlags & PITCH_FLAG) {
      unPitchIn = unPitchInShared;
    }
    if(bUpdateFlags & ROLL_FLAG) {
      unRollIn = unRollInShared;
    }
    
    bUpdateFlagsShared = 0;
    interrupts();
    
  }
   
  if(!bUpdateFlags) {
    // Iniciar contador
    power++;
  }

  if(power > 2) {
    Serial.println("No Signal!");
    outputTL = 1000;
    outputTR = 1000;
    outputBL = 1000;
    outputBR = 1000;
    delay(500);
  }

  // RADIO CONTROLLER DEBUG
  Serial.println("Pitch value: ");
  Serial.println(unPitchIn);
  Serial.println("Roll value: ");
  Serial.println(unRollIn);

  pitchSetpoint = mpuPitch; 
  pitchInput = map(unPitchIn, 900, 2000, -30, 30); 
  double Pitchgap = abs(pitchSetpoint-pitchInput); 
  if(Pitchgap<5) {  
      pitchPID.SetTunings(PitchconsKp, PitchconsKi, PitchconsKd);
  } else {
    
    pitchPID.SetTunings(PitchaggKp, PitchaggKi, PitchaggKd);
  }
  pitchPID.Compute();

  rollSetpoint = mpuRoll; 
  rollInput = map(unRollIn, 900, 2000, -30, 30); 
  double Rollgap = abs(rollSetpoint-rollInput); 
  if(Rollgap<5) { 
      rollPID.SetTunings(RollconsKp, RollconsKi, RollconsKd);
  } else {
   
    rollPID.SetTunings(RollaggKp, RollaggKi, RollaggKd);
  }
  rollPID.Compute();

  // MPU DEBUG

Serial.println(pitchOutput);
  Serial.println("Pitch: ");
  Serial.println(mpuPitch);
  Serial.println("Roll: ");
  Serial.println(mpuRoll);
Serial.println(rollOutput);

        
  if(bUpdateFlags & THROTTLE_FLAG) {
    if(servoMotorTL.readMicroseconds() && servoMotorTR.readMicroseconds() 
        && servoMotorBL.readMicroseconds() && servoMotorBR.readMicroseconds()
        != unThrottleIn) {
          outputTR = unThrottleIn;
          outputTL = unThrottleIn;
          outputBL = unThrottleIn;
          outputBR = unThrottleIn;
          auxTR = unThrottleIn;
          auxTL = unThrottleIn;
          auxBL = unThrottleIn;
          auxBR = unThrottleIn;
        
         
          if(mpuRoll > 0) {
            outputTL = unThrottleIn + (rollOutput + motorGain);
            outputBL = unThrottleIn + (rollOutput + motorGain);
          }
          
          if(mpuRoll < 0) {
            outputTR = unThrottleIn + (rollOutput + motorGain); 
            outputBR = unThrottleIn + (rollOutput + motorGain);
          }
          
          if(mpuPitch < 0) {
            outputTL = unThrottleIn + (pitchOutput + motorGain); 
            outputTR = unThrottleIn + (pitchOutput + motorGain);
          }
          // Inclinar Atras (Grados Positivos)
          if(mpuPitch > 0) {
            outputBL = unThrottleIn + (pitchOutput + motorGain); 
            outputBR = unThrottleIn + (pitchOutput + motorGain);
          }
          
    }
  }
 
  if(bUpdateFlags & PITCH_FLAG) {
    if(servoMotorTL.readMicroseconds() && servoMotorTR.readMicroseconds() 
        && servoMotorBL.readMicroseconds() && servoMotorBR.readMicroseconds()
        != unPitchIn) {
         //Serial.println(unPitchIn);
            pitchInput = map(unPitchIn, 900, 2000, -30, 30); 
            pitchSetpoint = mpuPitch; 
            double gap = abs(pitchSetpoint-pitchInput); //distance away from setpoint
            if(gap<5)
            {  //we're close to setpoint, use conservative tuning parameters
              pitchPID.SetTunings(PitchconsKp, PitchconsKi, PitchconsKd);
            }
            else
            {
               //we're far from setpoint, use aggressive tuning parameters
               pitchPID.SetTunings(PitchaggKp, PitchaggKi, PitchaggKd);
            }
          pitchPID.Compute();
         
          if(unPitchIn > 1550) {
            outputTL = auxTL + (pitchOutput + motorGain); 
            outputBL = auxTL + (pitchOutput + motorGain);
          }
   
          if(unPitchIn < 1450) {
            outputTR = auxTR + (pitchOutput + motorGain);
            outputBR = auxBR + (pitchOutput + motorGain);
          }
    }
  }
  
  if(bUpdateFlags & ROLL_FLAG) {
    if(servoMotorTL.readMicroseconds() && servoMotorTR.readMicroseconds() 
        && servoMotorBL.readMicroseconds() && servoMotorBR.readMicroseconds()
        != unRollIn) {
          Serial.println(unRollIn);
            rollInput = map(unRollIn, 900, 2000, -30, 30); 
            rollSetpoint = mpuRoll; 
            double gap = abs(rollSetpoint-rollInput); 
            if(gap<5)
            {  //we're close to setpoint, use conservative tuning parameters
              rollPID.SetTunings(RollconsKp, RollconsKi, RollconsKd);
            }
            else
            {
               //we're far from setpoint, use aggressive tuning parameters
               rollPID.SetTunings(RollaggKp, RollaggKi, RollaggKd);
            }
          pitchPID.Compute();
          if(unRollIn > 1550) {
            outputTL = auxTL + (rollOutput + motorGain);
            outputTR = auxTR + (rollOutput + motorGain);
          }
          if(unRollIn < 1450) {
            outputBL = auxBL + (rollOutput + motorGain);
            outputBR = auxBR + (rollOutput + motorGain);
          }
    }
  }
   
  initMotors(
            outputTL,
            outputTR,
            outputBR,
            outputBL
  );
  
  bUpdateFlags = 0;
  
}

void calcThrottle() {
  if(digitalRead(THROTTLE_IN_PIN) == HIGH) { 
    ulThrottleStart = micros();
  } else{
    unThrottleInShared = (uint16_t)(micros() - ulThrottleStart);
    bUpdateFlagsShared |= THROTTLE_FLAG;
  }
}

void calcPitch() {
  if(digitalRead(PITCH_IN_PIN) == HIGH) { 
    ulPitchStart = micros();
  } else{
    unPitchInShared = (uint16_t)(micros() - ulPitchStart);
    bUpdateFlagsShared |= PITCH_FLAG;
  }
}

void calcRoll() {
  if(digitalRead(ROLL_IN_PIN) == HIGH) { 
    ulRollStart = micros();
  } else{
    unRollInShared = (uint16_t)(micros() - ulRollStart);
    bUpdateFlagsShared |= ROLL_FLAG;
  }
}

void initMotors(int tl, int tr, int br, int bl) {

  Serial.println(tl);
  Serial.println(tr);
  Serial.println(br);
  Serial.println(bl);
 
  servoMotorTL.writeMicroseconds(tl);
  servoMotorTR.writeMicroseconds(tr);
  servoMotorBR.writeMicroseconds(br);
  servoMotorBL.writeMicroseconds(bl);
  
}

void arm() {
  servoMotorTL.writeMicroseconds(1000);
  servoMotorTR.writeMicroseconds(1000);
  servoMotorBL.writeMicroseconds(1000);
  servoMotorBR.writeMicroseconds(1000); 
}

DIAGRAMS:

About us

A brief insight into our aim

Bridging the tech gap.

We are providing a simple platform to all the tech users to search impliment and publish their ideas.

Peolple can use our site as a technology hub were you can find blogs, ideas, latest tech news, and can even buy exotic and authentic tech products.