Arduimu v3 Resume

download Arduimu v3 Resume

of 9

Transcript of Arduimu v3 Resume

  • 5/28/2018 Arduimu v3 Resume

    1/9

    Loading the code

    ArduIMU+ comes with some basic test firmware loaded at the factory, but to get full functionality you should load the

    latest AHRS firmware. Here's how:

    1)First, download the latest code from therepository.

    2)Then you need to download Arduino if you don't already have it and install it. ArduIMU only supports Arduino 023 or

    below. You can download it here: (Windows,Mac,Linux). The instructions for loading ArduIMU code are essentially

    the same as for ArduPilot, so follow themhere(especially the part about setting the "Set RTS on close" box and

    choosing the right board in the Arduino IDE) and then come back to this page.

    3)You must also define the folder Arduino will use for its "sketches" (Arduino-talk for the set of files that compose a

    program) and libraries

    Create a folder someplace where you can find it, perhaps in your Documents folder or even on your desktop. (If you've

    been using Arduino, you probably have this set up somewhere already). Launch the Arduino IDE and open

    the Preferencesdialog. Set the sketchbook location to the folder you created or are using. Here's where I have mine:

    Once you've changed that directory, you must close Arduino and restart it for it to be recognized.

    4)Now download thelatest ArduIMU software.It will be named ArduIMU(version number).zip. Unzip this main folder

    to your desktop.Inside the main folder there should be two folders: "arduimu" and "libraries". Drag them to the

    Arduino Sketchbook folder you defined in the previous step.

    Note: these are the same libraries as used in ArduPilotMega and ArduCopter. So if you've already loaded

    them, you don't have to copy the libraries folder again for ArduIMU.

    Here's where I put the libraries and APM code folder (highlighted). Note that it is exactlythe same folder as I defined

    in the Arduino configuration menu in the step above.

    http://code.google.com/p/ardu-imu/downloads/listhttp://code.google.com/p/ardu-imu/downloads/listhttp://code.google.com/p/ardu-imu/downloads/listhttp://arduino.googlecode.com/files/arduino-0023.ziphttp://arduino.googlecode.com/files/arduino-0023.ziphttp://arduino.googlecode.com/files/arduino-0023.ziphttp://arduino.googlecode.com/files/arduino-0023.dmghttp://arduino.googlecode.com/files/arduino-0023.dmghttp://arduino.googlecode.com/files/arduino-0023.dmghttp://arduino.googlecode.com/files/arduino-0023-64.tgzhttp://arduino.googlecode.com/files/arduino-0023-64.tgzhttp://arduino.googlecode.com/files/arduino-0023-64.tgzhttp://code.google.com/p/ardupilot/wiki/LoadingPagehttp://code.google.com/p/ardupilot/wiki/LoadingPagehttp://code.google.com/p/ardupilot/wiki/LoadingPagehttp://code.google.com/p/ardu-imu/downloads/listhttp://code.google.com/p/ardu-imu/downloads/listhttp://code.google.com/p/ardu-imu/downloads/listhttp://code.google.com/p/ardu-imu/downloads/listhttp://code.google.com/p/ardupilot/wiki/LoadingPagehttp://arduino.googlecode.com/files/arduino-0023-64.tgzhttp://arduino.googlecode.com/files/arduino-0023.dmghttp://arduino.googlecode.com/files/arduino-0023.ziphttp://code.google.com/p/ardu-imu/downloads/list
  • 5/28/2018 Arduimu v3 Resume

    2/9

    We recommend you use this same file configuration. If you modify it, Arduino may not be able to find the libraries and

    you'll get compile errors.

    Important note: DO NOT drag the whole ArduIMU(version number) folder into your sketchfile directory. If you

    do, the code will not compile.Instead, just drag the two individual folders within it--"arduimu" and "libraries"--into the

    sketchfile folder as shown above. Once you've placed them in the sketchfile folder, you can delete theArduIMU(version) folder on your desktop.

    4)Open Arduino and load the ArduIMU code from your "arduimu" folder by open the "arduimu.pde" file, which will

    open all the tabs. Make any configuration changes needed in the first tab of the code. If you just want to try out the

    IMU with the desktop demo programs, make sure the following configuration options are set as shown:

    #definePRINT_ANALOGS 1//Will print the analog raw data#definePRINT_EULER 1 //Will print the Euler angles Roll, Pitch and Yaw#definePRINT_GPS 1 //Will print GPS data

    #definePRINT_BINARY 0 //Will print binary message and suppress ASCII messages (above)

    You should also select a GPS module. The uBlox is the default and is recommended, but if you want to use

    theMediaTek modulesold by the DIY Drones store, please note that it comes with a later firmware than is supported

    by ArduIMU and you must downgrade the firmware to 1.4 as explained inthis tutorial.

    #defineGPS_PROTOCOL 3 // 1 - NMEA, 2 - EM406, 3 - Ublox, 4 -- MediaTek

    If you want to use ArduIMU with ArduPilot, set the following configuration option as shown:

    #definePRINT_BINARY 1 //Will print binary message and suppress ASCII messages (above)

    Remember to adjust your magnetic declination setting for your local environment.

    4)Then connect the FTDI cable to connector pins you soldered on the ArduIMU (check on the bottom of the board

    where it shows which orientation to plug the FTDI cable in--black is on one side) and use it to load the code on to the

    board. Again, theinstructionsfor ArduPilot are essentially the same, so refer to them if you're having trouble.

    If you are having problems uploading the code (you get a bunch of error messages in red) follow ALL of the

    debugging tipshere.

    Running the Demo Program

    We've provided two different demo programs so you can see how ArduIMU+ works. Note that you'll need GPS lock to

    give the most accurate results. Also note that they require Windows be set in standard English numbering, with

    periods (.) as decimal marks in numbers.

    http://store.diydrones.com/MediaTek_MT3329_GPS_10Hz_Adapter_Basic_p/mt3329-02.htmhttp://store.diydrones.com/MediaTek_MT3329_GPS_10Hz_Adapter_Basic_p/mt3329-02.htmhttp://store.diydrones.com/MediaTek_MT3329_GPS_10Hz_Adapter_Basic_p/mt3329-02.htmhttp://code.google.com/p/ardupilot/wiki/MediaTekhttp://code.google.com/p/ardupilot/wiki/MediaTekhttp://code.google.com/p/ardupilot/wiki/MediaTekhttp://code.google.com/p/ardupilot/wiki/LoadingPagehttp://code.google.com/p/ardupilot/wiki/LoadingPagehttp://code.google.com/p/ardupilot/wiki/LoadingPagehttp://diydrones.com/profiles/blogs/arduino-debugging-tipshttp://diydrones.com/profiles/blogs/arduino-debugging-tipshttp://diydrones.com/profiles/blogs/arduino-debugging-tipshttp://diydrones.com/profiles/blogs/arduino-debugging-tipshttp://code.google.com/p/ardupilot/wiki/LoadingPagehttp://code.google.com/p/ardupilot/wiki/MediaTekhttp://store.diydrones.com/MediaTek_MT3329_GPS_10Hz_Adapter_Basic_p/mt3329-02.htm
  • 5/28/2018 Arduimu v3 Resume

    3/9

    The easiest to use is the Windows test utility, developed by HappyKillmore

    Download it fromhereand install it. Additional instructions arehere.

    To use it, first, connect a GPS to the ArduIMU; currently only the uBlox 5 (with the DIY Drones adapter) is supported.

    If you don't connect a GPS module, the IMU will still work but Yaw data will be unreliable since there is no way to

    correct for drift in the Yaw gyro. Also, please note that the GPS will probably only get lock when you're outside with a

    clear view of the sky. If you don't have lock (blue LED on the ArduIMU+ board lights up), it will still work but the yaw

    data will be wrong.

    Note: When you're starting the IMU with AIRSTART = 0, the board will flash its LEDs for about a half-minute while it's

    calibrating. Once that is done, it should start sending data that you can read with the desktop utility. With AIRSTART =

    1, it will boot faster, but be less accurate.

    LabVIEW demo program

    If you prefer the earlier LabVIEW demo software (shown below) you can find it here.If you don't already have them,

    you'll also need the LabView runtime engine and serial drivers. Download the runtime enginehereand thedrivershere.

    Run ArduIMU.exe in the ArduIMU Demo folder. Follow the directions below.

    http://www.happykillmore.com/Software/ArduIMU/Setup/Setup.exehttp://www.happykillmore.com/Software/ArduIMU/Setup/Setup.exehttp://www.happykillmore.com/Software/ArduIMU/Setup/Setup.exehttp://diydrones.com/profiles/blogs/arduimu-v2-test-applicationhttp://diydrones.com/profiles/blogs/arduimu-v2-test-applicationhttp://diydrones.com/profiles/blogs/arduimu-v2-test-applicationhttp://code.google.com/p/ardu-imu/downloads/detail?name=ArduIMU%20utilities.zip&can=2&q=http://code.google.com/p/ardu-imu/downloads/detail?name=ArduIMU%20utilities.zip&can=2&q=http://code.google.com/p/ardu-imu/downloads/detail?name=ArduIMU%20utilities.zip&can=2&q=http://ftp.ni.com/support/softlib/labview/labview_runtime/8.6/Windows/lvrte86min.exehttp://ftp.ni.com/support/softlib/labview/labview_runtime/8.6/Windows/lvrte86min.exehttp://ftp.ni.com/support/softlib/labview/labview_runtime/8.6/Windows/lvrte86min.exehttp://joule.ni.com/nidu/cds/view/p/id/1071/lang/enhttp://joule.ni.com/nidu/cds/view/p/id/1071/lang/enhttp://joule.ni.com/nidu/cds/view/p/id/1071/lang/enhttp://joule.ni.com/nidu/cds/view/p/id/1071/lang/enhttp://ftp.ni.com/support/softlib/labview/labview_runtime/8.6/Windows/lvrte86min.exehttp://code.google.com/p/ardu-imu/downloads/detail?name=ArduIMU%20utilities.zip&can=2&q=http://diydrones.com/profiles/blogs/arduimu-v2-test-applicationhttp://www.happykillmore.com/Software/ArduIMU/Setup/Setup.exe
  • 5/28/2018 Arduimu v3 Resume

    4/9

    When you run the Desktop Utility you need to tell it to find the right serial port and connect to the IMU.

  • 5/28/2018 Arduimu v3 Resume

    5/9

    Select the port in the window shown above. If you're not sure what serial port your FTDI is connected on, you can find

    out in your Windows Device Manager, as shown below:

    It may take a few seconds for the software to recognize the serial port and for the data to start flowing. But once it

    does, your main window and graphic display of the rotating box should be working. When you're done, press the little

    stop icon on the serial window to stop reading data, so you can close the window.

  • 5/28/2018 Arduimu v3 Resume

    6/9

    Output Overview

    Please be aware that this page is extremely new, and its accuracy is still being verified.

    The ArduIMU outputs serial data in different formats depending on its configuration. The two main options are either

    binary or Ascii. You can pick between these formats and a variety of other options in the user configuration settings

    (see here).

    Ascii Output

    Typical Ascii output with a GPS unit looks like this:

    !!!VER:1.8.1,RLL:1.12,PCH:-0.07,YAW:34.03,IMUH:253,LAT:499247361,LON:-1193955623,ALT:3525,COG:0,SOG:0,FIX:1,SAT:9,TOW:21230400***

    The variables in the output are determined by configuration settings. Depending on what flags are set some of these

    fields may not appear or there will be more fields. The variables in this example are :

    1. Roll: Measured in degrees with positive and increasing as the right wing drops

    2. Pitch: Measured in degrees with positive and increasing as the nose rises

    3. Yaw: Measured in degrees with positive and increasing as the nose goes right

    4. IMUH:

    5. Latitude: Measured in decimal degrees times 10^7

    6. Longitude: Measured in decimal degrees times 10^7

    7. Altitude: Measured in meters above sea level times 10^1

    8. Course over ground:

    9. Speed over ground:

    10. GPS Fix: A binary indicator of a valid gps fix

    11. Satellite Count: The number of GPS satellites used to calculate this position

    12. Time of week: Time of week is related to GPS time formats. If this is important to your system, I suggest youread external resources on this confusing topic.

    Binary Output

    There are partial examples of parsing binary data on forum posts, but no official documentation.

    Output Rate

    Experimentation has shown that ascii serial data is pushed at about 8 Hz, though some fields (such as gps) are

    updated at a different rate (4 Hz) based on the availability of new data.

    Thanks

    Examples of output taken from a post by Scotty of DIYDrones.

    Configuration

    Updated Sep 5, 2010 [email protected]

    User-modifiable options

    https://code.google.com/p/ardu-imu/wiki/Configurationhttps://code.google.com/p/ardu-imu/wiki/Configurationhttps://code.google.com/p/ardu-imu/wiki/Configurationhttps://code.google.com/u/105910977869522122580/https://code.google.com/u/105910977869522122580/https://code.google.com/u/105910977869522122580/https://code.google.com/u/105910977869522122580/https://code.google.com/p/ardu-imu/wiki/Configuration
  • 5/28/2018 Arduimu v3 Resume

    7/9

    There is no configuration file for the firmware. Use modifiable options are set with several #define statements in the

    main file (ArduIMU.pde). There are also #define statements which are not intended to be user modifiable options, so

    only change the parameters shown below.

    // *** NOTE! Hardware version - Can be used for v1 (daughterboards) or v2 (flat)#defineBOARD_VERSION 2// 1 For V1 and 2 for V2

    // Ublox gps is recommended!#defineGPS_PROTOCOL 4 // 1 - NMEA, 2 - EM406, 3 - Ublox, 4 -- MediaTek

    // Enable Air Start uses Remove Before Fly flag - connection to pin 6 on ArduPilot#defineENABLE_AIR_START 0 // 1 if using airstart/groundstart signaling, 0 if not#defineGROUNDSTART_PIN 8 // Pin number used for ground start signal (recommend 10 on v1 and8 on v2 hardware)

    /*Min Speed Filter for Yaw drift Correction*/#defineSPEEDFILT 2// >1 use min speed filter for yaw drift cancellation, 0=do not use speedfilter

    /*For debugging propurses*/#definePRINT_DEBUG 0 //Will print Debug messages

    //OUTPUTMODE=1 will print the corrected data, 0 will print uncorrected data of the gyros (withdrift), 2 will print accelerometer only data#defineOUTPUTMODE 1

    #definePRINT_DCM 0 //Will print the whole direction cosine matrix#definePRINT_ANALOGS 0//Will print the analog raw data#definePRINT_EULER 0 //Will print the Euler angles Roll, Pitch and Yaw#definePRINT_GPS 1 //Will print GPS data

    // *** NOTE! To use ArduIMU with ArduPilot you must select binary output messages (change to 1here)#definePRINT_BINARY 0 //Will print binary message and suppress ASCII messages (above)

    // *** NOTE! Performance reporting is only supported for Ublox. Set to 0 for others#definePERFORMANCE_REPORTING 1 //Will include performance reports in the binary output ~ 1/2min

    /* Support for optional magnetometer (1 enabled, 0 disabled) */#defineUSE_MAGNETOMETER 0// use 1 if you want to make yaw gyro drift corrections using theoptional magnetometer

    /* Support for optional barometer (1 enabled, 0 disabled) */#defineUSE_BAROMETER 0 // use 1 if you want to get altitude using the optional absolutepressure sensor#defineALT_MIX 50 // For binary messages: GPS or barometric altitude. 0to 100 = % of barometric. For example 75 gives 25% GPS alt and 75% baro

    These are all pretty self-explanatory, except for AIR_START. Here is the explanation of the author, Doug Weibel:

    "Airstart is only there to save you if for some reason the AP restarts in the air. This could happen due to a power glitch

    or due to toggling the mode quickly.

    If the AP restarts in the air it is important that it not take a lot of time doing the things it normally does when starting onthe ground - i.e. calibrating everything. When we do a ground start we get the offsets for all the analog sensors, set

    the home location, etc. We then store this stuff in EEPROM. When an airstart occurs we just grab this stuff back from

    EEPROM and start operating immediately.

    There is no real reason a user would want to intentionally perform an airstart on the ground other than debugging.

    The biggest source of confusion I have seen is with the IMU. If users set ENABLE_AIRSTART then the IMU will

    ALWAYS air start unless it gets a signal from the AP to ground start. This will often result in the IMU doing funky stuff,

    because it will be using calibration data from EEPROM that may not be appropriate. So if a user is just looking at the

    IMU on the bench and they have it doing air start instead of ground start then they will often think there is a problem."

    In short, leave it at 0 when you're bench testing or unless you've got it attached to ArduPilot via the D6/D8 pin.

    Other settings

  • 5/28/2018 Arduimu v3 Resume

    8/9

    There are also adjustable gains for the XY and Z directions, but you probably will not want to change them unless you

    understand what effect the change will cause. The values shown below have been shown to work reasonably well.

    // LPR530 & LY530 Sensitivity (from datasheet) => 3.33mV//s, 3.22mV/ADC step => 1.03// Tested values : 0.96,0.96,0.94#defineGyro_Gain_X0.92//X axis Gyro gain#defineGyro_Gain_Y0.92//Y axis Gyro gain#defineGyro_Gain_Z0.94//Z axis Gyro gain

    Theory of Operation (Simplified)

    ArduIMU uses gyros, accelerometers, and GPS to maintain a model of the the board's orientation in space. This is not

    as simple a problem as integrating the roll rates from the gyros. As a simple illustrative example, consider an airplane

    flying level to the north that first banks (rolls) 90 degrees to the right and then pitches 90 degrees. mathematical

    algorithm called the Direction Cosine Matrix (DCM) to take sensor data from the gyros, accelerometersThe airplane

    would be flying horizontally to the east in a 90 degree bank orientation. If instead the airplane pitched up 90 degrees

    first, then banked 90 degrees the airplane would be flying straight up. We cannot just keep track of how much roll and

    pitch have occurred and know the orientation of the aircraft.

    For a detailed description of how the DCM algorithm works see Bill Premmerlanis tutorialhere.You can also read a

    detailed description in Mahoney's original papershere.

    For this simplified explanation here are the essential components of the algorithm.

    The Direction Cosine Matrix is a 3 by 3 numerical matrix (array)

    The gyro data is used in a time step integration to update the DCM matrix

    Data from the accelerometers and gps is used to correct for errors that creep in to the DCM matrix. Theseerrors arise from drift in the gyros as well as numerical errors due to quantization of the gyro signals androunding errors in the computations.

    Pitch, roll and yaw can be computed from the elements of the direction cosine matrix.

    ArduIMU outputs a serial data stream. The firmware can be configured so that this data stream includes avariety of data including the DCM matrix itself, the pitch, roll and yaw of the unit, raw sensor and gps data, andother computed data. (DW)

    For more information on this application of the DCM, please see theUAVDevBoard sectionon DIY Drones.

    LED displays

    When AIRSTART = 0, the red, blue and yellow LEDs will flash while the IMU is calibrating at startup.

    ArduIMU Indicator LEDs (after startup):

    Green LED = Power On

    Yellow LED = Indicates that the speed filter is supressing yaw drift correction. You should see it on if you arenot in motion above the set threshold speed.

    Red LED = On after calibration

    Troubleshooting Guide

    No lights come on when programmingAre you using an appropriate FTDI cable that supplies power?

    The blue GPS light does not come onIs the adapter board properly seated on the Ublox module? Are youindoors where satellite signals may be too weak? Are you using the uBlox GPS module, or if not have youchanged the configuration for the one you are using?

    http://gentlenav.googlecode.com/files/DCMDraft2.pdfhttp://gentlenav.googlecode.com/files/DCMDraft2.pdfhttp://gentlenav.googlecode.com/files/DCMDraft2.pdfhttp://gentlenav.googlecode.com/files/MahonyPapers.ziphttp://gentlenav.googlecode.com/files/MahonyPapers.ziphttp://gentlenav.googlecode.com/files/MahonyPapers.ziphttp://diydrones.com/page/uav-devboardhttp://diydrones.com/page/uav-devboardhttp://diydrones.com/page/uav-devboardhttp://diydrones.com/page/uav-devboardhttp://gentlenav.googlecode.com/files/MahonyPapers.ziphttp://gentlenav.googlecode.com/files/DCMDraft2.pdf
  • 5/28/2018 Arduimu v3 Resume

    9/9

    You're using ArduIMU with ArduPilot, but it's not working and when you get GPS lock on ArduIMU it doesn'tshow as locked on ArduPilot. -- Have you changed #define PRINT_BINARY to 1? (seethisfor more)

    http://code.google.com/p/ardupilot/wiki/ArduIMUhttp://code.google.com/p/ardupilot/wiki/ArduIMUhttp://code.google.com/p/ardupilot/wiki/ArduIMUhttp://code.google.com/p/ardupilot/wiki/ArduIMU