E 5 5 2 - C O M P U T E R A I D E D C I R C U I T D E S I G N

 

 

MARS EXPLORER LITE

Final Report

 

 

 

Department of Electrical Engineering

 

 

by

Shane Pilsworth

Phillip Jacobsen

 

 

 

 

 

  

 Table of Contents

 

 Abstract *

IC Data Sheet *

Expansion slot C of UP 1 Education Board *

Expansion slot A of UP 1 Education Board *

Chip Overview *

Motor Controller *

Navigation Module *

Instrumentation Module *

RS-232 Output Module *

System Specifications *

System Clock Frequency *

System Overview *

Stepper Drivers *

Instrumentation *

RS-232 Converter *

LPT Expander *

Additional components *

Parts List: *

Design Verification *

System Operation *

Interaction between Navigation, Instrument and Output Modules *

Navigation and Motorcontrol Modules *

RS 232 Output Module *

Conclusion *

VHDL Code: Code

 

Abstract

This document outlines the complete design for the Mars Explorer LITE project. This EE552 design project consists of the digital system used to control a small vehicle with attached measurement equipment for remote surveying, à la the Mars Sojourner. The controlling station will transmit target coordinates to the remote system. The remote vehicle will then autonomously navigate to the specified location and take a number of measurements using onboard sensors. Upon acquisition, sensor data will be transmitted back to the control station using an optional RF transmitter. Additionally, the system will be capable of operating with minimal user intervention to permit applications where a low latency link is unavailable, i.e. planetary exploration.

All control logic is contained in an Altera EPF10K20RC240-4 FPGA. The ASIC is mounted on a chassis with two stepper motors and appropriate power transistor drivers. Other external hardware includes a TTL to RS-232 level converter, a buzzer and assorted LEDs and interconnect.. An external PC equipped with an RS-232 port is also required to receive serial data transmitted by the system. No sensors were actually used for the system. Sensor inputs were simulated using DIP switches and a PC parallel port.

The design was completely implemented using VHDL. Altera’s Maxplus2 CAD software was used to simulate and synthesize the design.

 

IC Data Sheet

Included is an internal divide by 2 clock. Maximum system clock frequency is 35.38MhZ

The motor control signals can be interfaced to four phase stepper motors. The motors must have a driver circuit as the board cannot power the motors directly.

The serial out pin can be interfaced to any standard RS-232 port at 9600 baud

New target coordinates will be latched when robot busy is low and Pin_CoordReady is high.

An active low reset is included.

 

Expansion slot C of UP 1 Education Board

Hole Number

Signal/Pin

Signal Name

Description

Hole Number

Signal/Pin

Signal Name

Description

15

175

PIN_Phases1(0)

Left Motor Control signal

16

181

PIN_SensorData1a(0)

Kryptonite Level input(LSB)

17

182

PIN_Phases1(1)

Left Motor Control signal

18

183

PIN_SensorData1a(1)

Kryptonite Level input

19

184

PIN_Phases1(2)

Left Motor Control signal

20

185

PIN_SensorData1a(2)

Kryptonite Level input

21

186

PIN_Phases1(3)

Left Motor Control signal

22

187

PIN_SensorData1a(3)

Kryptonite Level input

23

188

PIN_Phases2(0)

Right Motor Control signal

24

190

PIN_SensorData1a(4)

Kryptonite Level input

25

191

PIN_Phases2(1)

Right Motor Control signal

26

192

PIN_SensorData1a(5)

Kryptonite Level input(MSB)

27

193

PIN_Phases2(2)

Right Motor Control signal

29

195

PIN_Phases2(3)

Right Motor Control signal

31

198

unused

33

200

unused

35

202

unused

37

204

unused

39

207

robot_busy

New coordinates invalid when high

41

214

PIN_FanEnable

output fan enable

43

217

PIN_LightEnable

output light enable

45

219

unused

47

221

serial_out

Output serial data

 

 

Expansion slot A of UP 1 Education Board

Hole Number

Signal/Pin

Signal Name

Description

Hole Number

Signal/Pin

Name

Description

15

45

PIN_X_Position_in(0)

X coordinate(LSB)

16

46

PIN_Y_Position_in(0)

Y coordinate(LSB)

17

48

PIN_X_Position_in(1)

X coordinate

18

49

PIN_Y_Position_in(1)

Y coordinate

19

50

PIN_X_Position_in(2)

X coordinate

20

51

PIN_Y_Position_in(2)

Y coordinate

21

53

PIN_X_Position_in(3)

X coordinate

22

54

PIN_Y_Position_in(3)

Y coordinate

23

55

PIN_X_Position_in(4)

X coordinate

24

56

PIN_Y_Position_in(4)

Y coordinate

25

61

PIN_X_Position_in(5)

X coordinate

26

62

PIN_Y_Position_in(5)

Y coordinate

27

63

PIN_X_Position_in(6)

X coordinate

28

64

PIN_Y_Position_in(6)

Y coordinate

29

65

PIN_X_Position_in(7)

X coordinate(MSB)

30

66

PIN_Y_Position_in(7)

Y coordinate(MSB)

31

67

PIN_CoordReady

Valid coordinate ready

acitive low

32

68

reset_in

active low reset

33

70

PIN_SensorData2(0)

Temperature input(LSB)

34

71

PIN_SensorData1b(0)

Quality data input(LSB)

35

72

PIN_SensorData2(1)

Temperature input

36

73

PIN_SensorData1b(1)

Quality data input

37

74

PIN_SensorData2(2)

Temperature input

38

75

PIN_SensorData1b(2)

Quality data input

39

76

PIN_SensorData2(3)

Temperature input(MSB)

40

78

PIN_SensorData1b(3)

Quality data input

41

79

unused

42

80

PIN_SensorData1b(4)

Quality data input

43

81

PIN_SensorData3(0)

Light level input(LSB)

44

82

PIN_SensorData1b(5)

Quality data input(MSB)

45

83

PIN_SensorData3(1)

Light level input

46

84

PIN_SensorData1c(0)

Type data input(LSB)

47

86

PIN_SensorData3(2)

Light level input

48

87

PIN_SensorData1c(1)

Type data input

49

88

PIN_SensorData3(3)

Light level input(MSB)

50

94

PIN_SensorData1c(2)

Type data input

51

95

unused

52

97

PIN_SensorData1c(3)

Type data input

53

98

unused

54

99

PIN_SensorData1c(4)

Type data input

55

100

unused

56

101

PIN_SensorData1c(5)

Type data input(MSB)

 

 

Chip Overview

The chip consists of a number of semi-independent VHDL modules. Each module is responsible for a subset of the overall chip functionality. Major subsystems are the Motor Controller, the Navigation Module, the Instrumentation Module, and the RS-232 Output Module.

Motor Controller

The Motor Controller module is responsible for the primitive control of the external four phase stepper motor circuits. This module will accept commands from the Navigation Module and output the appropriate actuation sequences to the transistor drivers. Valid commands will include the primitive maneuvers forward, reverse, left turn 90° , and right turn 90° . These commands are implemented by enabling two motor phases for short periods of time (~10 ms.). Each movement cycle will consist of four unique stages, with two different motor phases being enabled in each stage. If an invalid command or a reset signal is received, the Motor Controller will complete the current move and place the motor phases in an idle state. Completing the current operation insures that the vehicle can continue to correctly navigate relative to its initial position. In the idle state one phase is enabled to lock the wheels and prevent roll. This module will also provide handshake lines for interface to the Navigation Module. While the Motor Controller is processing a command it will ignore further commands. For additional detail refer to:

http://www.ee.ualberta.ca/~elliott/ee552/studentAppNotes/98f/stepper_motors

This VHDL entity was implemented using two behavioral finite state machines, one for each motor. These FSMs decode the input move instructions with each state representing one of the four possible output states, each with two different phases triggered. State transitions are then made as required to execute the desired command. As the stepper windings can operate at a maximum frequency of less than 1 kiloHertz the FSMs need a clock divider. By increasing the clock speed to the state machines the vehicles speed can be increased.

Navigation Module

The Navigation Module interfaces with the Remote Base Station and the Motor Controller. Target coordinates are input by the remote controller and the Navigation Module will generate a sequence of primitive movement commands to maneuver from the current location to this target location. The navigation algorithm for the initial system is simple. The current location will be stored as an X and an Y coordinate. The current X coordinate will be compared to the target X coordinate and the Motor Controller will be instructed to either move forward or backwards until the target X coordinate is reached. It is assumed that the vehicle is facing in the positive X direction at the beginning of each move. After the target X coordinate is reached, the Navigation Module must generate the appropriate commands for a 90° left turn. With the vehicle now facing in the positive Y direction, the current and target Y coordinates are compared and a series of forward or reverse commands is generated as appropriate. Lastly the Navigation Module will send a 90° right turn command to correctly orient the vehicle for the next move. When the target destination is reached, an enable is sent to the Instrumentation Module.

A behavioral finite state machine was used to implement this entity. This FSM handshakes with the motor controller to determine when the robot is ready to accept new move commands.

Instrumentation Module

The Instrumentation Module will interface with the Navigation Module and the RS-232 Output Module. This module will latch the survey readings of the onboard instruments and send them to the RS-232 module for transmission back to the base station. Kryptonite level readings are sent continuously, whereas MsrType readings are only taken when the Navigation Module indicated that a target location has been reached. If the level readings at the target location are sufficiently high (exceed a preprogrammed threshold), a third type of measurement, indicating quality, is taken. Additionally the Instrumentation Module will monitor environmental readings from other onboard instruments. When hazardous or undesirable conditions are detected, the Instrumentation Module will attempt to compensate. This includes turning on a cooling fan if the external temperature exceeds the rated operating temperature, or activating external lights if ambient light levels fall too low.

The instrumentation entity contains no processes of its own but connects individual entities responsible for each of the sensors giving it a structural architecture. The major component of these is the Kryptonite entity. A behavioral FSM is used to insure that sensor readings are taken at appropriate times. It is also responsible for sending all data to the RS-232 module for transmission.

RS-232 Output Module

The Output Module will generate an RS-232 stream of survey and system data. This serial data can be transmitted back to the base station via a radio link or cable. Each data reading will include a timestamp indicating the system time the measurement was taken at, and a binary code to identify the data. Serial communications will be received with a PC terminal, and will use standard settings: 9600,n,8,1. If parity checking or other error detection/correction information is needed it can be added as necessary.

A parallel to serial shift register has been implemented with VHDL to generate the serial bit stream. Each data message consists of two data bytes and the necessary framing bits. Data is transmitted using one start bit and one stop bit, for a total of ten bits for each frame. For the two data frames a twenty-bit shift register is used with the bit positions corresponding to start or stop bits being hardcoded to the appropriate logic level. The output of an 8-bit counter providing the system time is connected to the first 8 data bits. This counter starts at 0 and runs at 0.25 Hz. giving a maximum mission time of 2048 seconds. If this is insufficient, the system clock can be run at a lower frequency to accommodate the desired time requirements. The second byte of data represents sensor measurements and is provided by the Instrumentation Module. The clock input to the shift register is another clock divider providing a 9600 Baud clock. As there is some error in this derivative of the system clock, it is necessary to occasionally hold the TX line idle to allow the clocks to resynchronize and avoid communications errors caused by propagation of this clock error.

 

 

 

System Specifications

Currently the design consumes 549 of the 1152 logic cells available. This allows room for more complex features and additional modules or features to be added to the system.

Table 1 : System Resources

Design Entity

Percent

Total Logic Cells

Motor Control

7 %

82

Navigation

21 %

252

Instrumentation

5 %

60

RS-232

8 %

93

Explorer (total)

47 %

549

System Clock Frequency

The maximum system clock frequency was obtained using the Registered Performance Tool in MaxPlus2. As our maximum clock frequency is less than the system clock on the UP1 board it will be necessary to implement a clock divider to slow down the 25.175 MHz. clock found on the UP1 board to 12.59 MHz.

Table 2: System Clock

Maximum System Clock Frequency

17.69 MHz.

System Overview

Some external hardware is required for the system. All digital logic is contained in the ASIC, this external hardware is only used for interfacing non-TTL devices.

Stepper Drivers

A full step actuation technique was used in order to provide greater precision and power compared to a basic technique. The stepper motors require a power output stage that would be able to handle around 300 mA. per phase. Tip 31C power transistors were used. These transistors can handle up to 1 A. This enables our system to upgrade to more powerful motors. The application note on stepper motor control can be consulted for more detailed description on operations. Initially a stepper motor controller was built out of TTL components to test the operation of the motors. Without any documentation on the type of motors that were obtained, this controller enabled us to determine approximate stepping angles, which gave approximate speeds that the motors were capable of.

Instrumentation

A LED was used to represent the external lamps of the vehicle. When a low light level condition is detected the LED is turned on. A buzzer was used as a warning signal to indicate that temperature is above a critical level. A cooling fan would be added to this circuit to cool the vehicle when operating at high temperature.

RS-232 Converter

The RS-232 protocol uses ± 12 V levels to signal different logic values. To accomplish this an MC1488 level converter chip is required. This chip will take the 0-5V logic level supplied by the FPGA and convert it to the appropriate RS-232 level. This chip requires a ± 12V supply so a level converter that requires only +5V would be preferable, such as a MAX232.

LPT Expander

Since no instruments were actually attached to the vehicle, their inputs had to be simulated. DIP switches were used for some testing but are inconvenient when many inputs are needed and must be changed frequently. To easily model the changing inputs from the instruments signals were taken from a standard LPT port. An expansion board was used to increase the number of available signals to 32 from the standard 8 available.

Additional components

We created our design so that the system could be powered by ± 12 volts. We included individual voltage regulation on each of the boards used. A 7805 regulator was used to obtain 5 volts for the Altera board. An LM317 was used to provide a 7 volt supply to the motors.

External components were assembled with a combination of soldering and wirewrapping. These techniques were adequate for our prototype.

Parts List:

Part

Supplier

UP 1 Education Board

Altera Corporation

1 - MC1488 logic converter

EE store

1 - 7805 Voltage Regulator

EE store

8 - TIP 31C power transistors + heatsinks

Future Active Components

2 - 7 volt four phase stepper motors

EE store

1 chassis

EE store

1 - 555 timer

EE store

1 - dc buzzer part# 273-060A

Radio Shack

± 12 volt power supply

Future Active Components

Assorted Interconnect

EE stores, Radio Shack

 

Design Verification

The design was first verified with extensive simulation using the Altera CAD tools. Each module was tested independently and then the entire system was tested after integration. After the system was assembled final testing was done to verify the interface to the external hardware.

System Operation

Figure 1. shows a simulation of the entire system showing all inputs and outputs. Many of the modules in our system run at a much slower clock then the global system clock. For simulation purposes speeding these modules up does not cause adverse effects. The motor control entity clock determines the speed of the pulses sent to the stepper motors. The number of iterations to move one unit of direction is also reduced. The RS232 module clock would normally run at a speed corresponding to a baud rate of 9600.

The specific workings of specific modules will be shown later in more detail.

In this simulation a target coordinate is read in upon ‘PIN_CoordReady’ going low. The target destination is reached at about 23us. At this point the unit will take soil samples and other readings. These operations aren’t evident in this simulation but will be shown more clearly in simulations presented next. The ‘robot_busy’ signal is high when the robot is moving and taking soil samples. There are two sensors , temperature and light level, that are continuously monitored and cause a cooling fan to turn on if the ambient temperature becomes to high, and a lamp to turn on if it becomes too dark.

 pictures\figure1.scf

 

Interaction between Navigation, Instrument and Output Modules

The purpose of Figure 2. is to show the different types of data sent out via the RS232 port and the times that they occur.

When ‘PIN_CoordReady’ goes high, target locations are latched and the navigation module begins route calculations and sends the robot one unit of movement in the X direction. When movement is done signaled by ‘PIN_Busy’ going low results in soil sampling to begin signaled by ‘PIN_busy_measuring’ going high. MsrType data is then collected followed by Quality measurements. When soil sampling is finished, the robot sits where it is waiting for new target coordinates.

At the same time, data is being sent out via the RS 232 port. ‘PIN_sensor_ready’ and ‘PIN_transmit_ready’ are internal handshaking lines between the Instrumentation module and the Output module that are used to show when data is latched. Upon a high to low transition of ‘PIN_transmit_ready’ , new data is latched into a shift register and sent out of the RS 232 port. Looking at Figure 2. after the first transition, Kryptonite level data is latched while the robot is moving. At the second transition, the robot has finished moving and MsrType data is latched. This data is always sent when the target location is reached. At the third transition Quality data is latched and sent. This type of data is taken by a soil sampler if the Kryptonite level is above a threshold. At the next transition Kryptonite level data is sent and will continue to be sent until the robot makes another move and stops.

 pictures\figure2.scf

Navigation and Motorcontrol Modules

Figure 3. will show in detail the signals sent to each of the phases of the motors during a move towards a target location. New coordinates are only latched when the robot is not busy moving or taking measurements. A target location of (6,3) is latched when ‘PIN_CoordReady’ goes high. The initial coordinates of the robot are (4,4). Therefor the robot must move two units in the positive X direction, turn left 90 degrees, move backwards one unit in the Y direction, and then turn right 90 degrees so that the robot always ends a move with the same orientation. The ‘PIN_Phases’ signal is a four bit vector with each bit corresponding to a phase of the stepper motor. A stepping sequence of C,6,3,9(hex) causes the motor to turn forward and C,9,3,6 reverses the motor. During a turn one of the motors turns forward while the other reverses. For this simulation a forward command results in three iterations of the stepping sequence and a reverse results in two iterations. A turn command causes only one iteration.

 pictures\figure3.scf

RS 232 Output Module

Figures 4. and 5. show both a general and a detailed view of the serial output module. In particular the operation of the handshaking lines and the reset are demonstrated. The framing and output of the RS-232 stream is also illustrated. Note that after the two data frames are sent, the TX line is held in the idle state to allow the clocks to resynchronize.

Sim 4

Sim5

 

Conclusion

This 552 project was successful. All required features were functional by the end of the term. The end system achieved our design goals. Our system was flexible and could be easily reconfigured for different user applications simply by modifying the sensors. The system is easily expandable. Only 50% of the FPGA resources were consumed leaving plenty of room for new code. The modular design simplifies adding new functionality. Our main design goal, to create a system which can adapt to changing environmental conditions, was satisfied, but could be improved.

Completing the project however, required a very aggressive schedule. As none of our group members had any prior knowledge of VHDL, coding proved to be difficult. Good planning and verifying the correctness of components as early as possible, reduced the total development time and were directly responsible for the success of this project. After all simulations were complete assembling the system went very smoothly with only a few minor errors discovered. Debug cycles went quickly with the Altera tools. The reprogrammable device was very easy to load and code fixes could be easily tested.