Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

UVA DRONE PILOT FLIGHT - ANY?

Status
Not open for further replies.

Roof55

New Member
UVA/RPAS Drone pilot light, My new arrived Arduino need to do else the "Hello word-led blink...
So to my DJI P3 drone, this is the project text:

// Project 1 - Pilot UVA Lights

int ledDelay = 400; // delay by 400ms
int redPin = 3;
int green1Pin = 5;
int green2Pin = 6;


void setup() {
pinMode(redPin, OUTPUT);
pinMode(green1Pin, OUTPUT);
pinMode(green2Pin, OUTPUT);

}

void loop()

{

So far, so good, but
how to tell Arduino at power on "run this cycle for 3 minutes ON, pause OFF for 2 minutes, after OFF period re-start again;
while in this period of tot. 5 minutes, this happened:

LED red at pin 3 Give two flash (400mS) each 4th second (duration flash periode 1 second),
while two seperate green led (=1 & 2) stay stable for constant 40 % light in this 2 minutes periode, LED 1 flash twice within 1 second, pause 3 second, before green LED 2 flashing twice duration 1 second, pause 3 second, green LED 1 start this cycle again. RED led running it's own cycles, at same time as GREEN led operating.

This is my Arduino project with RED 2 parallel 3 watts mini LED, and two seperate 3 watt green mini LED. Using a MOSFET n-Ch. for drive this 3W led, MOSFET 30 volt @ 5,8A-SOT-23 case.
Power source: Li-Po 11.1 volt 1200mAh. The out put stage are already finish, but this program step, are more complicated to finished.

Thanks for reading, any volunteers to help me?
 
I don't fully understand what you want but this code blinks led1 for 3 minutes and led2 for 2 minutes the blink is 400 mS for the whole 3 minutes thats 450 blinks and 300 blinks for the two minutes
Code:
const int ledPin1 =  13;      // the number of the LED pin
const int ledPin2 =  12;
// Variables will change:
int ledState1 = LOW;             // ledState used to set the LED
int ledState2 = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated
long count = 0;

long interval = 400;           // interval at which to blink (milliseconds)

void setup() {
  // set the digital pin as output:
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);    

}
void loop()
{
  do
   {
   unsigned long currentMillis = millis();

    if(currentMillis - previousMillis > interval) {
     // save the last time you blinked the LED
     previousMillis = currentMillis;

     // if the LED is off turn it on and vice-versa:
     if (ledState1 == LOW)
       ledState1 = HIGH;
     else
       ledState1 = LOW;
     count++;
    // set the LED with the ledState of the variable:
    digitalWrite(ledPin1, ledState1);
   }
  } while (count < 450);
  count = 0;
  do
   {
   unsigned long currentMillis = millis();

    if(currentMillis - previousMillis > interval) {
     // save the last time you blinked the LED
     previousMillis = currentMillis;

     // if the LED is off turn it on and vice-versa:
     if (ledState2 == LOW)
       ledState2 = HIGH;
     else
       ledState2 = LOW;
     count++;
    // set the LED with the ledState of the variable:
    digitalWrite(ledPin2, ledState2);
    }
  } while (count < 300);
    count = 0;
  }
 
Last edited:
Thank, Be80Be.
To make it better to understanding my thinking, I re-write it her as you can see::

Using 2 green LED's and 2 RED led's. This mention to be mount at my UVA drone, as pilot strobe flight flasher. When power ON; Green led1&2 constant 40 % light brightness, 1 blink 100 % 300mS follow each other- during one second. Pause for 4 sec. Green led 1&2 repeat. RED led 1+2 have it's own pattern. Just blink twice during a second-100 %, each 5. sec. (OR CODE AS PAUSE FOR 5 SEC.).

This process start at power ON to my Nano PIC and hold on for 3 min., pause 2 minutes, then restart for the 3 minutes pattern periode. This pause generated because LED have drain current each about 650mA@Vcc approx 3 volt. Thinking about my external Li-Po battery at 11.1 V and 1200mAh, this pause for 3 min. are needed to obtain pilot light during one flight trip at approx. 20 minutes.

Thanks!
 
Make a new reply (and sorry my bad English, I'm just a little man from Norway, he he :))

Make my project in short form:

This process start at power ON, running for 3 min, pause 2 minutes, then it's start again with 3 minutes on, 2 minutes pause, so on.
During this process: LED 1+2 (green) pattern, LED2 blink after LED1 flashing, blink 300mS LED1, LED2 blink for 300mS, think it could be approx. 150mS between LED1&2 it's blink. Pause 3-4 second for this pattern, so start again.

LED 3+4 are RED and blink together/same time, just 600mS blink, pause 5-6 second. The goal for this project is to make my UVA/DRONE better to recognize in flight, up in the sky. Everything is relative, but it could give some feeling, how to see this drone?

That's all, and hopefully better explained (?).
 
Be better like this ok you have 4 led's two green and two red they could be set's don't matter just that there are 4 of some set or just four ok
Ok we say 4
first set is led1 and led2 they are green
led1 on for 300ms led2 is off for 300 ms while led1 is on and led2 is on while led1 is off this happens for 3 minutes
Ok I don't think you'd want it dark for two minutes I would then blink led3 on for 600ms led4 off while led3 is on and led4 on while led3 is off for the next 2 minutes that's not going to kill your battery.

Hows that sound ?
 
It could be a solution, your text here, but remind this LED have forward current as 6-700mA! With a relative small Li-Po battery 1.11V 1200mAh, I think power safe mode is needed. Mostly it is necessary to see drone after takeoff, and landing. During flight, think drone are approx 76 % "away" from my sight. Think by selfe, if all LED glow at same time (in the theory), this draws approximately 2.8Ah battery. Inset with short breaks, and a long pause for 2 minuter, it may look like a 1200mAhh battery can sustain 23 minute flight flashlight until landing occurs. Your summary of LED on / off was not easy for me to follow. I think when power ON, green LED flashes 300mS, short pause, then flashes green LED2 300 mS. Pause 5 seconds, then start this up again. RED suffered, ok these two can contain pattern from one code programming. They do both equally. Let's say a blink with duration 400mS, stay in for example. 5 seconds, then blink 400mS, and so on.

Give this some sense?
 
It could be a solution, your text here, but remind this LED have forward current as 6-700mA! With a relative small Li-Po battery 1.11V 1200mAh, I think power safe mode is needed. Mostly it is necessary to see drone after takeoff, and landing. During flight, think drone are approx 76 % "away" from my sight. Think by selfe, if all LED glow at same time (in the theory), this draws approximately 2.8Ah battery. Inset with short breaks, and a long pause for 2 minuter, it may look like a 1200mAhh battery can sustain 23 minute flight flashlight until landing occurs. Your summary of LED on / off was not easy for me to follow. I think when power ON, green LED flashes 300mS, short pause, then flashes green LED2 300 mS. Pause 5 seconds, then start this up again. RED suffered, ok these two can contain pattern from one code programming. They do both equally. Let's say a blink with duration 400mS, stay in for example. 5 seconds, then blink 400mS, and so on.

Give this some sense?
Sorry, battery voltage, 11,1 volt ;)
 
I read that LOl
But i don't think you figured how much your using. If it's 700 mA a hour
flying time of 25 minutes you'd have enough power post me a data sheet for your leds and how many leds just 4 I take it
draw something showing how you have this and I write you code for that.
 
Perfect! LOL:)
Diodes: **broken link removed**
Skip down for a while at page, you find RED and GREEN.
The MOSFET driver transistor: **broken link removed**

Example: Blinking 1 sec. every 5 sec., all diodes give one blink, during a minutes: 650mAX2+ 700mAX2= 2700mA total drain current. During one minutes, blink time are 12S. 1200mAh, with 30 minutes use double current available, = 2400mA/30 minutes, and in theory it should hold for 54 minutes, I'm agree, flush of power to running continues! But to avoid need for charge (i have tot. 3 batteries to UVA), Arduino needs at last 5V, depending at how fast this Li-Po passt 5,1V, perhaps just a pause for 30 second can gain user time for one 1200mAh battery, enough for 3 flight (=3 batteries) ? Good work, be80be!
 
Hi.
At his SkyDrive you can se the pattern to this 2 GREEN led, and TWO RED led, https://1drv.ms/1h5GfDP
You will regognize it's an extra blink for diodes 1&2. About current forward drain, during one minutes you have to add 2,7Ampere for each blink, it's approx. 26 flash, I think. Waiting i surprise for your code.
 
I'll have something tonight if not no later then tomorrow. But I don't think your leds use all that power if it's just 4 leds
  1. Power is the rate at which energy is generated or consumed and hence is measured in units (e.g. watts) that represent 'energy per unit time'. For example, when a light bulb with a power rating of 100W is turned on for one hour, the energy used is 100 watt hours (W.
I shorting the blink times but you should still get the idea
 
Last edited:
I'll have something tonight if not no later then tomorrow. But I don't think your leds use all that power if it's just 4 leds

I shorting the blink times but you should still get the idea

Great done! I love your flashing pattern!
You correct, about consume energy. This equipment using if ALL consumer (LED 1+2+3+4) are ON, 9 watts. Power source optimal 100 % fresh battery charged, @ 11,1 volt. P=uXi, likely I=U/P, 11,1/9= 1.23A, battery hold for 1200 mAh, that's the theory. If I add to code a purse for 4 sec, before pattern RED and GREEN are flashing, like in your example, it means I've got enough power for at least one flight. Sorry to my low brain level to mash up with the code for this simple pattern.
 
You can change rate of blink how many blinks before off time between red and green.
I commented the code where to change timing.
Code:
const int ledPin1 =  13;      // the number of the LED pin
const int ledPin2 =  12;
const int ledPin3 =  11;
const int ledPin4 =  10;
// Variables will change:
int ledState1 = LOW;             // ledState used to set the LED
int ledState2 = LOW;
int ledState3 = LOW;             // ledState used to set the LED
int ledState4 = LOW;
long previousMillis = 0;        // will store last time LED was updated
long count = 0;

long interval = 400;           // interval at which to blink (milliseconds) lower faster blinks

void setup() {
  // set the digital pin as output:
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  pinMode(ledPin4, OUTPUT);  
}
void loop()
{

  do
   {
   unsigned long currentMillis = millis();

    if(currentMillis - previousMillis > interval) {
     // save the last time you blinked the LED
     previousMillis = currentMillis;

     // if the LED is off turn it on and vice-versa:
     if (ledState1 == LOW ){
       ledState1 = HIGH;
       ledState2 = LOW;
     }
     else {
       ledState1 = LOW;
       ledState2 = HIGH;
     count++;
    // set the LED with the ledState of the variable:
     }
    digitalWrite(ledPin1, ledState1);
    digitalWrite(ledPin2, ledState2);
   }
  } while (count < 3); //sets how many blinke
  ledState2 = LOW;
  digitalWrite(ledPin2, ledState2);
  count =0;
  //=========================================================
  delay(2000); //sets the time between set green and red
  //=========================================================
  do
   {
   unsigned long currentMillis = millis();

    if(currentMillis - previousMillis > interval) {
     // save the last time you blinked the LED
     previousMillis = currentMillis;

     // if the LED is off turn it on and vice-versa:
     if (ledState3 == LOW){
       ledState3 = HIGH;
       ledState4 = LOW;
     }
     else {
       ledState3 = LOW;
       ledState4 = HIGH;
     count++;
    // set the LED with the ledState of the variable:
     }
    digitalWrite(ledPin3, ledState3);
    digitalWrite(ledPin4, ledState4);
    }
  } while (count < 2);
  ledState4 = LOW;
  digitalWrite(ledPin4, ledState4);
  count=0;
   //=========================================================
  delay(2000);  //sets the time between set green and red
  //=========================================================
  }
Better video
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top