• Modified ArduPilot2.6 and ArduIMU to do interprocessor communications via TWI to free up USART for full-duplex serial comm's between ArduPilot and GCS; can upload PID coefficients in flight. IPC code example: twi_stuff.zip
  • Test flown in manual and stabilize modes, IMU appears to be consistently and accurately reporting attitude.
  • Stabilize mode is solid with no oscillations using default PID coeff's, but need a way to trim pitch; taildragger isn't at cruise pitch attitude when IMU is initialized.
  • Using SUP500 GPS module from SparkFun; altitude values off by up to 100 meters (field elevation 1800m). GPS frequently reports altitude of 1700m at pattern height (0-20m AGL). Also seeing huge intermittent (1 second duration) errors in lat,lon on the order of +/- 2 degrees. I don't think I screwed up the NMEA parser...
  • Also switched to a Serial library which performs buffered transmits. This seemed to solve some problems caused by the standard library's blocking writes. HardwareSerial.zip

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones


  • Thanks for the compliments.
    Two 10 minute flights today with solid performance in stabilize and FBWA modes. GPS tracks look good when the SUP500 is locked (no fix for entire second half of first flight), but groundspeed still seems erratic. Airspeed looks good though (max 40 kts, cruise about 24, final approach at 14), so next test will be FBWB with autopilot controlling airspeed with throttle. FBWA definitely makes it easy to fly and should be great for reducing pilot workload during aerial photography.
  • I have to give a quick <3 to the red-monokote covered telemaster :-)
    We (NC State University Aerial Robotics) love our (modified) red 8' telemasters.
    *goes back to lurking*
  • Thanks, what a star you are. It's worth a post on the arduino site at some point. There are many people who would like to free up a uart! I look forward to your post with other modes :)
  • You didn't miss anything; I just uploaded the TWI code today.

    I also forgot to mention that there is (at least) one other change needed to use TWI. This code in setup() of Ardupilot_2_6.pde is required for initialization:

    Wire.begin(ARDUPILOT_ADDR); // join i2c bus
    Wire.onReceive(twiRcvEvent); // register slave device event handler

    and of course it looks like this in arduimu.pde:

    Wire.begin(ARDUIMU_ADDR); // join i2c bus
    Wire.onReceive(twiRcvEvent); // register slave device event handler

    Also keep in mind that while the ArduIMU to ArduPilot connection has been tested in flight, this was only using manual and stabilize modes. It will be at least a week before I begin to test FBW and higher modes.
  • oh damn, sorry i just saw the hardwareSerial attachment. Thanks very much
  • Uploaded zip file containing ArduPilot and ArduIMU TWI routines. Link is above in first bullet.

    Does anyone know why hyperlinks and file attachments don't work for me in comments? I've tried Google Chrome and Internet Explorer; links seem to appear as correct HTML but don't show up in comment.
  • Great work. Would you mind posting your modified imu and ap code. I am keen to see the twi implmentation, thanks v much
  • Hi Jason,

    I uploaded my HardwareSerial library (link above in last bullet). It's code written by Kiril Zyapkov (). I was able to size the TX buffer at 256 bytes since using Flash memory for print strings freed up so much RAM, but it only needs to be as large as your largest message (32 or 64 should be enough). I added a "blockingWrite" method and state variable to control whether writes block when the buffer is full. The Flash library is at . It makes declaring a flash string as simple as F("string"), but I think it also depends on the Streaming library also at Arduiniana.

  • Developer
    Mike, I've been investigating Serial alternatives. Can you post your code and information about which Serial Library you went with?
  • My luck with GPS modules has been pretty bad. I bought the SUP500 because my EM406 failed (still responds to serial commands, just never sees any satellites) and SparkFun had just posted a rave review, calling it their new favorite. A week later the MTK was in stock at the DIYdrones store for $35

    Now that you mention it, the SUP500 is much slower to achieve lock than the EM406 was.
This reply was deleted.