ECE 477 Digital Systems Senior Design Project Spring 2006

Homework 5: Circuit Design and Theory of Operation

Due: Friday, February 24, at NOON

Team Code Name: Defense Electronic Autonomous THingamajigger Group No. 5

Team Member Completing This Homework: David L. Jones (jonesdl)

Evaluation:

Component/Criterion / Score / Multiplier / Points
Introduction & Theory of Operation / 0 1 2 3 4 5 6 7 8 9 10 / X 4
Documentation for Circuit Design / 0 1 2 3 4 5 6 7 8 9 10 / X 4
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:

______

______

______

______

______

______

1.0  Introduction

The Design Electronic Autonomous THingamajigger is an autonomously-driven vehicle platform with a weapon which can be engaged at the vehicle’s terminal location. The vehicle autonomously navigates a pre-set course of GPS waypoints, generated by the user and loaded wirelessly from a computer using a WiFi wireless network connection. Once the vehicle is loaded with a drive course, it will navigate the course from waypoint to waypoint within a known margin of error. The same wireless connection is used at the terminal location to provide user feedback from a network camera and to allow the user to aim and activate the weapon.

2.0  Theory of Operation

The design is controlled by a single microcontroller. External components are used to provide additional functionality. Motors are controlled by external H-bridge chips, controlled by PWM speed and binary direction control from the microcontroller. Speed is sensed using external Hall Effect sensors and frequency-to-voltage chips. Obstacle detection is provided by an external SONAR module and a positioning servo. Communications are handled on the microcontroller for both serial and Ethernet/wireless interfaces.

2.1 Microcontroller

The microcontroller used is a Freescale MC9S12NE64. [1] This micro was chosen primarily for its built-in Ethernet capability. In addition to the EMAC Ethernet peripheral, the timer module, the ATD (analog-to-digital) module, general-purpose port pins, and the Serial Communications Interface (SCI) are used in the design.

The microcontroller is clocked using an external 25 MHz crystal in a Pierce configuration. The micro has many of the necessary parts built-in, so the only external components required for the clocking circuit are the crystal itself and a resistor. The Ethernet interface requires that the microcontroller be clocked at 25 MHz; the internal oscillator is capable of a maximum of 16 MHz.

2.1.1 Ethernet Media Access Controller (EMAC)

The Ethernet interface is self-contained on the microcontroller, with the exception of an isolation transformer and the external jack. [2] The Ethernet port is connected directly to a wireless router, to allow remote operation of the vehicle.

2.1.2 ATD

The ATD peripheral is used to sense speed. The speed is sensed by a hall effect sensor attached to a frequency-to-voltage converter. [3] The output voltage is set to a range suitable for reading by the microcontroller.

2.1.3 Timer module

The timer module is used for three functions: drive motor control, SONAR reading, and servo control. The drive motor control is achieved using the output compare feature of the timer module to generate a PWM signal. [4] During the main loop, the channel is reset and the output compare value is set so that the channel will switch at the appropriate point. The servo control is effected by PWM, similarly to the main drive motors. The SONAR module is read by the timer module using the pulse accumulator function, which is only available on the TIM7 port of the microcontroller. Using the pulse accumulator gives an accurate measurement of the length of a pulse without complex software overhead.

2.1.4 General I/O pins

The general purpose I/O pins are used to handle simple digital input and output, such as the external PLD logic. General purpose port pins are also used to control the turret motor via an H-bridge. Outputting a constant value corresponds to a 100% PWM duty cycle, while a second pin is used to set the direction of the turret motor.

A keypad wakeup feature exists on certain ports on the micro. This feature will cause a unique interrupt service routine to be executed in response to a change on the input to the port. These ports are used in the design to read inputs which may require an interrupt, such as the thermal flag on the H-bridges and whatever logic may be implemented in the programmable logic device.

2.1.5 SCI

The Serial Communications Interface has two ports. The first port is used to communicate with a PC via an RS-232 level converter. Since the level converter is a dual-channel chip, the unused pins are pulled low using a 10k SIP resistor. The second port communicates with the GPS receiver. [5]

Since the GPS serial communicates at a lower voltage level, it does not require a level translator. The minimum high logic level of the logic pins is (0.65 × VDD), or 2.145 V, and the maximum low logic level is (0.35 × VDD), or 1.155 V. The GPS receiver signals at 0 ~ 2.8 V; thus, no signal conversion is needed for the GPS serial port.

2.2 Speed sensing circuit

The speed sensing circuit reads frequency from the drive system and outputs a voltage suitable for reading by the microcontroller’s analog to digital peripheral. The input frequency is sensed by a Hall Effect sensor. The Hall Effect sensor is sensitive to a magnetic field, outputting a low or high signal depending on whether a suitably strong field is present. The field is generated by small magnets placed on one of the primary drive gears inside of the drive box. The resulting signal is a square wave.

The device used for the conversion, an LM2917 [3], requires an input frequency suitably high for sensing (on the order of 100Hz-1kHz). The drive box contains several step-down gears, allowing the sensed frequency to be varied by selecting different gears to monitor and changing the number of magnets placed on the gear.

The sensitivity of the LM2917 to the input frequency is controlled by setting the values in an RC delay circuit. The output of the converter chip is an open collector, so the output sensitivity, or voltage scale of the conversion, is set by a current-sensing resistor.

Using the datasheets and application notes from National Semiconductor [3, 6], the speed sensing circuit was constructed such that the output pin would have a sensitivity of 66Hz/V. At this sensitivity level, a 1kHz signal will have an output of roughly 15V, much higher than acceptable for reading by the micro. (In addition, this is outside of the supply range, so the transfer function from frequency to voltage will be non-linear.) However, an input of 100Hz will result in a roughly 1.5V output, which is acceptable. Given that the reference voltage range for the ATD peripheral is 3.3V, a suitable range of input frequencies ranges from 0 Hz (stopped, 0V) to roughly 200 Hz (3.03V). The output levels from the LM2917 can be adjusted, as discussed earlier, by modifying the output resistor and by changing the placement and number of magnets within the drive system.

2.3 H-bridges

H-bridge chips (part number LMD18200T) [7, 8] are used to control several motors in the design. The H-bridges are used in Sign/Magnitude PWM Control mode. In this mode, the input PWM signal controls the magnitude of the output, or speed of the motor. A separate pin is used to control direction. The main drive motors are controlled by a PWM signal from the timer module. For the turret motor, the PWM signal is replaced with a standard port pin, which is equivalent to a 100% PWM signal.

The H-bridge circuit is completely self-contained within the IC package. The input signals are the PWM signal, direction, and a braking signal. In addition to the output to the motor, the H-bridge has an output pin to the microcontroller for thermal overload sensing. In order to prevent damage to the microcontroller in the event of a catastrophic failure of the H-bridge, the lines connected to the microcontroller pass through an optical isolation circuit. In addition to protecting the microcontroller, optical isolation allows separate, isolated power sources for the electronics and drive components, increasing noise rejection due to electromechanical interference.

The H-bridge thermal flags are connected to port J. Port J provides keypad wakeup interrupts, which will cause an interrupt request to a unique vector on a level change on the inputs. Thus, if the H-bridges raise a thermal flag, it will be intercepted by a unique interrupt service routine.

The motors have an inrush current when they are initially turned on. Laboratory testing showed that the inrush current peaked slightly higher than 2A. The H-bridge chips are capable of handling 10A of inrush current and 3A of constant current; the inrush and operating current of the motors is well within these limits.

2.4 SONAR module

The SONAR module [9] is used to detect obstacles in the path of travel for the vehicle. The module used requires an excitation pulse of at least 10 µs. Since the length of this pulse is not critical, this excitation is generated using a standard port pin. The output returned is a pulse with a length corresponding to the distance to the object sensed by the module. In order to accurately measure the length of the pulse, it is connected to the pulse accumulator channel of the timer module on the microcontroller.

2.5 Servo

The servo [10] rotates the SONAR module. This allows the SONAR module to sweep the path of the vehicle without requiring the vehicle itself to turn. This is also desirable in the case when the vehicle must determine a clear path to circumnavigate an obstacle.

The servo operates at a 4.8 V level, while the microcontroller output is 3.3 V. In order to drive at the appropriate level for the servo, a P-channel MOSFET transistor is used to switch the input to the servo based on the output from the microcontroller. A MOSFET was chosen instead of a BJT for its decreased power usage and superior sensitivity to the gate input.

2.6 Power supply

The power supply is comprised of two switch-mode voltage regulators. The MAX 1791 [11] chip was selected to provide the requisite 3.3V and 5V levels for the electronics. The MAX1791 can be configured to deliver either voltage level, and takes its input from a 12V battery pack.

The external components selected for the power supply were chosen based on application notes provided by the manufacturer. The datasheet also provided reference designs for both voltage levels; however, the components specified were of inordinately high cost. The external components alone would have been more than $15 for one power supply, and two are needed in the design. The components which were ultimately chosen were picked based on the requirements set forth in the datasheet.

2.7 Ethernet connection

Control communications to the device are transmitted wirelessly. Since the microcontroller has built-in Ethernet, the wireless link is handled by a separate wireless access point mounted on the vehicle. The microcontroller is connected to the access point by a wired Ethernet connection, and the access point is powered by the on-board battery.

The Ethernet connection requires external magnetic transformers to provide isolation from the microcontroller. A connector with integrated magnetics [12] was chosen as opposed to an external component. The windings on the internal transformer are center-tapped, with the center tap connected to the 3.3V rail. The other windings are pulled up to 3.3V through precision resistors and connected to the PHY pins of the micro. The status of the network link is shown through five LEDs connected to port L. Since port L can be configured as either Ethernet status or general-purpose I/O, these LEDs can be repurposed for uses other than network status.

2.8 PLD

A 22V10 programmable logic device was chosen to allow for expanded functionality not foreseen at the time of board layout. The 22V10 has 10 macrocells which allow input or output, and 12 input-only pins. Eight of the macrocell pins are connected to port G on the microcontroller, one is connected to the nIRQ line, and one is connected only to a header.

Connecting the PLD to port G of the microcontroller serves several purposes: since the pins are I/O, the PLD can serve as input or output logic from the micro, such as allowing switch debouncing (input) or LED drving (output). Since the PLD can serve these dual roles, the connection to port G is made by a header with pin jumpers. The input pins of the PLD are connected to a header, thereby allowing easy flywiring between inputs, outputs, and pins on the micro. Port G also provides a keypad wakeup interrupt, which will cause an interrupt request to a unique interrupt service routine vector in response to a level change on the input pins. This functionality allows the PLD to serve as external monitoring with the capability to wake up the micro.

2.9 Chip headers

Most of the pins on the microcontroller are connected to pins for external debugging. The headers are divided according to which side of the chip they are placed. As a result, the ports are not generally laid out contiguously on the headers. On two of the sides of the chip, there are critical signals (clocking crystal circuit and Ethernet) which should not be crossed by other traces. As a result, the headers on those sides are split such that the pins on either side of the critical signal are carried only on their respective sides, without crossing the critical signals.