Shop OBEX P1 Docs P2 Docs Learn Events
QuadX - my latest Propeller with Propellers - Page 3 — Parallax Forums

QuadX - my latest Propeller with Propellers

13567

Comments

  • ratronicratronic Posts: 1,451
    edited 2012-04-19 13:54
    Yes being a dummy I had just plugged them in at P8 from your comments without paying attention to the variable names. I haven't even properly mounted the board yet, it's just velcroed in place with a cushion tight enough to keep proper alignment. But your QuadX-V2 works on the Elev-8 chassis. The only modification I made was to replace the data variables with the ones you wrote for the Hoverfly sport board. Here is a quick flight I took today using this setup. Kind of a rough landing at the end, but hey I'm still a beginner pilot!
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-04-19 14:43
    Awesome! I like it when they come out nice & stable like that. :)

    Those landings will even out with a little practice. You actually need more than hovering throttle to slow your descent - it takes some getting used to.

    Nice job, Dave! It's great to see another one in the air.
  • ratronicratronic Posts: 1,451
    edited 2012-04-19 19:58
    I have my gear channel hooked up for gain and when I flew in that video the switch was up which outputs 1658us, 158 with your getrc method so I take it I was flying with the filter moderate switched in? I will figure out a way to use the three filters and with them off to see what difference it makes.
    if( Gain > 300 )              '(gear up, aux2 up)   
      Gx += Filter_Light ** (GXLP - Gx)                 
      Gy += Filter_Light ** (GYLP - Gy)                 
      Gz += Filter_Light ** (GZLP - Gz)                 
    elseif( Gain > 100 )                                
      'Low pass filtered numbers   (gear up, aux2 mid)  
      Gx += Filter_Moderate ** (GXLP - Gx)              
      Gy += Filter_Moderate ** (GYLP - Gy)              
      Gz += Filter_Moderate ** (GZLP - Gz)              
    elseif( Gain > -300 )                               
      'Low pass filtered numbers   (gear up, aux2 down) 
      Gx += Filter_Heavy ** (GXLP - Gx)                 
      Gy += Filter_Heavy ** (GYLP - Gy)                 
      Gz += Filter_Heavy ** (GZLP - Gz)                 
    else                                                
      'Both switches toward me - filter off             
      Gx := GXLP                                        
      Gy := GYLP                                        
      Gz := GZLP
    
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-04-20 09:44
    I tend to use either no filter or light. Heavy introduces a bit of lag in the control loop, so the craft will oscillate a little. I think I could fix that by tuning the PIDs specifically for each setting, but mostly I had them on the gear switch so I could compare them in flight.

    A bit of filtering helps get rid of gyro noise from vibration and makes a huge difference for the DCM version of the flight code. It made less difference for the gyro-only code.

    You can change the code to look like this:
    if( Gain > 0 )                               
      'Low pass filtered numbers   (gear up)
      Gx += Filter_Light ** (GXLP - Gx)                 
      Gy += Filter_Light ** (GYLP - Gy)                 
      Gz += Filter_Light ** (GZLP - Gz)                 
    else                                                
      'No filter  (gear down)
      Gx := GXLP                                        
      Gy := GYLP                                        
      Gz := GZLP
    

    Then flipping the switch toggles between two settings, which is probably better for most radios.
  • ratronicratronic Posts: 1,451
    edited 2012-04-20 11:02
    After looking at the code I loaded for that last flight I had the gain set directly to zero trying to figure out my other problems so I guess I was flying with no filter. My next shot I will try it with the light and moderate filter settings. By the way I'm sitting on pins and needles to have a look at how you incorporate your DCM code with this!
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-04-20 13:14
    The DCM stuff is "working" but still needs some tuning, and the code still has some kinks that need sorting. For example, if you ever invert the quad, it behaves backward, and will try to hold itself inverted. This is Bad(tm).

    I some personal stuff to deal with recently (no one died or anything) that derailed my projects for a while, and just have a little less time for this stuff in general at the moment. I really need to get back on it and finish up the darn thing so I can get it out there.
  • ratronicratronic Posts: 1,451
    edited 2012-04-20 13:47
    That's ok Jason it took me a month after I built my board before I really sat down to troubleshoot (with Veiwport) what was going on. Take your time and put your "magic touch" to it. A time back I used to think I might try to write a Propeller program to fly a quad - little did I know what it entailed. Although now that I have followed what you have done I get a much better sense of everything happening. Take care of your personal stuff first and again I thank you for even sharing your stuff.
  • Brian CarpenterBrian Carpenter Posts: 728
    edited 2012-04-29 17:50
    Will your code fly a hex as well? What changes need to be made to gain this function?
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-04-29 22:14
    It has the ability to support more outputs, but you'd have to add the code to mix the six outputs correctly. The remainder of the code doesn't care what the configuration of the motors is. It should be relatively straightforward to add.
  • ratronicratronic Posts: 1,451
    edited 2012-04-30 10:36
    This morning Jason I was comparing some variables in Viewport. Looking at them in scope mode while holding the quad by hand at about hover throttle not touching the Aileron stick but slowly rocking back and forth in the x (roll) axis. This is a display of the igx(black trace) and the rollout (red trace) variables, interesting! I think I can use Viewport to change the PID variables live, that will be my next experiment.
    1024 x 556 - 81K
  • JBWolfJBWolf Posts: 405
    edited 2012-05-03 01:35
    Hey guys! Excellent job so far, looks like alot of fun!
    I've been watching this thread for a while and have decided to build one now that I have some time available.

    One thing I noticed, looks like you could use a module that includes high quality gyro + compass + accelerometer.
    I saw the posted link for one of those, but at $150 I cannot currently afford one.
    I happen to be very good with circuit design and decided to take a look at building one from scratch to make it affordable.
    I believe I can accomplish this task for around $40 using these 3 chips:
    L3G4200DTR - 3axis gyro, same one used on the parallax gyro - Digital I2C & SPI
    http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00265057.pdf

    HMC5883L-TR - 3-axis Compass, Decent sensitivity - Digital I2C & SPI
    http://media.digikey.com/PDF/Data Sheets/Honeywell PDFs/HMC5883L.pdf

    BMA250 - 3axis Accelerometer - Newest model with best sensitivity and features. Digital I2C & SPI
    http://www.bosch-sensortec.com/content/language1/downloads/BST-BMA250-DS002-02.pdf


    All 3 chips will work with 3.3vdc, total current draw is less than 200ma combined... so this means I can make a single PCB with all 3 chips on board, and it can be directly connected to the same 3.3v regulator powering the prop chip.
    I am not so good with the software however, but it seems you guys are :)
    If you think this is worthwhile for use with the QuadX, I will build a few prototypes for you to integrate so we can eventually all use them.
    I will have to charge for them, but I would only ask the actual cost... I like the idea of keeping this affordable for everyone.
    I own a CNC so I believe I can design and cut the PCB's to be as small as possible.
    What do you think?

    Once you are completely done and have a set parts list... If desired, I am confident that I can make a circuit board all inclusive for your QuadX project to save weight and space.
    For example, here are some pics of a board I made for a customer using the 44QFP prop chip. It's a laser show system controller, drives up to 3x lasers and 2x bi-polar stepper motors plus a few buttons for user configurations all on one board powered by a single DC input.
    1024 x 768 - 54K
    1024 x 633 - 124K
    1024 x 768 - 117K
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-05-03 12:45
    Hi JB,

    You might be interested in this module: http://www.pololu.com/catalog/product/1265

    It's got the L3G4200D you mentioned on it, along with a compass and accelerometer. I have one of these on a board at home and have a driver running for the gyro / accel pair already. I believe I have the compass reading, but haven't added the stuff necessary to orient the compass properly and handle the gains, or gotten it integrated into the IMU code yet.

    Whichever components you end up going with, the IMU driver code should be reasonably easy to change to make it work. I've tried to set the code up to be relatively easy to change just that piece without affecting much else, with the exception of a few scale factors. All the different gyros and accelerometers have different ranges, so that needs to be adjusted for.

    I'm currently using the ITG3200 and ADXL345 and having excellent results with them, but I have a bunch of sensors from Parallax to add code for, and I think the compass you mentioned is one of them.

    One of the nice things about the QuadX project so far is that it's been simple enough for someone with a little bit of soldering skill to put together on their own, but I certainly like the idea of having an all-in-one solution available as well. I'll be very interested to see what you come up with.

    Keep us posted on your progress!

    Jason
  • JBWolfJBWolf Posts: 405
    edited 2012-05-03 18:52
    Oh wow I did not notice that one before... at $50 its a bargain.
    I noticed it does not have any interrupt pins, this will be my first time usin a gyro and accelerometer, so I dont know anything about how to use them yet.

    Should I purchase that one for use with this QuadX?
    Not sure what your software was written for... and is the latest software in the first post or is that the full code in #65?

    Can you please recommend the best way to build?
    Maybe a general parts list... from what I have gathered I will need:
    Working prop chip
    gyro + accelerometer
    4x servos (fan motors)
    remote control + receiver
    power supply battery
    Frame
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-05-04 18:19
    The QuadX software is currently written using an ITG3200 and that's it. I am adding support for full leveling using an ADXL345, but I also have a version of my IMU driver written for the Pololu MinIMU-9, so with changes to a couple constants in the flight code, it should work with that chip as well. (I haven't published that driver yet I don't think, but it's ready to go, I just haven't been able to flight test it yet).

    So, if you want to get into the air as quickly as possible, I'd recommend the ITG/ADXL combo, just because that's what I'm using and I've had success with those components so far. The ITG is also the gyro used by the Hoverfly board.

    You don't need an interrupt line for these - you can just read them at a preset rate and that seems to work quite well. The Hoverfly board actually has the interrupt line connected, but they don't use it.

    The latest published version of the code is in the first post. Your list of parts is pretty complete. I recommend using the same parts list for electronics as the Elev-8 kit as that's extremely close to what I'm flying with my setup, and I know for a fact they're compatible. I use a very slightly modified version of the QuadX code for the Hoverfly board with the Elev-8 hardware and it flies well.

    For the remote + receiver combo, it depends on your budget. A Spektrum DX6 or DX7 work really well, but you can get away with pretty much anything - The QuadX code can be flown with a 4-channel radio. More will be needed if you want to control things like filtering or auto-level in flight, but the current (posted) version of the software doesn't support that yet anyway. :)

    I'll take a look at my current setup and see if I can put together a better list of recommendations, but for the time being I'd suggest looking at the parts for the Elev-8 platform, as that setup is known to work and won't be any more expensive that anything I'd suggest.

    Jason
  • Brian CarpenterBrian Carpenter Posts: 728
    edited 2012-05-08 07:42
    does your current code work on the hoverfly open?
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-05-08 12:27
    The current code won't work without pin changes, as the Open is not pin compatible with the Sport. I have an Open board and a pinout for it and will be making a version for it very shortly. There's a strong chance that it'll just be pin changes, but I can't say for certain until I actually do it.
  • rpdbrpdb Posts: 101
    edited 2012-05-15 22:21
    Great job Jason,

    My Dad has a quad that he bought from Germany with a closed source pic877a board and can't get it to work. I took him to the Expo at Parallax and convinced him to let me try to get it to fly with a Prop board.

    I got to see a bunch of great folks there, and finally got to meet Erco in person (he has got the "Big Banks" slammed on "RoBo signing").

    Now I have a Prop proto board to put on his quad. I need to find an ITG3200. I saw some where in some thread that Spark Fun might have a "black friday sale".

    Just thought I would throw this question out to this thread that if anyone knew if they have that often like "Parallax does the deal of the week".

    I have a Parallax LISY300 gyro and H48c accelerometer, but rather than work on massaging that SPI code I would prefer to work with what seems to become "JasonDorie Standard QuadX" platform, so I can get my Dad flying soon.

    Thanks for all Your work
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-05-16 13:07
    I have only ever used the Sparkfun board, however a brief Google search turned up this breakout for half the price: http://www.csgshop.com/product.php?id_product=49

    It is the same chip, so the interface should be the same. You'll need to figure out how the pins are arranged compared to the Sparkfun board, but there aren't that many of them - it should be relatively easy.

    And, if I remember correctly, the LISY300 is only a single axis gyro. You would need to use three of them to properly stabilize a quad.

    Welcome to the quad threads!

    Jason
  • Brian CarpenterBrian Carpenter Posts: 728
    edited 2012-05-16 23:54
    I placed an order from the shop you mentioned Jason. After waiting over a week for confirmation of shipping (13 in stock) I sent email for another week. No replys. Involved PayPal and received a refund. No explanation. Great looking board but no communication
  • rpdbrpdb Posts: 101
    edited 2012-05-23 18:13
    I ordered a board from sparkfun on last Wednesday and got it on Saturday. I recieved an imu #SEN-10121 (6 degrees of freedom board) from sparkfun and getting ready to solder to a prop proto usb board.

    I have a question if I have to change the address in the ITG-3200-pasm code.

    ITG-3200 Data sheet on SparkFun site states:

    "The slave address of the ITG-3200 devices is b110100X which is 7 bits long. The LSB bit of the 7 bit address is
    determined by the logic level on pin 9. This allows two ITG-3200 devices to be connected to the same I2C bus. When
    used in this configuration, the address of the one of the devices should be b1101000 (pin 9 is logic low) and the address
    of the other should be b1101001 (pin 9 is logic high). The I2C address is stored in register 0 (WHO_AM_I register)."

    SparkFun schematic shows pin 9 at gnd so I assume address is %1101000 or 0x68 wich is 8 bits.

    looking at code in ITG-3200-pasm, do I change address in DAT section to Gyro_ID long $D0 '<< 1 0x68 ????


    ADXL345 Data sheet on SparkFun site states:

    "REGISTER DEFINITIONS
    Register 0x00—DEVID (Read Only)
    D7D6D5D4D3D2D1D0
    11100101
    The DEVID register holds a fixed device ID code of 0xE5 (345 octal)."

    That is also an 8 bit address.

    looking at code in ITG-3200-pasm, do I change address in DAT section to Accel_ID long $CA << 1 0xE5 ???? or is it $1CA ?

    I have no compass. Will the code hang looking for one?

    Thanks
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-05-24 14:00
    The Gyro_ID of 0xD0 in the code is actually 0x68 shifted up by one. (look at the comment after it) The reason it's shifted up is because it saves a little work when communicating with the device - I have to send the I2C address, and then send a single bit which dictates whether it's about to read or write to the register. I just tack that bit onto the end of the device ID, but I have to shift the ID up by one spot to make room for it. (hopefully that makes sense)

    So, that's already the value you want. It looks like your ADXL value is correct too, so you don't need to change anything. Currently, the code only uses the gyro. The accelerometer is read, but the flight code doesn't make use of it, and there's no compass used either, so you're fine on all fronts.

    Jason
  • rpdbrpdb Posts: 101
    edited 2012-05-24 18:43
    Thanks Jason,

    This is the first time I work with I2C. I assume the gyro I recieved from spark fun uses the "0x68" address as stated on the Data Sheet. If I LSH 0x68 by 1 I get
    $D0. I just got confused looking at the Accel ID address on the data sheet of 0xE8 which is 8 bits, and curious if the MSB of the address is ignored.

    The QuadX-V2.zip on this thread has the ITG-3200-pasm code, the DAT section reads:


    'These values are the 7 bit I2C device IDs, shifted up one so the read bit can simply be OR'd on
    Gyro_ID long $D2 '0x69 << 1
    Accel_ID long $A6 '0x53 << 1
    Compass_ID long $3C '0x1E << 1

    FIT 496



    So I should change address in DAT section to

    Gyro_ID long $D0 '<< 1 0x68 ???? instead of the $D2 above

    I will try different values until I get a response on the Ground Station, I am just thinking out loud.

    Thanks for your work and posting your project. Have you any plans for an Altimeter for altitude hold? I am looking at sensors and wondering if you have any recommedations.
  • ratronicratronic Posts: 1,451
    edited 2012-05-24 19:11
    rpdb I have the same IMU as you and you will need to change the Gryo_ID in the DAT section to $D0.
  • rpdbrpdb Posts: 101
    edited 2012-05-25 01:04
    Thank you D.Rat,

    Does the X axis of the sensor bisect the angle of the LF and LR motors with Y to the front.for an X flying quad?
  • ratronicratronic Posts: 1,451
    edited 2012-05-25 07:15
    rpdb here is a picture of my board with the side of the IMU marked that is facing forward in my craft. Also which ever way you mount it you will need to make sure that the GyroOrientation variable in the DAT section in Main-GyroOnly.spin is set properly.
    640 x 480 - 193K
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-05-25 11:54
    rpdb wrote: »
    Thank you D.Rat,

    Does the X axis of the sensor bisect the angle of the LF and LR motors with Y to the front for an X flying quad?

    I think you're correct, but I don't recall off the top of my head, sorry - I'll have to take a look at my quad to tell you for sure. That said, it's quite easy to change in the code. There's basically a small blob of code that takes the gyro readings and adds them to iGx, iGy, and iGz. If you swap the Gyro.GetX and Gyro.GetY values around, or flip the signs, you can change how the code expects the gyro to be oriented.

    As for altimeter hold, that's something that I want to do eventually, but it'll take some time for me to get there. Work is starting to pick up, and summer's here, so I'm spending less time on my projects lately. I have a couple different accelerometers, compasses, and altimeters at home that I have to write drivers for. I also have a version of my code that's self-leveling and has support for a camera gimbal that's close to being ready to release, but I'm having vibration issues with the frame, so I can't tell if the code is solid yet or not. "Coming soon" is about as specific as I can be. :)
  • ratronicratronic Posts: 1,451
    edited 2012-05-25 16:24
    tono had asked me about reading his gyro with Jasons program, this isn't as fancy as Jasons ground station but it will display the gyro's output in decimal #'s to the Parallax serial terminal. You will need to set the Propeller port#'s in the main method of the atemplate.spin were they are commented. This is for the 6dof imu from sparkfun.
  • tonocastillotonocastillo Posts: 12
    edited 2012-05-25 16:31
    Thanks Dave! :D
    Much appreciated.
  • rpdbrpdb Posts: 101
    edited 2012-06-02 02:57
    Thanks Dave,

    I got my 6dof board hooked up and I changed the gyro address in the ITG-3200-pasm to $D0 and the accel id to $CA (don't know if this is correct, but I assume this from the data sheet at sparkfun address of $E5 <<1 = $1CA).
    .
    I also changed the call to gyro.start to (17, 16) for the _scl and _sda due to the layout of the 6dof board.

    I am getting x,y,z data with the gyrocheck that you posted, on the propterminal (connects to port 7 usb).

    My question is if you have had any success running the groundStation that Jason posted. I get nothing.

    I also tried his DCM visiolizer.exe and I get an error that com8 is not found.

    Just wondering if you got any of that to work?
  • ratronicratronic Posts: 1,451
    edited 2012-06-02 07:56
    rpdb yes Jason's ground station program and DCM visualizer gives a great graphic display of the gyro output / IMU position on the screen. In your case they might not be seeing the com port your Propeller is assigned. You can use Visual C# express (free) to set it up for your Propellers com port if the programs are not seeing it. Also I left the accelerometer address set to $A6. With this IMU with Jason's ITG-3200-pasm.spin program the Gryo_ID should be $D0 and Accel_ID should be $A6. I hope Jason doesn't mind my helping you guys out with his project. I am very interested in his development of this along the way.

    Edit: You will need to replace the ITG-3200-pasm.spin in the DCM Spin code folder with his latest version of ITG-3200-pasm.spin (in the QuadXV2 folder) to work with the DCM code with this IMU.
Sign In or Register to comment.