ArduPilot and the Atmega328

Ben Mihevc, Scott Thompson Agenda

• ArduPilot Overview • History of the • Architecture Overview o Atmega328 o AVR • Peripherals o GPS/IMU • Comparisons • Conclusions • Questions What is the ArduPilot?

• ArduPilot is an Arduino based autopilot o A to interpret and respond to a number of sensors • Want to make UAV? o ArduPilot is an Open Source hardware and software controller • What is open source? o An open source project is a project licensed under the agreement that all uses of it will be fully documented and free to use. o No inaccessible black boxes. [8] History of Arduino

• Released in 2005 for students at a small school in Italy • Massimo Banzi o Frustrated with BASIC Stamp educational boards ƒ Expensive ƒ Lacking Computing Power arduino.cc o Arduino took a more creative approach ƒ Set a goal for $30 per board ƒ Named after a bar in Ivrea, Italy The “Bar di Re Arduino”

[10][15] An Open Arduino

• Arduino is the largest Open Source Hardware project o One of the first real 100% open source boards. o Licenced under Creative Commons as a cultural product • Exploded for DIY projects worldwide • Not just a company selling boards o Many other companies make products based off of the Arduino o Using their open source licence.

[15] The Arduino Autopilot

• Made by Sparkfun Electronics o Based off the Arduino architectures o An autopilot to control an unmanned vehicle o Can interface with other computing devices for input and output

[8] Required Hardware

What do you need to use this board? •The Board: ArduPilot o $24.95 •A GPS Module: 50 Channel GP-635T GPS Receiver o $39.95 •An Airspeed Sensor: MPXV7002DP o $24.95 •An XYZ orientation sensor: ArduIMU+ V3 o $79.95 •Total: $169.80 o Not counting wires and airframes

[2][8][7][9] ArduPilot System Overview

GPS: GP-635T

IMU: ArduIMU+ V3

Airspeed: MPXV7002DP

[19] ATMega328

• 8 - bit AVR CPU • 32 kB Flash Memory • 2kB SRAM • 1kB EEPROM • 20 MHz • 3 Timers • Peripherals o 23 I/O pins o 8 ADC Channels (10 bit) o 1 SPI o 1 UART

[20] AVR Core History

• Atmel, first 8-bit Flash microcontroller (1993) o Eliminated ROM programming during fabrication o Based on 8051 • AVR architecture (1997) o In-System-Programmable memory • MegaAVR with self-programming Flash o Write to program memory while running from boot sector o Increased security: lock bits and encryption

[12] AVR Architecture

• 8 - bit AVR CPU • Two buses (Harvard) o Instruction (16bit) o Data (8bit) • 32 General Registers • Status • Control • 64 GPIO Registers • Watchdog Timer

[5] [20] AVR Instruction Set • “AVR Enhanced RISC” o 16 bit instructions o 131 instructions o Single level pipelining o 13 Addressing Modes ƒ Flash (Program Memory) ƒ Data Memory (SRAM, Register File, I/O Memory) o 32 single byte registers ƒ First 32 addresses mapped (0x0000 - 0x001F) o 64 single byte I/O registers ƒ Mapped to (0x0020 - 0x005F) o 2048 bytes SRAM ƒ Mapped to (0x0100 - 0x08FF) [20] GPS Receiver GP-635T • Made by ADH Technologies • USB, UART, DDC, SPI • Uses U-blox 6 chipset o 6.5 x 8 x 1.2mm o World’s smallest standalone GPS Module o 50 channels • 35 x 8 x 6.5 mm • Horizontal accuracy 2.5m • Time to first fix (TTFF) o Hot Start: 1s o Cold Start: 27s [2][3] Inertial Measurement Unit • DIYDrones ArduIMU+ V3 o Inertial Measurement Unit [IMU] o Used to determine 3 dimensional orientation to the horizon. ƒ XYZ Orientation ƒ Gyroscopes and o This is the most expensive unit involved in building an autonomous vehicle. o ArduIMU+ V3 costs $79.95 o Also utilizes the ATmega328 o Based off Arduino o 38.1 x 25.4mm [9] Comparisons • 3DR Pixhawk o $199.99 (IMU included) o Relatively Heavy (38g) • The o $40 (~120 with IMU) o Relatively Heavy (45g) o Not a dedicated autopilot • ArduPilot o $24.95 (~$105 with IMU) o extremely lightweight (<20g) [16][17][20] Conclusions • Inexpensive solution to creating an autopilot • Wealth of documentation and instructions • No unnecessary hardware. • Lightweight • Note: To receive telemetry from an aircraft, communication is needed o Hard wire (not practical) o Wireless (Xbee) o Wait till the end of the flight. References

[1] "3D Products," 3D Robotics, [Online]. Available: https://store.3drobotics.com/products. [Accessed 10 12 2013]. [2] "50 Channel GP-635T GPS Receiver," SparkFun Electronics, [Online]. Available: https://www.sparkfun.com/products/11571. [Accessed 10 12 2013]. [3] "AMY-6M - u-blox 6 ROM-Based GPS Module," Alpha Micro Components, 25 10 2012. [Online]. Available: http://www.alphamicro.net/franchises/u-blox/amy-6m.aspx. [Accessed 10 12 2013]. [4] "APM Multiplatform Autopilot," 3D Robotics, [Online]. Available: http://ardupilot.com/. [Accessed 10 12 2013]. [5] "ATmega48PA/88PA/168PA/328P Manual," 10 2009. [Online]. Available: http://www.atmel.com/Images/doc8161.pdf. [Accessed 10 12 2013]. [6] "ATmega328," Atmel, [Online]. Available: http://www.atmel.com/devices/atmega328.aspx. [Accessed 10 12 2013]. [7] "Airspeed Kit with MPXV7002DP," 3D Robotics, [Online]. Available: http://store.3drobotics.com/products/airspeed-kit-with-mpxv7002dp. [Accessed 10 12 2013]. [8] "ArduPilot - Arduino Compatible UAV Controller w/ ATMega328," Sparkfun Electronics, [Online]. Available: https://www.sparkfun.com/products/8785. [Accessed 10 12 2013]. [9] "ArduIMU+ V3 kit," 3D Robotics, [Online]. Available: http://store.3drobotics.com/products/arduimu-v3. [Accessed 10 12 2013]. [10] D. Kushner, "IEEE Spectrum," IEEE, 26 10 2011. [Online]. Available: http://spectrum.ieee.org/geek-life/hands-on/the-making-of-arduino. [Accessed 10 12 2013]. [11] "ATMega328 - TQFP," Sparkfun Electronics, [Online]. Available: https://www.sparkfun.com/products/9261. [Accessed 10 12 2013]. [12] O. J. Svendsli, "Atmel’s Self-Programming Flash ," 10 2003. [Online]. Available: http://www.atmel.com/Images/doc2464.pdf. [Accessed 10 12 2013]. [13] "Using an Airspeed Sensor," DIY Drones, 23 03 2013. [Online]. Available: https://code.google.com/p/ardupilot-mega/wiki/Airspeed. [Accessed 10 12 2013]. References Cont.

[14] J. Vasconcelos, "Brief Guide to the AVR Architecture," Johns Hopkins University, 22 06 2009. [Online]. Available: http://www.cs.jhu.edu/~jorgev/cs333/usbkey/guide.htm. [Accessed 10 12 2013]. [15] "Arduino Products," Arduino, [Online]. Available: http://arduino.cc/en/Main/Products. [Accessed 10 12 2013]. [16] "RASPBERRY PI MODEL B 700Mhz; 512Mb RAM," Amazon, [Online]. Available: http://www.amazon.com/RASPBERRY-MODEL-700Mhz-512Mb-RAM/dp/B009SQQF9C. [Accessed 10 12 2013]. [17] "3DR Pixhawk," 3D Robotics, [Online]. Available: http://store.3drobotics.com/products/3dr-pixhawk. [Accessed 10 12 2013]. [18] "Raspberry Pi FAQ," Raspberry Pi Foundation, [Online]. Available: http://www.raspberrypi.org/faqs. [Accessed 10 12 2013]. [19] ArduPilot 2.x manual, 2009. [20] "Atmel 8-bit Microcontroller with 4/8/16/32KBytes," 02 2013. [Online]. Available: http://www.atmel.com/images/atmel-8271-8-bit-avr-microcontroller-atmega48a-48pa-88a-88pa-168a-168pa-328- 328p_datasheet.pdf. [Accessed 10 12 2013]. QuestionsQuestions??