UAV Project help required! Arduino programming, gps, parachutes.

8 views
Skip to first unread message

gary hooson

unread,
Jan 15, 2016, 3:25:49 PM1/15/16
to swindon-hackspace
Good afternoon,

I am looking for any advice or possible help on a new project. I am currently based at MOD Lyneham. My collogue and I are prototyping a possible modification to a UAV so it can deploy a capsule when its flightpath reaches a set of pre programmed grid co-ordinates.

For this to happen we are thinking of using Arduino, would this do the job? If so could anybody provide programming help? If not can somebody recommend something else?
The planned weight of the deployed capsule is to be 500g does anybody know of a parachute that would be suitable? I know people use them for model rockets ect.

Any help with the topics mentioned would be greatly appreciated.

Regards,

Gary

Robert Longbottom

unread,
Jan 16, 2016, 4:44:11 AM1/16/16
to swindon-...@googlegroups.com
Hi Gary,

This certainly sounds like the kind of thing that could be done fairly easily with an Arduino, some kind of release mechanism and a GPS module; Or do you already have position data from the UAV?  I assume it knows where it is somehow if its a UAV :-)

Also some of the hobby-level flight controllers like the APM / PixHawk will fly to a set location and then take a picture by activating a camera trigger output.  I think this can either be a servo or a relay, but I've not looked into it or tried this, just noticed it in passing.  If you were already using one of these flight controllers then you could repurpose this functionality to drop your payload intead.

I don't know much about parachutes, but coming from a hobbyist point of view I see that emergency parachutes are starting to pop up more in case of in-flight issues - i.e. if your rc multirotor drops out of the sky for any reason (eg hardware failure) it will autodeploy a parachute to try and save ittself.  Maybe looking into what is being used here would be suitable enough for your payload - given many hobby quadcopters tend to be in the few hundred grams to few kilograms weight range.

Cheers,
Rob.
--
You received this message because you are subscribed to the Google Groups "swindon-hackspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swindon-hacksp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

gary hooson

unread,
Jan 16, 2016, 5:17:24 AM1/16/16
to swindon-...@googlegroups.com
Hi Rob,

Thanks for getting in touch. The UAV does know where it is but as it is just a modification idea for our course project the design team won't let us use any of its existing circuits.

The flight controller sounds like a really good idea! As all we need it to do is produce a signal at a given point to release the capsule, are they readily available from model shops?

Same for the parachute that again sounds like the ideal solution.

Is this the kind of thing we could bring along to the Hackspce on a Wednesday and maybe discuss further and maybe get other people involved?

Thanks again for your help 

Regards

Gary
You received this message because you are subscribed to a topic in the Google Groups "swindon-hackspace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swindon-hackspace/p2bGKTG2czY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swindon-hacksp...@googlegroups.com.

Robert Longbottom

unread,
Jan 16, 2016, 6:02:25 AM1/16/16
to swindon-...@googlegroups.com
Hi,

I'd say the flight controller is a good idea if you already have one onboard and its flying the UAV - otherwise its probably overkill and wouldn't work - because it would want to be in control of flying in order to run it's mission.  An ardunio plus GPS module would be cheaper and simpler as a more standalone option.  The coding shouldn't be too challenging - assuming you know a little bit already.

And yes, feel free to come along to a Wednesday meeting to have a chat about it or to get help with what you are working on, I'm usually there.  There are a few of us who have quadcopters and most people have at least some arduino knowledge (or something similar, raspberry pi, etc).  Bring along any info or bits that you already have for us to have a look at as well.

Cheers,
Rob.

gary hooson

unread,
Jan 16, 2016, 6:12:48 AM1/16/16
to swindon-...@googlegroups.com
Awesome, 

Thanks for your help, I'll pop down Wednesday 

Cheers 

Gaz

Damian Axford

unread,
Jan 18, 2016, 11:48:49 AM1/18/16
to swindon-hackspace
HI Gary

What Rob said, plus...  we have an extended member who has expertise with kites/parachutes and can probably help with both material recommendations and sizing to match the payload.

I've also built GPS triggered devices in the past using Arduino + GPS - happy to share code, should be pretty much everything you need to get something working

Talk Wed

thanks
D

gary hooson

unread,
Jan 18, 2016, 12:30:25 PM1/18/16
to swindon-...@googlegroups.com
Hi,

Thanks a lot that sounds fantastic, cheers guys really appreciate the help, see you Wednesday.


On Monday, 18 January 2016, Damian Axford <dam...@axford.me.uk> wrote:
HI Gary

What Rob said, plus...  we have an extended member who has expertise with kites/parachutes and can probably help with both material recommendations and sizing to match the payload.

I've also built GPS triggered devices in the past using Arduino + GPS - happy to share code, should be pretty much everything you need to get something working

Talk Wed

thanks
D

--

Gyrobot

unread,
Jan 21, 2016, 10:09:26 AM1/21/16
to swindon-hackspace
Good to meet you both last night, hope to see you on future Wednesdays.

Had a mess around when you left regarding the payload bay and doors and knocked up a quick scheme :




I'm sure we can discuss further next time.

Cheers,
Steve Wood

gary hooson

unread,
Jan 21, 2016, 10:25:44 AM1/21/16
to swindon-...@googlegroups.com
Wow that looks fantastic! 

Good to meet you guys too, this morning we orderd all the parts we discussed last night and got the 3D printing filament, should have them soon. 

Next week we are going to try and get hold of the UAV and bring it down to show you.

Can't thank you guys enough see you Wednesday 

Regards 

Gaz
--

Damian Axford

unread,
Jan 22, 2016, 11:53:55 AM1/22/16
to swindon-hackspace
Hi Gary

Sorry I missed you guys, think you left just before I got there.  Can talk GPS stuff another week (unless Rob, Steve, etc covered it)

Look forward to seeing the project evolve :)

D

gary hooson

unread,
Jan 22, 2016, 12:50:19 PM1/22/16
to swindon-...@googlegroups.com
Hi There, 

Unfortunately we didn't park in the best spot and had to be gone for 2000hrs, we are coming down again Wednesday, this time with better parking in mind, and should hopefully have the parts we need to get something started.

See you soon 

Gaz
--

Damian Axford

unread,
Jan 28, 2016, 5:04:38 AM1/28/16
to swindon-hackspace
Hi Gaz

Here's a very good article on calculating distance between two lat/long co-ordinates:


Given the small target radius you're working with, I'd go with the simpler equirectangular approximation.  If you read through the whole thing, it explains the various units and the key constant (radius of the Earth).  The output from the function is the distance between co-ords in km.  

The easiest way to feed these formula from the GPS library, is to use the GPS.latitudeDegrees and GPS.longitudeDegrees values. These values will need to be converted from degrees to radians, as Arduino trig functions expect radians (https://www.arduino.cc/en/Reference/Cos):

Radians = Degrees * PI / 180

Once you've got the distance calc working, you can write a simple test program along these lines:

SETUP:
Set dropped flag to false

LOOP:
If got gps fix and dropped flag is false:
Calc distance between current position and target
If distance < xx then 
open servo
wait for 1s
close servo
set dropped flag to true
         end if
end if


Have fun :)
D

Gyrobot

unread,
Feb 1, 2016, 2:39:25 AM2/1/16
to swindon-...@googlegroups.com

Printed out the payload compartment for size and fit assessment :




Robert Longbottom

unread,
Feb 1, 2016, 4:26:09 AM2/1/16
to swindon-...@googlegroups.com

Looks good. There's some wierd perspective going on in those photos :-). I wouldnt be sure they were even the same part just from looking at the pictures, one look short and squat, the other looks tall and thin.

On 1 February 2016 07:39:27 Gyrobot <sp...@gyrobot.co.uk> wrote:


Printed out the payload compartment for size and fit assessment :






















--
You received this message because you are subscribed to the Google Groups "swindon-hackspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swindon-hacksp...@googlegroups.com.

gary hooson

unread,
Feb 1, 2016, 6:15:08 AM2/1/16
to swindon-...@googlegroups.com
Hi Guys,

Looks really good! We are printing one out this end as well, it's not going quite so smoothly but it's happening!

 We got a few parts come through today one of them being the arduino, so hopefully gonna try and get some code knocked up, should have a blinking LED going in no time.

The parachute is also on order so things are moving in the right direction, thanks again for your time and help.

Regards 

Gaz
You received this message because you are subscribed to a topic in the Google Groups "swindon-hackspace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swindon-hackspace/p2bGKTG2czY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swindon-hacksp...@googlegroups.com.

gary hooson

unread,
Feb 5, 2016, 2:26:53 PM2/5/16
to swindon-...@googlegroups.com
Evening all,

just thought i'd share a photo of the printed design inserted into the payload was a really nice snug fit.
 
Inline image 1

I have been trying to have a mess with the Arduino but not having any joy. We went for the Micro 5V, When i try to upload to the board i get the following error;

Board at COM3 is not available

I have searched Google and YouTube for help but the help is for windows 7,8 not 10 which I have. Does anyone have any thoughts on this?

See you Wednesday anyway have a good weekend.

Robert Longbottom

unread,
Feb 5, 2016, 3:41:28 PM2/5/16
to swindon-...@googlegroups.com
Looks like a good fit :-)

Re arduino, are you sure its connected at COM3?  Has it installed the correct driver?

gary hooson

unread,
Feb 5, 2016, 3:57:56 PM2/5/16
to swindon-...@googlegroups.com
I don't think it's installed a driver at all, there is nothing showing on device manager, all the help on the internet points towards updating drivers but the options that it is showing isn't the same as Windows 10...

Robert Longbottom

unread,
Feb 5, 2016, 4:06:09 PM2/5/16
to swindon-...@googlegroups.com
Hmm, it should be listed somewhere in device manager, even if its not recognised.

My (working) Uno shows up under Ports (COM & LPT) like this:

gary hooson

unread,
Feb 5, 2016, 4:13:20 PM2/5/16
to swindon-...@googlegroups.com
Inline image 2

I have no options for ports, when I plug it in nothing pops up, there was no option to run installation, is there drivers I can download? 

Robert Longbottom

unread,
Feb 5, 2016, 4:22:57 PM2/5/16
to swindon-...@googlegroups.com
Odd, does it make the "usb device plugged in" sound?

I would expect installation to be the same as the Windows 7 section here, Win 10 isn't massively different from that point of view.

https://www.arduino.cc/en/Guide/ArduinoLeonardoMicro#toc8

But if it doesn't even show up in device manager then those instructions aren't going to help much though... :-(

Usually they "just work" in Windows I think, though there are drivers with the Arduino IDE (see link)

gary hooson

unread,
Feb 5, 2016, 4:31:41 PM2/5/16
to swindon-...@googlegroups.com
It was under hidden devices! 

No it still doesn't make the 'new devices plugged in sound'

The driver installed is for the UNO how do i change it?

Inline image 1

Robert Longbottom

unread,
Feb 5, 2016, 5:18:31 PM2/5/16
to swindon-...@googlegroups.com

I suspect that's because you had a (my) Uno plugged in and its remembered it.  It just means that device is no longer plugged in.  You could try removing it, just right click and remove(?).  The plug your Arduino in again see if it works.  I don't think that will do the trick, but its worth a go.

Gyrobot

unread,
Feb 16, 2016, 3:39:56 PM2/16/16
to swindon-hackspace
I have been messing around again and I think I have managed to squeeze in a mechanism using push/pull rods. I believe this will be a better positive mechanism than the tendon and spring version. The servo's are at top dead centre when closed so this will reduce any stress on the servos to an absolute minimum. I am printing this now so I will bring it tomorrow  to test.

Here is a kinematics animation (wtf is kinematics?) :


gary hooson

unread,
Feb 18, 2016, 5:18:51 AM2/18/16
to swindon-...@googlegroups.com
Morning Guys,

Not sure if you are wanting to recruit new members yet but If you want me to advertise around MOD Lyneham I can. If you attach a poster I can put some up in project rooms ect.

Damian Axford

unread,
Feb 18, 2016, 5:43:34 AM2/18/16
to swindon-hackspace
Hey

Hold that thought for a few days - need to square a few bits and prep some PR material, then YES!  :)

thanks
D

gary hooson

unread,
Feb 22, 2016, 2:18:00 PM2/22/16
to swindon-...@googlegroups.com
Hi Guys,

I've managed to get the GPS going again but having problems getting the code for the 'doors open' to be included.

My 'Teacher' has tried to write some code but it's not happening... As seen in the photo below, from the end of the GPS code, he thinks by writing if GPS.fix then if longitude and latitude = ..... then run  'doors open' code it will work but the arduino software doesnt like these commands.

Is it on the right path or am I going about this the wrong way?

Inline image 1

--

Robert Longbottom

unread,
Feb 22, 2016, 2:30:42 PM2/22/16
to swindon-...@googlegroups.com
Hi,

Sounds like a reasonable approach to start with.  What doesn't it like?  What does the error say when you compile it?

At first glance it looks like there is a rogue "++" after the } on the line above if(GPS.Fix).  Is it just that?

Actually, it also looks a bit like you are trying to put some code somewhere other than the setup() or loop() functions?  You'd want to be writing this code inside loop() something along the lines of:

void loop() {
    // probably some code here to feed / update the GPS.
   
    if (GPS.fix) {
        if (GPS.latitude => 0 && GPS.lattitude <= 1) {
            // do something with servos to open the doors
     }
   }
}

Also remember to make sure stuff like brackets, etc match up, or it wont build.
You received this message because you are subscribed to the Google Groups "swindon-hackspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swindon-hacksp...@googlegroups.com.

gary hooson

unread,
Feb 22, 2016, 2:53:09 PM2/22/16
to swindon-...@googlegroups.com
Ok,

Cheers for that Rob I'll have another mess around thanks

Gyrobot

unread,
Feb 22, 2016, 3:09:11 PM2/22/16
to swindon-hackspace
Hi Gary/AJ,

Yeah, what Rob said. I did notice you didn't have an open curly bracket "{" after the  "if (GPS.fix)" statement, and it would need the opposite to close the block at some stage "}"

Some more CADgrabs of the increased payload volume for your parachute.



Cheers,
Steve

gary hooson

unread,
Feb 22, 2016, 3:15:54 PM2/22/16
to swindon-...@googlegroups.com
Ye what rob said haha cheers Steve looks awesome mate we've got some different types of bags in the taylors for the payload it's going to look really good when it all comes together. 

See you Wednesday 
--

Damian Axford

unread,
Feb 22, 2016, 4:15:07 PM2/22/16
to swindon-hackspace
Hi Gary

You can always attach your arduino code to a post here, then we can have a better look / try compiling it

Cheers
D

gary hooson

unread,
Feb 22, 2016, 4:31:20 PM2/22/16
to swindon-...@googlegroups.com
Hi Guys

This is the code:

#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>

// If you're using a GPS module:
// Connect the GPS Power pin to 5V
// Connect the GPS Ground pin to ground
// If using software serial (sketch example default):
//   Connect the GPS TX (transmit) pin to Digital 3
//   Connect the GPS RX (receive) pin to Digital 2
// If using hardware serial (e.g. Arduino Mega):
//   Connect the GPS TX (transmit) pin to Arduino RX1, RX2 or RX3
//   Connect the GPS RX (receive) pin to matching TX1, TX2 or TX3

// If you're using the Adafruit GPS shield, change 
// SoftwareSerial mySerial(3, 2); -> SoftwareSerial mySerial(8, 7);
// and make sure the switch is set to SoftSerial

// If using software serial, keep this line enabled
// (you can change the pin numbers to match your wiring):
SoftwareSerial mySerial(3, 2);

// If using hardware serial (e.g. Arduino Mega), comment out the
// above SoftwareSerial line, and enable this line instead
// (you can change the Serial number to match your wiring):

//HardwareSerial mySerial = Serial1;


Adafruit_GPS GPS(&mySerial);


// Set GPSECHO to 'false' to turn off echoing the GPS data to the Serial console
// Set to 'true' if you want to debug and listen to the raw GPS sentences. 
#define GPSECHO  false

// this keeps track of whether we're using the interrupt
// off by default!
boolean usingInterrupt = false;
void useInterrupt(boolean); // Func prototype keeps Arduino 0023 happy

void setup()  
{
    
  // connect at 115200 so we can read the GPS fast enough and echo without dropping chars
  // also spit it out
  Serial.begin(115200);
  Serial.println("Adafruit GPS library basic test!");

  // 9600 NMEA is the default baud rate for Adafruit MTK GPS's- some use 4800
  GPS.begin(9600);
  
  // uncomment this line to turn on RMC (recommended minimum) and GGA (fix data) including altitude
  //GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
  // uncomment this line to turn on only the "minimum recommended" data
  //GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY);
  // For parsing data, we don't suggest using anything but either RMC only or RMC+GGA since
  // the parser doesn't care about other sentences at this time
  
  // Set the update rate
  //GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);   // 1 Hz update rate
  // For the parsing code to work nicely and have time to sort thru the data, and
  // print it out we don't suggest using anything higher than 1 Hz

  // Request updates on antenna status, comment out to keep quiet
  //GPS.sendCommand(PGCMD_ANTENNA);

  // the nice thing about this code is you can have a timer0 interrupt go off
  // every 1 millisecond, and read data from the GPS for you. that makes the
  // loop code a heck of a lot easier!
  useInterrupt(true);

  delay(1000);
  // Ask for firmware version
  mySerial.println(PMTK_Q_RELEASE);
}


// Interrupt is called once a millisecond, looks for any new GPS data, and stores it
SIGNAL(TIMER0_COMPA_vect) {
  char c = GPS.read();
  // if you want to debug, this is a good time to do it!
#ifdef UDR0
  if (GPSECHO)
    if (c) UDR0 = c;  
    // writing direct to UDR0 is much much faster than Serial.print 
    // but only one character can be written at a time. 
#endif
}

void useInterrupt(boolean v) {
  if (v) {
    // Timer0 is already used for millis() - we'll just interrupt somewhere
    // in the middle and call the "Compare A" function above
    OCR0A = 0xAF;
    TIMSK0 |= _BV(OCIE0A);
    usingInterrupt = true;
  } else {
    // do not call the interrupt function COMPA anymore
    TIMSK0 &= ~_BV(OCIE0A);
    usingInterrupt = false;
  }
}

uint32_t timer = millis();
void loop()                     // run over and over again
{
  // in case you are not using the interrupt above, you'll
  // need to 'hand query' the GPS, not suggested :(
  if (! usingInterrupt) {
    // read data from the GPS in the 'main loop'
    char c = GPS.read();
    // if you want to debug, this is a good time to do it!
    if (GPSECHO)
      if (c) Serial.print(c);
  }
  
  // if a sentence is received, we can check the checksum, parse it...
  if (GPS.newNMEAreceived()) {
    // a tricky thing here is if we print the NMEA sentence, or data
    // we end up not listening and catching other sentences! 
    // so be very wary if using OUTPUT_ALLDATA and trytng to print out data
    //Serial.println(GPS.lastNMEA());   // this also sets the newNMEAreceived() flag to false
  
    if (!GPS.parse(GPS.lastNMEA()))   // this also sets the newNMEAreceived() flag to false
      return;  // we can fail to parse a sentence in which case we should just wait for another
  }

  // if millis() or timer wraps around, we'll just reset it
  if (timer > millis())  timer = millis();

  // approximately every 2 seconds or so, print out the current stats
  if (millis() - timer > 2000) { 
    timer = millis(); // reset the timer
    
    Serial.print("\nTime: ");
    Serial.print(GPS.hour, DEC); Serial.print(':');
    Serial.print(GPS.minute, DEC); Serial.print(':');
    Serial.print(GPS.seconds, DEC); Serial.print('.');
    Serial.println(GPS.milliseconds);
    Serial.print("Date: ");
    Serial.print(GPS.day, DEC); Serial.print('/');
    Serial.print(GPS.month, DEC); Serial.print("/20");
    Serial.println(GPS.year, DEC);
    Serial.print("Fix: "); Serial.print((int)GPS.fix);
    Serial.print(" quality: "); Serial.println((int)GPS.fixquality); 
     Serial.print("Satellites: "); Serial.println((int)GPS.satellites);

    
    if (GPS.fix) {
      Serial.print("Location: ");
      Serial.print(GPS.latitude, 4); Serial.print(GPS.lat);
      Serial.print(", "); 
      Serial.print(GPS.longitude, 4); Serial.println(GPS.lon);
      Serial.print("Location (in degrees, works with Google Maps): ");
      Serial.print(GPS.latitudeDegrees, 4);
      Serial.print(", "); 
      Serial.println(GPS.longitudeDegrees, 4);
      
      Serial.print("Speed (knots): "); Serial.println(GPS.speed);
      Serial.print("Angle: "); Serial.println(GPS.angle);
      Serial.print("Altitude: "); Serial.println(GPS.altitude);
      
        if (GPS.fix) { 
        if (GPS.latitude => 5130.428N && GPS.lattitude <= 158.6503W) {
            // do something with servos to open the doors
     }       }++

   }
}
   
     

#include <Servo.h>

Servo servoleft;  // create servo object to control a servo
// twelve servo objects can be created on most boards

Servo servoright;

int pos = 0;    // variable to store the servo position

void setup() {
  servoleft.attach(9);  // attaches the servo on pin 9 to the servo object
  servoright.attach(10);
  
servoleft.write(10); // start is 10 go to 115
servoright.write(170); // start is 170 go to 70
  
delay(1000); 
  
  servoleft.write(125); // start is 10 go to 125
  servoright.write(55); // start is 170 go to 55
delay(10000);
  servoleft.write(10); // start is 10 go to 115
  servoright.write(170); // start is 170 go to 70
  }
        
        }
   }
  }

--

Gyrobot

unread,
Feb 24, 2016, 3:17:59 AM2/24/16
to swindon-hackspace
Hi Gary/AJ,

I suspect we will have a look at the code tonight for you.

Here are the printed parts with increased capacity which I will bring in tonight:


Cheers,

Steve.

gary hooson

unread,
Feb 24, 2016, 1:23:37 PM2/24/16
to swindon-...@googlegroups.com
Looks fantastic mate appreciate you printing it out! Will see you soon

Gaz
--
Reply all
Reply to author
Forward
0 new messages