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

QuadX - my latest Propeller with Propellers

JasonDorieJasonDorie Posts: 1,930
edited 2015-04-09 06:03 in Robotics
This is a project I've been working on for some time, and it's gotten to a point where I think the code is mature enough to release.

I'm including two things here : The code for the quad itself and the executable and source for the configuration program.

The quad code supports flying in a + or X configuration, as well as a couple different mounting options for the gyro. My quad uses the X configuration, and has the gyro rotated 90 degrees counter-clockwise. If you are going to use a different setup, you'll need to change the configuration appropriately, either in the code, or using the config program. Please note that I have done basically NO TESTING of anything but my own frame setup. I'm working on building a new frame so I can do so, but haven't yet. Whether you use the same setup as me or not, you should do some very basic tests before attempting to fly to ensure that the four motors respond appropriately to flight stick input.

I do not have a schematic, however the amount of soldering involved is very minimal. I use a single Propeller ProtoBoard, an ITG-3200 gyro breakout from SparkFun, eight 3-pin headers to connect the remote receiver and ESCs to, and four 10k resistors between the receiver and the Prop. All the pin numbers are documented at the top of the main SPIN file.

Note that this quad is NOT self leveling or self hovering. It flies like a helicopter, albeit a very stable one. If you have never flown an R/C helicopter before, find someone who has, or practice in a large, flat, grassy area like a soccer field. Do not try to fly it in your living room, garage, driveway, or anywhere near people or things.

Edit: I have added the new Servo8Fast.spin object that allows arbitrary pin assignments, and control of both fast (250hz) and slow (50hz) outputs from a single driver. It is not currently used by the QuadX code, but will be in a future update.

856 x 639 - 132K
856 x 639 - 81K
856 x 639 - 118K
«134567

Comments

  • ratronicratronic Posts: 1,451
    edited 2011-12-20 19:38
    Very cool Jason! I have been studying your last quadx code you posted and have this sparkfun imu already ordered.
  • Tom CTom C Posts: 461
    edited 2011-12-21 06:37
    @ratronic,
    Used to pass through Bakersfield on my way to visit my parents in Modesto until I moved to TX.

    I received both the ITG3200 and the ADXL-345 from Sparkfun this week. I have ordered a Gadget Gangster Propeller Platform USB and the ProtoPlus board to act as a shield for the sensors and Receiver/ESC connections. The rectangular shape of the Propeller Platform will fit better in my Rad Rotary quad than the Parallax Propeller Protoboard which presently has an Arduino Uno and an Aeroquad v 1.6 Shield.
    Regards,
    TCIII
  • Don MDon M Posts: 1,652
    edited 2011-12-21 19:27
    Jason- what did you use for the on-board camera?
  • JasonDorieJasonDorie Posts: 1,930
    edited 2011-12-21 19:57
    Don - it's a GoPro HD Hero. The field of view is wider than I'd like, but the camera is small & light, and the video quality is pretty good.
  • Tom CTom C Posts: 461
    edited 2011-12-25 10:20
    Hi Jason,
    Your QuadX spin code is missing the following code: Basic_I2C_Driver. This driver is not in the Propeller Library and is not in your spin code file. Do you still intend to use this Driver written by Mike Green in 2007 or update to one of the newer drivers?
    Regards,
    TCIII

    Basic_I2C_Driver.spin
  • JasonDorieJasonDorie Posts: 1,930
    edited 2011-12-25 11:56
    It was intended to be included - it's a small, simple object (no extra cogs) used to write configuration info to the EEPROM. I'll add it to the original zip.
  • Tom CTom C Posts: 461
    edited 2011-12-25 12:23
    JasonDorie wrote: »
    It was intended to be included - it's a small, simple object (no extra cogs) used to write configuration info to the EEPROM. I'll add it to the original zip.
    Hi Jason,
    Your latest QuadX code compiles correctly when the Basic_I2C_Driver object is added to the library. However, when I load the compiled code, I get nothing but garbage coming back to the Propeller Terminal. I fell back to your code from around October 2011 and even though it is kind of bare bones, I found that I am getting output from the Gyro and it changes as I move the Gyro around in P/R/Y. Something is happening with the latest code that causes it to output garbage.
    Regards,
    TCIII
  • JasonDorieJasonDorie Posts: 1,930
    edited 2011-12-25 17:25
    The info it sends through the serial cable isn't meant to be human readable - it's binary packets for the ground station, which will graph the data as it's received. If the ground station isn't showing anything when you connect them, it's possible that I messed something up, or that you have more than one USB to serial device active - the code assumes the first serial device past COM4 is the Prop.
  • Tom CTom C Posts: 461
    edited 2011-12-25 18:34
    JasonDorie wrote: »
    The info it sends through the serial cable isn't meant to be human readable - it's binary packets for the ground station, which will graph the data as it's received. If the ground station isn't showing anything when you connect them, it's possible that I messed something up, or that you have more than one USB to serial device active - the code assumes the first serial device past COM4 is the Prop.
    Hi Jason,
    Thanks for the info. Much appreciated. I changed the Propeller code baud rate to 406800, detached my FTDI cable and began to receive Gyro data. However, the communication seems to be only one way. I can receive Gyro data, but the Get Current and Apply Settings buttons do not seem to work. Regards,
    TCIII
  • ercoerco Posts: 20,257
    edited 2011-12-26 14:20
    Jason: Fantastic project! Thank you for posting details. With our twins, it will be a while before I can build one of these, but I'm living vicariously through your project postings & videos. Great job!
  • JasonDorieJasonDorie Posts: 1,930
    edited 2011-12-26 15:20
    Thanks, Erco! It's a fun toy. It's also a bit of a teeth-clencher when flying it around really fast or really high. Having it 40 feet off the ground without the self-leveling working makes me very nervous.

    Tom - I re-uploaded the QuadX package and made sure all the comm speeds were set to 115,200, and that my quad was sending valid data to the ground station when flashed with this code. I also included the missing Basic_I2C driver.
  • Tom CTom C Posts: 461
    edited 2011-12-27 08:49
    JasonDorie wrote: »
    Thanks, Erco! It's a fun toy. It's also a bit of a teeth-clencher when flying it around really fast or really high. Having it 40 feet off the ground without the self-leveling working makes me very nervous.

    Tom - I re-uploaded the QuadX package and made sure all the comm speeds were set to 115,200, and that my quad was sending valid data to the ground station when flashed with this code. I also included the missing Basic_I2C driver.
    Hi Jason,
    The updated Ground Station code works great as it is smoother and is able to update the EEPROM settings. Much appreciated.
    I will implement the Gyro configuration changes per your email suggestion. Might get it work after all.
    Regards,
    TCIII
  • Tom CTom C Posts: 461
    edited 2011-12-27 20:24
    Hi all,
    It looks like my Sparkfun ITG-3200 Gyro is toast. It would never give a stable output when used with my Parallax Propeller even when level. I attached it to an Arduino Nano and used the demo code supplied by Sparkfun to confirm the state of the Gryo.
    The demo program displayed the following raw data rates for the X, Y, and Z axed: -63,~ 4, and ~5 when level. However, when I moved the Gyro in any axis, no matter what direction about the axis, the readings went all over the place indicating a defective Gyro. I always use a static safe work station with grounding strap and a grounded tip Weller solder station so how the part became damaged is a mystery. Word to the wise here: Be as careful as possible with this Gyro as it seems that it can be easily damaged even with proper safegards. I cannot return it to Sparkfun since I added the two pull-up resistors to the board. It might be best to use off-board pull-up resistors incase you have a defective Gyro and then you can return it for a replacement.
    Regards,
    TCIII
  • Cats92Cats92 Posts: 149
    edited 2012-01-07 06:32
    Hello Tom ,

    as you do I am using a Gadget Gangster Propeller Platform USB and the ProtoPlus to test parts of Jason program.


    ITG3200 and ADXL345 seem to work and also give results with the DCM program and visualizer.


    For the moment it is only tests on a stand before trying to fly.


    Jean Paul
    600 x 399 - 101K
  • Tom CTom C Posts: 461
    edited 2012-01-07 07:06
    @Cats92
    I think that I received a damaged ITG3200 from Sparkfun as it just would not give stable readings when level nor when tilted in any axis. The test with the Arduino Nano confirms that it would give a quasi stable reading when level, but the readings were random +/- values when tilted in any axis. I have another ITG3200 Gyro from Aeroquad on one of their Shield boards and it works fine. I might take the Gyro to work and check it under a microscope to make sure the pullup resistors are soldered on correctly. However I initially used off board pullups and the Gyro acted the same way as with the onboard pullups. This is not the first time that I have had a defective product from Sparkfun that I could not return for a replacement. I must say that Jason was most helpful with the troubleshooting and went out of his way over the Christmas holidays to help me troubleshoot the Gyro.
    Regards,
    TCIII
  • ratronicratronic Posts: 1,451
    edited 2012-01-07 07:44
    Tom can you post the program your using to read it?
  • Tom CTom C Posts: 461
    edited 2012-01-07 10:50
    ratronic wrote: »
    Tom can you post the program your using to read it?
    ratronic,
    I was using Jason's Ground Station application and the readings were going all over the place when I tilted the Gyro on the Gadget Gangster Propeller Platform USB. I have another ITG3200 mounted on an Aeroquad Shield board and it correctly outputs raw gyro data when tilted about all three axes. I used the Sparkfun Arduino code with an Arduino Nano to confirm the operation of the Gyro.Parallax will not allow the .pde file to be uploaded. However here is a link to the application on the Sparkfun website: http://www.sparkfun.com/tutorials/265
    Someone had messed with the code and inserted Degrees where the raw data should have been. Once I corrected that error, I was able to receive raw data from the Gyro. The Sparkfun app basically sets the Gyro up per the Inversense application instructions. I was able to get a stable raw data reading of X: -63, Y: 5, Z: 8 when the Gyro was level. But when I rotated it about any of the axes, no matter what direction I moved in, I would get wild +/- raw data outputs indicating a defective Gyro.
    Regards,
    TCIII
  • ratronicratronic Posts: 1,451
    edited 2012-01-07 11:20
    Tom I have found that when the gyro is barely even touched the readings go wild but when it comes to rest in the new position they should calm back down to around what they were before you moved it.
  • Tom CTom C Posts: 461
    edited 2012-01-08 09:27
    ratronic wrote: »
    Tom I have found that when the gyro is barely even touched the readings go wild but when it comes to rest in the new position they should calm back down to around what they were before you moved it.
    Hi Dave,
    I reworked the pullup resistors on the Gyro and checked it out again on my Arduino Nano. As you indicate, the readings are very stable at rest, go wild when moved, and then restabilize when at rest again. On the Nano, the at rest values are very stable varying only +/- a couple of raw units. I wish that I could say the same about when the Gyro is attached to the Propeller. Since I reworked the pullups, the readings on Jason's Ground Station look better than before, but are still quite noisy and do not converge anywhere near zero for each axes at rest like Jason's values above. Very strange to say the least.
    Regards,
    TCIII
  • ratronicratronic Posts: 1,451
    edited 2012-01-08 10:57
    Hi Tom I have modified his code so it will read the accellerometer and the gyro to use with this IMU. I went ahead and changed the address for the gyro back to 0x69 which is the address I believe for your board. If your gyro doesn't read right with this code then perhaps you do have a bad gyro.

    Edit: Loaded proper file.
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-01-08 12:02
    Tom: are you holding the gyro, or is it otherwise moving for the two seconds after you power up the board? During this time is when the gyro figures out its at-rest baseline, so if it's moved before it computes that your readings will be bad.
  • Tom CTom C Posts: 461
    edited 2012-01-08 14:23
    JasonDorie wrote: »
    Tom: are you holding the gyro, or is it otherwise moving for the two seconds after you power up the board? During this time is when the gyro figures out its at-rest baseline, so if it's moved before it computes that your readings will be bad.
    Hi Jason,

    The Gyro is still during the first two seconds or more per your instructions. The Gyro is laying on a flat surface during start up. It is laying on the same flat surface whether I am testing with the Arduino Nano or the Gadget Gangster Propeller Platform USB.
    Regards,
    TCIII
  • Tom CTom C Posts: 461
    edited 2012-01-08 14:26
    Hi Dave,
    Thanks for the modified code. I will give it a try shortly.

    That did the trick Dave. Much appreicated. I have not looked at your modified code yet, but it will be interesting to understand what modifications you made to Jason's ITG-3200-pasm.spin code to get it to work so well. In my case, it looks like I need the accelerometer input to provide stable Gyro output. I wonder why my setup will not give stable output without the use of the accel? Jason is able to get stable output without the accel. What gives?

    Attached is a screen shot using Dave's ITG-3200-pasm-mod.spin code while the second screen shot shows Jason's original ITG-3200-pasm.spin code.

    Regards,
    TCIII
  • ratronicratronic Posts: 1,451
    edited 2012-01-08 19:10
    Tom the corrections I made were for the gyro address and a problem pointed out here later in that thread. Also the code I just posted has the call to the accellerometer commented out. Here is the code with both the accellerometer and gyro(yours).
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-01-08 19:31
    I never had an issue with the missing i2cstop calls or the missing NAK on the accelerometer read, but I know others have so I've added them to my version of the code. I've also made a variable for the ITG address and a couple other minor things. I'll be posting the new quad code as soon as I have a chance to finish tweaking it, which should be soon.
  • Tom CTom C Posts: 461
    edited 2012-01-08 20:14
    Dave,
    So the modified code that you directed me to still only uses just the Gyro and no Accel, right? I guess that the missing NAK fix worked for me which is demonstrated by the screen shots above. Thanks for the help. Now on to incorporating the Accel input.
    Regards,
    TCIII
  • ratronicratronic Posts: 1,451
    edited 2012-01-08 20:24
    Tom that thread uses both but his QuadX code only uses the gyro.
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-01-09 03:04
    I spent the bulk of Saturday designing and cutting my new frame, so hopefully I'll be back up and running in a few days. I have to solder the wire harness which will take a good chunk of time, but I have a board almost completely ready to go. The new frame was designed with mounting holes to make it work as either a + or an X, has a hanging battery tray (so I can mount a camera under it), and has a top cover (so I could mount the camera over it). It has holes cut in the motor mounts for LEDs, clamps the booms instead of drilling through them so wiring is simpler, and has rubber post mounts for the flight board which should help with vibration.

    I've attached a few pics - I'm quite happy with how it turned out.
    778 x 581 - 89K
    778 x 581 - 92K
    778 x 581 - 82K
    778 x 581 - 89K
    778 x 581 - 89K
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-01-09 03:09
    Tom C wrote: »
    Dave,
    So the modified code that you directed me to still only uses just the Gyro and no Accel, right? I guess that the missing NAK fix worked for me which is demonstrated by the screen shots above. Thanks for the help. Now on to incorporating the Accel input.

    The missing NAK & i2cStop calls are supposed to be there. The QuadX code currently only uses the gyro, but the ITG/ADXL driver is shared between that code and a version I'm working on that includes self-leveling. That code actually works, and is quite stable, but before I had a chance to finish tuning and cleaning it up I had a crash that wrote off my board (hence the previous post with my new frame). Once I have a platform with a gyro & accel combo up & running again, I can finish up the full stability code.
  • Cats92Cats92 Posts: 149
    edited 2012-01-11 11:05
    As I use a Gadjet Ganster Propeller Platform for this quad project . II want to use the 5 V of this platform for my radio receiver AR8000 power supply.

    (dont like to connect Propeller or Radio on the motors lipo battery BEC)

    But dont know how many mAh this receiver use ?

    Any idea ?

    Jean Paul
Sign In or Register to comment.