Shop OBEX P1 Docs P2 Docs Learn Events
Quad/Hexa-Copter using Propeller, Gyros, Accelerometers, Compass, Pressure & GP - Page 10 — Parallax Forums

Quad/Hexa-Copter using Propeller, Gyros, Accelerometers, Compass, Pressure & GP

17810121317

Comments

  • heaterheater Posts: 3,370
    edited 2010-04-26 10:47
    How on earth do those NG copters get off the ground?
    That stack of electronics looks huge and heavy. Not to mention top heavy.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • Robert TRobert T Posts: 71
    edited 2010-04-26 12:05
    Cluso

    I wrote a simple program in Spin last night to test the ESC/motor. It appears that the ESC has a safety feature. The ESC seems to require a 1ms pulse(motor off) on startup. I suppose this is meant to keep the motor on RC models from running when the transmitter/receiver is turned on.

    Concerning the aluminum struts, I noticed on my wooden test platform, that the struts flex some when more power is increased to the motors and their was some vibration initially. Not sure if this will significantly affect performance. I wonder if they chose aluminum for cost, ease of use and/or stiffness. I am sure aluminum would be cheaper and easier to modify.
  • Cluso99Cluso99 Posts: 18,066
    edited 2010-04-26 15:22
    @Robert: Yes the ESC has a safety feature that requires the motor to be off initially. You will note I wrote a program too and have posted it to the OBEX. You can vary the speed in 12.5% increments using the PC and keys 0..8 for 0%..100%.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
    · Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
  • Robert TRobert T Posts: 71
    edited 2010-04-30 12:28
    I am writing a simple program to read the inputs for Throttle, Aileron, Elevator and Rudder from the Receiver and then converting this information to outputs for the four motors.

    It seems that reading the four receiver inputs will require four separate cogs(one for each pin). Initially I considered using a single cog to cycle through all four pins. This may adversely affect the response time since the inputs from the receiver are independent(not synchronized). The code would first have to wait for the pulse to be low before reading to be certain that one did not start reading the middle of a pulse. With four separate pulses, it seems that there could be significant delays in response time and some pulses could be missed.

    Correct me if I am wrong, but using cognew with assembly, loads the assembly program into cog RAM for execution. Therefore a single assembly routine could be written for all four receiver input programs. The assembly routine would be copied into the cog RAM four each cog. It doesn't look like Spin code is copied into the cog RAM.

    So, four cogs each reading a single pin for each of the receiver outputs and a single assembly routine written that would be duplicated in cog RAM.

    The output to the motors should require only one cog though. If each pulse has a maximum duration of 2ms and is sent every 20ms, then one should be able to send out 4 different signals within the 20ms interval.
  • hover1hover1 Posts: 1,929
    edited 2010-04-30 13:29
    Rich was able to read 2 pins per COG with this program:
    RX input / RC Receiver Input
    Kye did one also
    Dual Servo Driver
    Jim
    Robert T said...

    It seems that reading the four receiver inputs will require four separate cogs(one for each pin). Initially I considered using a single cog to cycle through all four pins. This may adversely affect the response time since the inputs from the receiver are independent(not synchronized).
  • Cluso99Cluso99 Posts: 18,066
    edited 2010-04-30 13:48
    The RC Receiver only has one channel active at a time, just like you are planning to do with the motors.

    There is a servo program in the obex that will read many channels with the one cog.

    I have not yet tried shortening the offtime with the motor ESC. By shortening the off time to say 10ms you increse the response time since the prop code will be recalculating this much faster than this.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
    · Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
  • TimmooreTimmoore Posts: 1,031
    edited 2010-04-30 15:57
    Depends on the RC receiver, the majority of receivers output 1 at a time but not all, rcgroups.com has a good discussion on this topic. I tend to hack into the receiver to get the ppm stream and use that though I haven't tried that with any 2.4G systems and from reading rcgroups.com that wouldn't work, though they do have a serial stream that some people have used.

    If you are concerned there are a couple of boards that convert pwm to ppm though I haven't tried them, an example is http://www.nghobbies.com/cart/index.php?main_page=product_info&products_id=346&zenid=67f1c5e719cc5af974d2c9a9acb90657, diydrones.com has one as well (http://store.diydrones.com/product_p/br-ppme.htm). nghobbies.com also sell mikrokopter parts if you are interested, they are in canada.
  • Robert TRobert T Posts: 71
    edited 2010-04-30 17:02
    Thanks for all the input, I will rethink this and try one cog for all 4 Receiver channels
  • SzabiSzabi Posts: 58
    edited 2010-05-01 16:31
    Robert,

    1 input / cog? hmm.... However I never tried but with the two HW counters / cog a minimum of 2 inputs should be possible to read with a single cog(even in spin). Have you tried using them?
    I'm still waiting for my components to arrive, once I receive them will give a try.


    Szabi
  • Roy ElthamRoy Eltham Posts: 2,996
    edited 2010-05-01 17:12
    Robert & others:

    Attached is the code I am using to read my reciever signals. It reads up to 8 channels, they have to be on port pins P0-P7. It's PASM and runs in one cog. I got this from Jason Dorie's thread on the Completed Projects forum, and modified it to read up to 8 instead of up to 6 channels.

    Also, the comments say to use 4.7k resisters for the signal lines, but Jason used 10k resisters on his quadroter board, so I went with 10k resisters.· It's working fine for reading all 6 channels I have on my setup.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out the Propeller Wiki·and contribute if you can.
  • Cluso99Cluso99 Posts: 18,066
    edited 2010-05-02 02:39
    Thanks for the code Roy (& Jason).

    From my research, the series resistor is just for protection for the prop. The same applies when driving ESCs. So any value should work fine (100R-10K). I am placing provision for resistors on my pcb for all 16 channels.

    I have no doubt we can read the input channels with 1 cog in pasm without having to resort to the combined input modification as used for the 9DOF board.

    As I noted above, I have already driven the ESC and motor/propeller from the prop using a pc keyboard.

    Here is what I am thinking for the next test phase... We only use the prop for reading and controlling the motors. No sensors are used. We could do a minimum flight in this mode.
    • connect the RC receiver (3 channels: X,Y & speed) to the prop (using 1-2ms on and 20ms off)
    • connect the 4 ESC/motor/propeller combos to the prop (using 1-2ms on and 20ms off)
    • 1 cog reads the RC Receiver channels
      • X is for Pitch
      • Y is for Roll
      • Speed is obviously the motor speed
    • 4 cogs (for now) drive the 4 ESCs
      • Front (XF)
      • Aft (XA) i.e. rear
      • Left (YL)
      • Right (YR)
    • 1 cog does the calculations

    When the XY stick is central, the motor speed is the same for all 4 motors. The RC trims can be used to get the craft stable. The speed now controls the motor speed to all motors and we limit the stick (scale) to just enough speed to slowly lift the craft. So·2ms on (full speed) may actually be scaled in spin to say 1.4ms (40%). This means we can now move take the craft and slowly takeoff and land.

    The XY stick is used like and aircraft stick. If we move the stick left, it slows the Left motor (YL) and increases the Right motor (YR). If we push the stick forward, the Front motor (XF) is slowed and Aft motor (XA) is increased. Once again we scale the stick so that the full scale only provides a small change in speed.

    The idea here is to get used to using the RC controls with the sticks just doing very minor changes to the craft. We will have slowed (scaled) down the stick responses, hopefully giving plenty of time to prevent crashes.

    All this is relatively simple and easy to do in spin and should allow us to do some simple flying.

    How does this sound???

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
    · Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
  • Roy ElthamRoy Eltham Posts: 2,996
    edited 2010-05-02 03:01
    Cluso99:
    You can use Servo32v7 from the OBEX to drive all 4 (or 8 or more) ESCs from one cog. It works great.

    I had a setup like you describe, just using the rc-receiver and servo32, it's REALLY difficult to get the craft to be stable without sensors.

    I am still working on my "revised" setup with 3 LISY300 gyro's and the H48C. Hopefully, in a week or so I will have some progress to share.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out the Propeller Wiki·and contribute if you can.
  • Ole Man EarlOle Man Earl Posts: 262
    edited 2010-05-02 04:49
    I got off on a tangent... here is my quad so far..
    Earl
    1600 x 1200 - 836K
  • Cluso99Cluso99 Posts: 18,066
    edited 2010-05-02 07:30
    OME: Nice. What motors are you using and is the beam carbon fibre and what size?

    Roy: Thanks. I know I can drive multiple servos from the 1 cog but just thought it would be easy to knock up something simple. I thought maybe the craft would not be too unstable to have a little go at flying. Guess I may find out the hard way - but I will keep it on a tight string so it cannot flip. You are progressing well.

    I have just received a new microSD socket suitable for the electronics pcb - it is a locking type.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
    · Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
  • hover1hover1 Posts: 1,929
    edited 2010-05-02 19:22
    @Earl

    Welcome back! It's been 8 months!

    I hope you can join us in this project. You have over a year in this area, so I have to call you expert! Looking forward to some of the info that you have learned over at DIY Drones.

    Jim
  • KimboKimbo Posts: 5
    edited 2010-05-03 16:59
    Just a reference point from the nghobbies.com listing for the Mikrocopter it indicates the following is used:
    " The Mikrokopter flight controller uses a special PPM signal which contains the pulses for all channels in one stream"

    The part listing and image for the part is:

    http://tinyurl.com/22ujzwp


    3d camera for first flight view, pricey at ~$350 but the
    feedback from the plane/coper to the control stick would
    help learn to fly and give the operator some part in the total
    stability. The plane to stick feedback is about 1/2 way into video.



    Post Edited (Kimbo) : 5/3/2010 5:20:35 PM GMT
  • Ole Man EarlOle Man Earl Posts: 262
    edited 2010-05-03 17:51
    Yes, the DIY project is a nice one. My quad is using the ArduIMU for sensors and control. For $99 it is a bargain.
    BTW I am having a fly-in here in NM on the 14-17 of May. Everyone is welcome. Quads, planes, and whatever. This is on 160 acres so plenty of room.
    Earl
  • Ole Man EarlOle Man Earl Posts: 262
    edited 2010-05-07 02:00
    768 x 614 - 71K
  • Robert TRobert T Posts: 71
    edited 2010-05-07 03:42
    Motor Test Code:

    Ok, so I can't figure out how to send my code through the Object Exchange so I will make it an attachment.

    It basically code to test the motors and control board. I am using the robot control board. The code is a combination of Spin and Assembly. This is my first original code in both. Comments are welcome!

    I will next write code to get the input from the RC Receiver and convert the RC pulses into Motor pulses. After that, its on to adding sensor input for motor control and finally GPS and obstacle avoidance.
  • Cluso99Cluso99 Posts: 18,066
    edited 2010-05-07 20:37
    OME: I note that this website shop says all items they have are out of stock (1 exception). Are they still in business? The frame looks excellent - do you know the beam sizes?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
    · Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
  • hover1hover1 Posts: 1,929
    edited 2010-05-07 21:23
    I bet you we could get get Phil to cut the same center frame out with his new toy!
    Jim
  • Ole Man EarlOle Man Earl Posts: 262
    edited 2010-05-07 22:30
    Just use some old printed circuit board material that's been wiped clean. Like old motherboards. The hard part is sanding or sawing off all the old parts but the material left is strong and light weight. The arms are 10mm x 10mm. I am sure home depot would have something like that.
    The reason I pointed out this site is the price is right and all the drilling is done and the nuts and bolts are there. Saves a ton of time.
    They just opened the store so it may take a while to get some stock.
    This is just some hobbyists doing this, not a big commercial venture so have patience.
    I have not ordered mine yet. I made mine but boy, it was sure a lot of work.
    Earl

    Post Edited (Ole Man Earl) : 5/8/2010 9:34:50 PM GMT
    1600 x 1200 - 514K
    1600 x 1200 - 926K
    1600 x 1200 - 867K
  • Robert TRobert T Posts: 71
    edited 2010-05-11 03:03
    Here is the test code for the RC Receiver. I have used the Serial Terminal to output the values of the four RC values: Throttle, Aileron, Elevator, Rudder.

    Please give me some feedback, some of the numbers seem to vary more or less than expected. Throttle seems to be most accurate and consistent.

    Next, write the code to interface the RC Receiver output to the Motor inputs.
  • JasonDorieJasonDorie Posts: 1,930
    edited 2010-05-14 21:36
    @Roy - That code was something I pulled out of the forums from someone else, though I don't have a name to give credit to.· The original code was set up for 8 inputs, but I culled it to 6 to increase the precision a little.· In fact, I've been thinking of trying to rewrite it to read two of the inputs with the hardware timers, and two more with a single cog, then put that code on two cogs for 8 high-precision inputs.· That said, I'm pretty sure that the version I have now is fine though - I really doubt that level of precision is required for the user input.

    I've been monkeying with my CNC machine lately, using it to etch PCBs for me, and I'm working on the next body prototype for my quad.
    Top:· http://www.facebook.com/photo.php?pid=5254925&l=78cfe16438&id=671403972
    Bottom:· http://www.facebook.com/photo.php?pid=5254926&l=5571f2f753&id=671403972
    Inside:· http://www.facebook.com/photo.php?pid=5254928&l=250311b184&id=671403972

    More to come when I actually have something working.

    Oh - If you haven't seen this, it might be of interest - It's a single chip, 3-axis, digital output gyroscope.
    http://www.sparkfun.com/commerce/product_info.php?products_id=9801

    Jason
    ·
  • Cluso99Cluso99 Posts: 18,066
    edited 2010-05-14 22:27
    @Jason:

    I am sure we can get the RC input precision required with just 1 cog. However, regarding the inputs from the gyro, accelerometer, compass and pressure/temperature I am unsure if we might want to split this between 2 cogs. Another cog will do the serial to the GPS and yet another to log data to a microSD card. So we are eating up cogs. And finally another 2 cogs will be driving the ESCs, although maybe we can do this in 1 cog later.

    The ITG-3200 that Sparkfun has is what we are using. I already have some direct from Invensense.

    Nice photos. Does the plastic case give enough strength to the arms of the quadcopter?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
    · Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
  • JasonDorieJasonDorie Posts: 1,930
    edited 2010-05-14 23:20
    Why 2 cogs for the ESCs? Just curious - I have a modded version of Servo32 that updates 8 servos @ 200hz instead of 32 @ 50hz. I assume you're doing something similar?

    As for the plastic case, I need to extend the case outward more just to give me more room to bolt the arms to. As is, the contact area with the case is small enough that they're a bit loose. I'm considering running channels through the bottom of the body instead, as that would offer much more support. This one was as much to give me practice with the modelling software and cutting process as anything else.

    I'm also limited as to the body thickness I can produce, as my plastic sheets are only 3/4" thick. I think I may pick up some 1" to give myself more room to work with.
  • Robert TRobert T Posts: 71
    edited 2010-05-15 00:34
    You should be able to run the ESCs off of one cog without any loss in performance. Assuming the period is 2 milliseconds and the maximum pulse duration is 2 ms, then up to 10 pulses could be placed in one period. Look at the code I posted earlier in this thread. I divided the period into quarters and sent one pulse in each quarter.

    I also used one cog to read four Receiver Inputs.

    I am trying to save as many cogs as possible for IMU, GPS, Camera mount, etc

    Jason: Very cool frame. I like the way it protects the circuit board.
  • TimmooreTimmoore Posts: 1,031
    edited 2010-05-15 01:41
    Jason, how much of a difference did it make changing the esc update from 50 to 200Hz? The reason is that my IMU code does 48 updates a sec for 3 axis using 1 cog. To make it go faster I would have to split the different axis into different cogs e.g. using 3 cogs it should be able to go 3x faster. If thats the case then cogs are going to be scarce. In comparision the arduimu updates as 50Hz to match the motor update rate.
  • Cluso99Cluso99 Posts: 18,066
    edited 2010-05-15 02:20
    Yes I am sure we can drive all the ESCs from a single cog. It is just easy to use PWM and the counters if cogs are available. Long term they won't as we add other stuff.

    Jason, I had not realised you cut your own box - nice!!
    Is the plastic heavy? Is it rigid? I was wondering if you could cut some form of base for the arms with a screw top as a seperate piece. Using square or round pieces you could cut some holes to lighten while keping the plastic frame rigid.

    FWIW I am trying to fit the Prop pcb into the Hammond 1551 K or L box. Still unsure if I can achieve this but it would give the electronics protection and this box is also available in translucent blue. I have not done much on this in the last few weeks :-(

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
    · Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
  • JasonDorieJasonDorie Posts: 1,930
    edited 2010-05-15 02:25
    Tim - I mostly did it because I could, and because a number of microcopter / quadcopter pilots have stated that using a 300Hz update made a significant difference in stability. I haven't really seen it, personally. I think it's got a very slightly better feel to it, but I think better tuning of my PIDs would probably make more difference than a faster update rate.

    That said, there's a good chance that some simple changes to your IMU code would dramatically increase the speed. Remember that the SPIN compiler makes no attempt at code optimization, so easy things like constant folding, sub-expression re-use, and a few other tricks can make a very large difference. My IMU code (Kalman filter and PID loops, using float math) was originally about 50Hz, and is now about 250Hz if I remember right. It was based on Kalman code posted here a while back that included a number of "multiply by 1.0", "multiply by 0.0", and other such redundant operations.
Sign In or Register to comment.