ECE 477 Digital Systems Senior Design Project Spring 2006

Homework 3: Design Constraint Analysis and Component Selection Rationale Due: Friday, February 10, at NOON

Team Code Name: Digital Electronics Autonomous Thingamajigger Group No. 5

Team Member Completing This Homework: David Jones______

NOTE: This is the first in a series of four “professional component” homework assignments, each of which is to be completed by one team member. The completed homework will count for 10% of the team member’s individual grade. It should be a minimum of five printed pages.

Evaluation:

Component/Criterion Score Multiplier Points Introduction 0 1 2 3 4 5 6 7 8 9 10 X 1 Analysis of Design Constraints 0 1 2 3 4 5 6 7 8 9 10 X 3 Rationale for Component Selection 0 1 2 3 4 5 6 7 8 9 10 X 3 List of Major Components 0 1 2 3 4 5 6 7 8 9 10 X 1 List of References 0 1 2 3 4 5 6 7 8 9 10 X 1 Technical Writing Style 0 1 2 3 4 5 6 7 8 9 10 X 1 TOTAL

Comments:

______

______

______

______

______ECE 477 Digital Systems Senior Design Project Spring 2006

______

-2- ECE 477 Digital Systems Senior Design Project Spring 2006

1.0 Introduction

The focus of the project is to develop an autonomous proof-of-concept vehicle which is able to navigate based on GPS waypoint coordinates. The project will be composed of a modified remote-control vehicle equipped with electronics to guide the vehicle. Since the vehicle will be mobile, all components will need to be battery-powered. Each component must be considered for its power consumption, and must be powered by the battery power available on the vehicle. The vehicle used for the platform is a 1/12 scale tank. The vehicle body is roughly two- and-a-half feet long, providing a large working margin for the physical packaging. However, weight and physical dimension must still be considered to ensure that the device can still be mobile.

2.0 Design Constraint Analysis

The major design constraints of this project fall into the categories of computational, electrical, and physical constraints. Computational constraints include execution of real-time code and non-real-time network communication. Electrical constraints are governed by the fact that the vehicle is mobile and thus battery-powered. Physical constraints are also governed by the mobile nature of the vehicle, requiring that a reasonable weight and amount of space be taken, even considering the large dimensions of the drive platform.

2.1 Computation Requirements

The vehicle requires some close-to-real-time (referred to here as “real-time” or “deterministic”) processing as well as some processing which is of much lower priority. The real-time processing requirements break down to controlling the timer ports for pulse-width modulation (PWM), reading the speed, and executing the drive control algorithm. The non- deterministic (non-real-time) portion of the design includes serial communications and Ethernet communications. The Global Positioning System (GPS) data is needed by both real-time and non-real-time processes; the module communicates over serial with low priority, but position information must be available to the (deterministic) drive control algorithm.

-3- ECE 477 Digital Systems Senior Design Project Spring 2006

The real-time component can be achieved by using a real time interrupt and main loop program structure. In this fashion, the main loop executes at a predefined interval. A reasonable main loop interval would be on the order of 50 Hz, or 20 ms per execution of the main loop. The frequency could be increased or decreased; a loop frequency on the order of 100 Hz (10 ms) or even 1 kHz (1 ms) would probably be sufficient for the deterministic portion of the program, but very short execution times would result in less time for low-priority tasks and higher power consumption. The non-deterministic portion, which handles the communication, will likely require a larger amount of processing time than the deterministic portion. Strictly following the timed main loop model would require that the main loop have sufficient execution time to finish any non-deterministic code, or at least allow a subsequent call to the main loop not to interfere with the remaining portion of the execution. On the other hand, handling communication entirely by interrupt could preempt the main loop, although only by a few cycles (until interrupts are re- enabled). Realistically, a delay of a few cycles is entirely acceptable for the deterministic code in this case, making a main loop combined with communication interrupt system attractive.

2.2 Interface Requirements

The I/O requirements of the vehicle fall in to six categories: drive and position control, position sensing, speed sensing, obstacle sensing, external peripheral interface, and PC interface. Drive and position control consists of the main drive motors and the SONAR servo. These require three pulse-width modulation (PWM) channels. The main drive motors are controlled by the PWM signal to drive an H-bridge [1] to control direction and speed, and should be optically isolated [2] to prevent system damage in the event of a catastrophic drive motor failure. The SONAR position servo does not require an H-bridge, and an optical isolator should be able to provide isolation in the event of catastrophic failure and, at the same time, serve as an amplifier from the 3.3 V logic level of the microcontroller to the 5 V supply needed by the servo. Position sensing is achieved by a Global Positioning System (GPS) module. The interface is defined by the NMEA 0183 [3] or SiRF binary [4] protocols over an RS-232 data link. The GPS module is powered at 3.3 V and signals at roughly 2.8 V. The only interface required is a transistor amplifier to drive the 2.8 V output signal to the microcontroller signaling voltage.

-4- ECE 477 Digital Systems Senior Design Project Spring 2006

Speed sensing is read by the microcontroller as an analog voltage. The driveshaft of each drive motor will be equipped with a slotted disk which interrupts an infrared light source. This outputs a square wave, which must be fed through a frequency-to-voltage converter. Obstacle sensing is achieved by an external SONAR module. SONAR sensing modules typically communicate by a serial communication bus or take an excitation pulse as an input, followed by an output pulse with a width proportional to the distance from the sensed object. A simple transistor amplifier is all that is required on the output to the SONAR module. An op-amp could be used to perform level conversion on the distance measurement pulse. The “external peripheral” refers to the peripheral integrated to the drive platform. At the time of this writing, the electrical characteristics of this peripheral were unknown. It is assumed for the purpose of this report that the peripheral consists of rotation and elevation motors and an actuation switch. Each motor would be driven through an optical isolator to a low-power H- bridge (for direction control), while the actuation switch would be driven with a single logic line. For the purposes of this report, the peripheral motors are assumed to be drivable with discrete components (i.e., an H-bridge implemented with discrete transistors and diodes) at 100% duty cycle (i.e., no PWM). This interface configuration requires two logic lines per motor plus one for the actuation switch, for a total of 5 general-purpose I/O pins, each driven through an optical isolator, with two discrete H-bridges. The PC interface requires an RS-232C level converter for the debug/programming serial port. This device converts the 3.3 V logic of the microcontroller to the 12 V differential voltage swing required for the serial line. The Ethernet interface requires only an isolation transformer, which is built in to the Ethernet jack. [5]

2.3 On-Chip Peripheral Requirements

The primary needs of the project related to the microcontroller are timing-related. The microcontroller must have timer ports which have input capture (time-to-input) and output compare (time-to-output). Communication needs of the microcontroller include serial and Ethernet interfaces, while voltage sensing by analog-to-digital conversion will be used for speed feedback. The timing tasks fall in to three categories: drive control and positioning, system timing, and SONAR sensing. Drive control, specifically speed and direction, are achieved by a pulse-

-5- ECE 477 Digital Systems Senior Design Project Spring 2006 width modulated (PWM) signal to the drive motor. The signals to the drive motors pass through external H-bridge chips to control the supply of drive voltage and motor direction. The pulse width modulation could be achieved in one of two ways: timer output compare or by an external PWM controller. Utilizing the timer output compare method, each drive motor would occupy a dedicated timer pin. The correct pulse width would be achieved by setting the output compare value once per PWM cycle. Utilizing an external controller is not desirable, especially considering the capabilities of the microcontroller. The system timing controls the interval between executions of the main loop. Since the main loop would likely execute at a frequency on the order of 10 – 100 Hz, it would be very undesirable for a high-frequency timing task (such as motor PWM control). The main loop timing can be achieved with the real-time interrupt (RTI) function of the processor. Based on product research, the SONAR sensing requires either an Inter-IC Connect (I2C) port or timing capability on the order of a 10 µs minimum output (excitation) pulse, followed by a 100 µs – 18 ms input pulse. Since the output pulse is only a minimum requirement and is relatively short, it could be implemented in the main loop. The distance measurement does not have to be very precise, but should be able to detect a threshold distance. The distance pulse width would most likely be much longer than reasonable for a busy loop. Thus, the SONAR module could be driven with a single timer port and an additional general purpose I/O port. The drive feedback system measures the speed of the drive wheels to provide dead- reckoning control of movement. The speed is measured using a slotted disk attached to the driveshaft, which interrupts an infrared beam, generating a square-wave signal with a frequency proportional to the rotational velocity of the shaft. This signal will then be fed to a frequency-to- voltage converter and read by the analog-to-digital (ATD) peripheral on the controller. Since there are two drive motors, there will be two speed sensors, utilizing two of the eight available ATD ports. The selected GPS module communicates over an RS-232 serial connection at a 2.8 V signal level. This will be connected to one of two serial communications interface (SCI) ports on the microcontroller. The other port will be used to connect to a host PC for programming or debugging. The connection to the controlling PC requires an Ethernet controller.

-6- ECE 477 Digital Systems Senior Design Project Spring 2006

2.4 Off-Chip Peripheral Requirements

The off-chip peripherals fall in to 4 categories: speed and location sensing, obstacle sensing, communications media interfacing, and a weapon. Speed and location sensing encompasses several peripherals. Location sensing is achieved through a GPS module, which must be accurate to a few meters of resolution. This can be achieved with differential GPS (DGPS) [6] or Wide Area Augmentation System (WAAS) [7] correction. Speed sensing requires one external peripheral per drive motor: a frequency-to- voltage converter. A slotted disk interrupts an infrared light beam, sending a square wave to the frequency-to-voltage converter. The output voltage is then read by the microcontroller. Obstacle sensing requires a SONAR sensor capable of detecting obstacles in sufficient time to stop. In the case of the current design, a reasonable sensing distance would be on the order of 5 – 10 feet. Communications interfacing requires a level converter to convert the microcontroller 3.3 V serial interface to RS-232C levels appropriate for connection to a PC. The weapon peripheral must take a logic level input. This peripheral is built-in to the tank platform, but may require a buffer device (such as an op-amp) to convert to an appropriate voltage level.

2.5 Power Constraints

Since the vehicle is autonomous and mobile, all of the electronics must be battery- powered. Beyond powering the electronics, several other components must be considered. Image feedback is provided by a network camera, and the network communication is facilitated by a wireless access point. Both of these network devices must be capable of being powered by battery. The drive motors will require power from the stock batteries. In order to prevent noise in the controller circuit, a separate battery will be used for the electronics. The wireless access point power consumption was measured and characterized in-lab, and a 12 V supply was found to require the least power (about 4.8 W) out of the working voltage range. In order to achieve the highest possible efficiency, a switch-mode power supply will be used for the electronics power supply. This supply must be capable of delivering 3.3V for GPS and the microcontroller and 5 V for the SONAR module and servo. The total estimated current requirements for the main electronics devices are as follows:

-7- ECE 477 Digital Systems Senior Design Project Spring 2006

Device Voltage Current Microcontroller 3.3 V 270 mA SONAR module 5 V 30 mA Servo 5 V 100 mA GPS receiver 3.3 V 70 mA Infrared light/sensors 3.3 V 2 x 30 mA Wireless access point 12 V 400 mA

The total power consumption is thus estimated to be 6770 mW among the major electronic components. Specifications for the tank platform indicate run times of up to 60 minutes. Assuming a 1 hour runtime for the drive system, no additional overhead, and 80% efficiency for the electronics supply (a conservative, roughly 10%-safe estimate for switch mode conversion), the electronics supply battery must have a capacity of roughly 700 mAh (milliamp- hours). Prepackaged nickel-metal hydride (NiMH) battery packs have capacities in the range of 1000 mAh with a weight around 8 ounces. A battery pack made of standard AA- or C-size NiMH cells would be of a comparable weight and could deliver 2000 mAh or more with commercially available cells. Sealed lead-acid batteries with capacities in the required capacity range weigh under a pound. Given that the drive platform is large – over two feet long – a battery pack weighing several pounds would be entirely feasible. The electronics could reasonably be powered for several hours on a full battery charge.

2.6 Packaging Constraints

The packaging constraints are governed by the drive platform. The anticipated platform is a 1/12 scale tank, on the order of 2-2.5 feet long. Given this significant size, the size of the electronics is not of great concern. The weight is also a low priority; several pounds could very likely be carried by the tank. The size is mostly driven by the component count; there is not a single component or group of components which take an exorbitant amount of space compared to the rest. The weight of the system is driven by the battery power source. Since the power constraints demand a battery or system of batteries on the order of one pound or less, the weight of the power system will likely be much less than the constraint of the tank platform.

-8- ECE 477 Digital Systems Senior Design Project Spring 2006

2.7 Cost Constraints

Most of the current devices which are analogous to the current design are not consumer devices – that is, they are proofs-of-concept (such as DARPA grand challenge entrants) or industrial in nature (such as an autonomous robot to deliver medication in a hospital or parts in a warehouse). Although some autonomous consumer devices exist, such as the Roomba vacuum cleaner, they do not employ intelligent drive algorithms and instead follow a random path or a preset marker. That being considered, the current device should meet an attractive price-performance mark, where the cost is reasonable and the performance is high. In this case, it becomes economical to use such a platform for autonomous surveillance, military reconnaissance, or large-area delivery (over-the-road or between buildings).

3.0 Component Selection Rationale

The major components shall be considered to be the microcontroller and the devices needed to meet the following project-specific success criteria:

1. An ability to traverse a straight line heading from the current waypoint to within a 2-meter radius of a target waypoint. 2. An ability to determine current position and calculate waypoint heading based on GPS data. 3. An ability to detect and avoid obstacles (may involve recalculation of heading once obstacle is circumvented). 4. An ability to aim and "fire" a marker (or other "toy weapon"). 5. An ability to monitor the status of (e.g., provide notification when terminal waypoint reached) and control the function of (e.g., send new waypoints, aim/fire toy weapon) the autonomous vehicle via an embedded web server.

The component selection is summarized in the following table. The components selected appear in the second column, while the competing device is in the third column.

-9- ECE 477 Digital Systems Senior Design Project Spring 2006

Device Selected component Alternative component Microcontroller MC9S12NE64 Rabbit RCM 2200 GPS receiver USGolbalSat EM- 12 Channel Lassen 402 SiRF II IQ GPS Receiver Receiver with DGPS SONAR sensor Devantech SRF04 Devantech SRF10

The microcontroller choice was driven by previous course experience. Both controllers have sufficient flash (64 kB for the ‘NE64 [8] and 256 kB for the Rabbit [9]) and SRAM (8 kB for the ‘NE64 and 128 kB for the Rabbit). The operating clocks are similar as well; however, the Rabbit is an 8-bit architecture while the ‘NE64 is a 16-bit architecture. The ‘NE64 will likely deliver better performance by this fact alone. The GPS receiver decision was ultimately driven by the expected precision of each device. The SiRF receiver has Wide Area Augmentation System (WAAS) correction [10], while the Lassen has differential GPS (DGPS) correction [11]. For the intended area of operation (West Lafayette, IN), DGPS coverage is less than desirable. ###REFERENCE### The choice of SONAR sensor was driven primarily by cost. The SRF10 [12] is an Inter- IC Connect (I2C) device, while the SRF04 [13] works solely by pulse width. The cost difference is nearly a factor of two, with the SRF10 being the more expensive option.

4.0 Summary

The drive platform provides ample room for physical constraints. However, the mobile nature of the device imposes significant electrical considerations. As a result, the electronics will be powered separately from the drive motor. The computational requirements on the processor are acceptable, and long processing times can be mitigated by keeping a careful eye to what code needs to be run in real-time.

-10- ECE 477 Digital Systems Senior Design Project Spring 2006

List of References

[1] National Semiconductor. (2006) LMD18200T Datasheet. Available: http://www.national.com/ds/LM/LMD18200.pdf February 6, 2006 [date accessed]

[2] Digi-key. (2006) NEC PS2532L-4-ND Product Summary. Available: http://www.digikey.com/scripts/DkSearch/dksus.dll?Detail? Ref=32203&Row=70857&Site=US February 9, 2006 [date accessed]

[3] Spark Fun Electronics. (2006) NMEA Protocol Reference. Available: http://www.sparkfun.com/datasheets/GPS/NMEA%20Reference%20Manual1.pdf January 23, 2006 [date accessed]

[4] USGlobalSat. (2006) SiRF Binary Protocol Reference. Available: http://www.usglobalsat.com/downloads/SiRF_Binary_Protocol.pdf February 9, 2006 [date accessed]

[5] Molex. (2006) RJ45 Modular Jack Datasheet. Available: http://www.usglobalsat.com/ downloads/SiRF_Binary_Protocol.pdf February 6, 2006 [date accessed]

[6] U.S. Coast Guard. (2006) DGPS General Information. Available: http://www.navcen.uscg.gov/dgps/Default.htm February 9, 2006 [date accessed]

[7] Federal Aviation Administration. (2006) Wide Area Augmentation System. Available: http://gps.faa.gov/Programs/WAAS/waas.htm February 9, 2006 [date accessed]

[8] Freescale. (2006) MC9S12NE64 Overview. Available: http://www.freescale.com/ webapp/sps/site/prod_summary.jsp?code=MC9S12NE64 January 30, 2006 [date accessed]

[9] Rabbit Semiconductor. (2006) Rabbit Core Module RCM2200 Product Information. Available: http://www.rabbitsemiconductor.com/products/rcm2200/index.shtml February 8, 2006 [date accessed]

[10] Spark Fun Electronics. (2006) EM-402 SiRF II GPS Module Product Information. Available: http://www.sparkfun.com/commerce/product_info.php?products_id=576 January 23, 2006 [date accessed]

[11] Spark Fun Electronics. (2006) Lassen IQ GPS Receiver Product Information. Available: http://www.sparkfun.com/commerce/product_info.php?products_id=163 January 23, 2006 [date accessed]

[12] Acroname. (2006) Devantech SRF10 Product Information. Available: http://www.acroname.com/robotics/parts/R241-SRF10.html

[13] Acroname. (2006) Devantech SRF04 Product Information. Available: http://www.acroname.com/robotics/parts/R93-SRF04.html [date accessed]

-11- ECE 477 Digital Systems Senior Design Project Spring 2006

Appendix A: Parts List Spreadsheet Vendor Manufacturer Part No. Description Unit Cost Qty Total Cost DigiKey Freescale 9S12NE64CPV 16-bit microcontroller $17.81 1 $17.81 DigiKey Maxim MAX1791 DC voltage converter 3.3V/5V stepdown $3.01 1 $3.01 SparkFun USGlobalSat EM-402 GPS module $65.95 1 $65.95 DigiKey Maxim MAX3233E Serial level converter $8.80 1 $8.80 DigiKey Molex 438600004 Ethernet transformer and jack $3.58 1 $3.58 DigiKey National Semi. LMD18200T H-bridge $11.69 2 $23.38 Acroname Generic R276-S03N-SERVO Servo motor $10.90 1 $10.90 Acroname Devantech SRF04 SONAR module $25.00 1 $25.00 iOffer Generic 1445232 Tank platform $99.00 1 $99.00 DigiKey National Semi. LM2917M Frequency to voltage converter $2.02 2 $4.04 DigiKey NEC PS2532L-4-ND Optical isolator $3.55 1 $3.55

TOTAL $???.??

-12-