Nilanjan Mandal
Created February 9, 2021 © GPL3+

Badol - The Gardian Drone

This is Guardian Drone For the Rescue Personnel

AdvancedFull instructions providedOver 2 days88

Things used in this project

Hardware components

KIT-HGDRONEK66
NXP KIT-HGDRONEK66
×1
NXP 8MMNavQ Starter Kit
×1
Arduino UNO
Arduino UNO
×1
Arduino and Breadboard Holder
×1

Software apps and online services

PX4
PX4
QGroundControl
PX4 QGroundControl
Arduino IDE
Arduino IDE
Shotcut

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Premium Female/Male Extension Jumper Wires, 40 x 6" (150mm)
Premium Female/Male Extension Jumper Wires, 40 x 6" (150mm)
Mastech MS8217 Autorange Digital Multimeter
Digilent Mastech MS8217 Autorange Digital Multimeter
Plier, Long Nose
Plier, Long Nose

Story

Read more

Schematics

Noncontact Voltage Measurement circuit

Code

Noncontact Voltage Measurement code

Arduino
#include <Wire.h>
#include <Math.h>


#define sample 500                  //no. of samples the device takes per reading
float val;                          //place to store ta value from analogpin A5
int pin3 = 3;                       //output led


void setup() {
 
  Serial.begin(9600);
}

void loop(void)
{
  long average = 0;
  float c, s;
  while (1) {
    int16_t adc0;
    long sum, t;
    double  amplitude, cp, sp, phi;
    int i;
    sum = 0;
    i = 0;
    c = 0;
    s = 0;
    while (i < sample) {
      
     //Fourier analysis//
     
      adc0 = analogRead(A5) - 1023 * 3 / 5;
      t = micros(); //time in micro seconds
     
      //Replace 50.0 by 60.0 if your mains is 60 Hz
      phi = 6.2831853 * t / 1.0e6 * 50.0;
      c += (adc0 - average)  * cos(phi);
      s += (adc0 - average)  * sin(phi);
      sum += adc0;
      i++;
    }
    average = (sum / sample) ;
    i = 0; cp = c / sample; sp = s / sample;
    amplitude =  2 * sqrt(cp * cp + sp * sp);

    
    Serial.println(average);
    Serial.println(amplitude);         //For test and scaling
    
    //here the program takes the sum of all numbers in array1, and divides by the     number of elements "sample"
    val = amplitude;                   
    val = constrain(val, 0, 20);  //tweak it from from testing, 20 worked for me
    analogWrite(pin3, (val / 20.0 * 255.0));


  }
}

Credits

Nilanjan Mandal

Nilanjan Mandal

4 projects • 11 followers
Thanks to Emmanuel2015.

Comments