88
ECE 477 Final Report Fall 2004 Team Code Name: The Digijokers Team ID: 8 Team Members (#1 is Team Leader): #1: Aliasgar Poonawala Signature: ____________________ Date: _________ - i - Clive Lopez Raghuram Ramanujan Ali Poonawala Mohan Rokkam

EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

Embed Size (px)

Citation preview

Page 1: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final ReportFall 2004

Team Code Name: The Digijokers Team ID: 8

Team Members (#1 is Team Leader):

#1: Aliasgar Poonawala Signature: ____________________ Date: _________

#2: Mohan Rokkam Signature: ____________________ Date: _________

#3: Clive Lopez Signature: ____________________ Date: _________

#4: Raghuram Ramanujan Signature: ____________________ Date: _________

- i -

Clive Lopez Raghuram Ramanujan Ali Poonawala Mohan Rokkam

Page 2: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

-ii-

Page 3: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

REPORT EVALUATION

Component/Criterion Score Multiplier Points

Abstract 0 1 2 3 4 5 6 7 8 9 10 X 1

Project Overview and Block Diagram 0 1 2 3 4 5 6 7 8 9 10 X 2

Team Success Criteria/Fulfillment 0 1 2 3 4 5 6 7 8 9 10 X 2

Constraint Analysis/Component Selection 0 1 2 3 4 5 6 7 8 9 10 X 2

Patent Liability Analysis 0 1 2 3 4 5 6 7 8 9 10 X 2

Reliability and Safety Analysis 0 1 2 3 4 5 6 7 8 9 10 X 2

Ethical/Environmental Impact Analysis 0 1 2 3 4 5 6 7 8 9 10 X 2

Packaging Design Considerations 0 1 2 3 4 5 6 7 8 9 10 X 2

Schematic Design Considerations 0 1 2 3 4 5 6 7 8 9 10 X 2

PCB Layout Design Considerations 0 1 2 3 4 5 6 7 8 9 10 X 2

Software Design Considerations 0 1 2 3 4 5 6 7 8 9 10 X 2

Version 2 Changes 0 1 2 3 4 5 6 7 8 9 10 X 1

Summary and Conclusions 0 1 2 3 4 5 6 7 8 9 10 X 1

References 0 1 2 3 4 5 6 7 8 9 10 X 2

Appendix A: Individual Contributions 0 1 2 3 4 5 6 7 8 9 10 X 4

Appendix B: Packaging 0 1 2 3 4 5 6 7 8 9 10 X 2

Appendix C: Schematic 0 1 2 3 4 5 6 7 8 9 10 X 2

Appendix D: Top & Bottom Copper 0 1 2 3 4 5 6 7 8 9 10 X 2

Appendix E: Parts List Spreadsheet 0 1 2 3 4 5 6 7 8 9 10 X 2

Appendix F: Software Listing 0 1 2 3 4 5 6 7 8 9 10 X 2

Appendix G: User Manual 0 1 2 3 4 5 6 7 8 9 10 X 2

Appendix H: FMECA Worksheet 0 1 2 3 4 5 6 7 8 9 10 X 2

Technical Writing Style 0 1 2 3 4 5 6 7 8 9 10 X 5

CD-R of Website Image 0 1 2 3 4 5 6 7 8 9 10 X 2

TOTAL

-iii-

Comments:

Page 4: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

TABLE OF CONTENTS

Abstract 1 1.0 Project Overview and Block Diagram 1 2.0 Team Success Criteria and Fulfillment 2 3.0 Constraint Analysis and Component Selection 2 4.0 Patent Liability Analysis 5 5.0 Reliability and Safety Analysis 9 6.0 Ethical and Environmental Impact Analysis 11 7.0 Packaging Design Considerations 13 8.0 Schematic Design Considerations 16 9.0 PCB Layout Design Considerations 1910.0 Software Design Considerations 2111.0 Version 2 Changes 2912.0 Summary and Conclusions 2913.0 References 30Appendix A: Individual Contributions 32Appendix B: Packaging 36Appendix C: Schematic 37Appendix D: PCB Layout Top and Bottom Copper D1Appendix E: Parts List Spreadsheet E1Appendix F: Software Listing F1Appendix G: User Manual G1Appendix H: FMECA Worksheet H1

-iv-

Page 5: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Abstract

An automated shopping cart that follows a shopper around a simulated supermarket

environment was successfully designed, constructed and tested. An ultrasonic beacon is carried

by the shopper and tracked by the cart. The cart uses the relative strength of the ultrasonic waves

received by its sensors to triangulate the position of the user and attempts to maintain a fixed

distance to the shopper (within some tolerance). The cart is fitted with infrared proximity sensors

that allow it to avoid obstacles in the path of motion.

1.0 Project Overview and Block Diagram

The project is logically divisible into two standalone components – the transmitting

beacon and the cart. The beacon is implemented using a LM555 timer to drive a Polaroid

ultrasonic transducer. The following block diagram (Fig. 1.1) offers an abstract view of the more

complicated design of the cart. The cart’s onboard microcontroller, an Atmel AVR ATMega32L,

is interfaced to Sharp GP2D15 infrared proximity sensors via the external interrupt pins on the

chip. The outputs of the ultrasonic receivers are fed into the A/D channels of the microcontroller.

Finally, the cart’s drive motors are controlled by pulse width modulated (PWM) signals

generated by the processor. The beacon circuitry is powered using a compact 12V (40mAh)

-v-

A/DA/D

PWM

IRQ PWM

IRQ

Atmel ATMega32L

Sharp GP2D15

Sharp GP2D15

Ultrasonic Receiver 1

Ultrasonic Receiver 2

Motor 1

Motor 2

Fig 1.1 – Project Block Diagram

Page 6: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

GP27A battery. The cart itself is powered using a rechargeable Nickel-Metal-Hydride (NiMH)

battery pack comprising eight 1.2V (2500mAh) batteries.

2.0 Team Success Criteria and Fulfillment

a) Ability to transmit a beacon signal – successfully demonstrated

b) Ability to identify the bearing of the beacon – successfully demonstrated

c) Ability to approximate the distance to the beacon using relative signal strength –

successfully demonstrated

d) Ability to follow the beacon – successfully demonstrated

e) Ability to avoid obstacles in the path of motion – successfully demonstrated

3.0 Constraint Analysis and Component Selection

Computational Requirements

The computational demands of the project were deemed to be rather modest at the outset.

The core of the control algorithm comprised processing interrupt requests generated by the

proximity sensors and periodically polling the ultrasonic receptors. Neither of these tasks was

time critical and thus, the microcontroller chosen for this application did not need to run at a high

-vi-

A/DA/D

PWM

IRQ PWM

IRQ

Atmel ATMega32L

Sharp GP2D15

Sharp GP2D15

Ultrasonic Receiver 1

Ultrasonic Receiver 2

Motor 1

Motor 2

Fig 1.1 – Project Block Diagram

Page 7: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

clock frequency. Besides, a slower chip offered the dual benefit of lower costs and power

consumption. Another key decision that needed to be made was with regards to the amount of

program memory. From past experience, it was determined that 32Kb of flash memory (program

space) and 2Kb of SRAM would be sufficient to meet the demands of this project, while leaving

ample space for future development.

Interfacing Requirements

The shopping cart was to infer the position of the shopper by measuring the relative

strength of the ultrasonic pulses picked up by the receivers mounted on the different ends of the

cart. Each ultrasonic receiver would transform the signal received into an analog voltage value

that would then be read by the microcontroller. This imposed the constraint that the chosen

microcontroller possess analog-to-digital (ATD) conversion capability. Also, in order to

continually adjust its position relative to the shopper, the cart was to periodically poll these

receivers – this required a peripheral capable of generating a periodic interrupt such as an RTI

module or a timer module with output compare.

While following the movements of the shopper, it was possible for the cart to collide with

obstacles in its path of motion. This problem was addressed through the use of infrared proximity

sensors. The intention was that when an object got within a certain distance of the cart, these

sensors would trigger an interrupt request and the control algorithm would take evasive action.

Thus, the microcontroller chosen for the design had to support external interrupt sources. The

driving and steering of the cart was to be controlled by DC motors attached to the wheels, which

in turn would be controlled by the microcontroller. To permit variable speed control and

facilitate turning, the microcontroller was also required to have a pulse width modulation (PWM)

unit.

Power Supply Constraints

The microcontroller chosen for the design operated on a 3.3V power supply [1]. At a

clocking frequency of 4MHz (25°C) it drew 3.8mA of current [1]. The infrared proximity

sensors operated on a 3.3V supply voltage [2], while the ultrasonic reception circuitry required

+6V and -6V voltage supply rails [3]. Thus, the power supply unit residing on the cart had to be

designed in such a way as to support all these devices. The DC motors could be run directly off

-vii-

Page 8: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

the unregulated power rail from the batteries. The power supply unit for the beacon needed to

supply a regulated 6V output to support the ultrasonic transmitter circuitry [3]. Since all these

devices were to be powered by on-board rechargeable batteries, it was critical to choose

components that consumed as little power as possible to prolong battery life.

Packaging Constraints

The beacon used to direct the cart had to be small enough to be worn on the shopper’s

hand like a wristwatch. Thus, the chief packaging constraint was to keep the size and weight of

the beacon as small as possible. As for the cart itself, there were no significant size or weight

constraints. The dimensions of the cart, however, needed to be large enough to provide a

sufficient resolution for the ultrasonic receivers to triangulate the position of the beacon. For

purely aesthetic reasons, efforts were made to keep the control circuitry as invisible as possible.

Budget Constraints

Conventional chrome/steel shopping carts sell for $130-$200 per unit. However, with the

host of benefits offered by this revolutionary design, it should be possible to price the product

slightly above the current market rate and still remain competitive. Thus, the chief budget

constraint was to keep prices as low as possible without losing any functionality. Prototyping

costs were predicted to fall in the $250-$300 range, but actual unit costs are likely to be lower

than this figure once the product goes into mass production.

Choice of Microcontroller

Choosing the best microcontroller to fit the needs of the project was the most important

design decision. As mentioned earlier, the following key constraints were identified first:

processor can operate on a moderate clocking speed (1 - 4Mhz)

32Kb flash, 2Kb SRAM should be sufficient

processor must possess an A/D converter

processor must have an RTI / timer module to generate periodic interrupts

processor must support external interrupts

processor must have a PWM module

processor must be power and cost efficient

-viii-

Page 9: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Four major microcontroller manufacturers were initially investigated, of which two –

Rabbit and PIC - were immediately eliminated as they failed to offer the desired combination of

peripherals and features at competitive prices.

Atmel’s AVR line of 8-bit microcontrollers and Motorola’s HC08 family were then

studied in detail to find the controller best suited to the needs of the project. Motorola’s HC05

and HC11 families were also briefly studied, but this was promptly abandoned when it was

discovered that these controllers offered only one-time programmable memory as opposed to

flash memory, for program storage. The shortlist was eventually narrowed down to the Atmel

ATMega32L and the MC9S08GT32. Both microcontrollers were found to be nearly identical

feature-wise and satisfied all the criteria listed above [1, 5]. Eventually, the decision was made to

use the Atmel chip owing to the wealth of readily available, easy-to-use development tools as

this would significantly reduce the time required to engineer a prototype.

Choice of Infrared Proximity Sensor

It was important to select a proximity sensor that would be compatible with the chosen

microcontroller. The two main candidates in this case were the Sharp GP2D12 and GP2D15

sensors. Both were relatively inexpensive solutions to the problem of detecting obstacles in the

shopping cart’s path of motion. The decision was eventually made to use the GP2D15 as the

project only required obstacle detection, rather than obstacle range estimation [2]. Using this

sensor also allowed for a simpler interrupt-driven interface to the processor as the GP2D15

provides a digital output, compared to the GP2D12 that provides an analog output [2].

4.0 Patent Liability Analysis

We can describe the main functional systems in the design as follows

- A mechanical device that can move autonomously

- Device navigation achieved by using a beacon

- Beacon direction and strength estimated by triangulation

- Obstacle avoidance by using a set of sensors

These above functional guidelines can be used while searching for patent infringement or

patent liability issues.

-ix-

Page 10: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Results of Patent Search

A patent search was conducted to locate patents that had the functionality the same as or

similar to the ones utilized by our design. A search was also conducted to identify commercial

products with similar functionality. No commercial products were found. However, several

educational institutions have designed and developed robots with the above functionality to some

extent. The patent search revealed multiple patents with possible infringement. These are listed

in the table below:

S.No. Pat No. Title Date of Patent

1. 4,751,658 Obstacle Avoidance System June 14th, ‘88

2. 6,567,044 Miniature, unmanned remotely guided vehicles for

locating an object with a beacon

May 20th, ‘03

3. 6,339,709 Personnel locating System Jan 15th,’02

4. 5,911,767 Navigation system for an autonomous mobile robot Jun 15th, ‘99

5. 5,711,388 Robotic golf caddy apparatus and method Jan 27th, ‘98

6. 5,491,670 System and method for sonic positioning Feb 13th, ‘96

7. 5,165,064 Mobile robot guidance and navigation system Nov 17, ‘92

8. 5,111,401 Navigational control for an autonomous vehicle May 5th, ‘92

9 4,710,020 Beacon Proximity detection system for a vehicle Dec 1, ‘87

Table 4-1: List of similar Patents [6]

Analysis of Patent Liability

The patents listed above have some extent of similarity with our design. Listed below are

the patents that have a literal infringements or infringements within the Doctrine of equivalents

with our design or parts thereof.

Literal Infringements

1) Mobile robot guidance and navigation system (Pat. No. 5,165,064) [6]

Assignee: Cyberotics, Inc

Date: Nov 17, 1992

-x-

Page 11: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Abstract: A mobile robot which has a guidance and navigation system (sometimes called a

"vision" system) employing one or more arrays of ultrasonic transducers and, preferably, one or

more infrared detectors, as well. Each of the ultrasonic transducers is arranged to monitor its own

sector of the robot's workspace. Sector monitoring is facilitated by providing for each such

transducer a horn fronting the transducer; at least part of the horn's surface is covered by

ultrasonic energy absorptive material. According to a second aspect of the invention, the robot is

used in conjunction with an infrared beacon system including one or more (preferably ceiling-

mounted) beacons each of which emits a uniquely coded infrared signal. The robot is equipped

with an infrared detection means affixed to the robot and arranged to allow light from the beacon

to impinge on an infrared sensor only when the detector is in precise alignment with the beacon.

Multiple sensors are preferably provided, each receiving light from the beacon only when that

sensor is aligned with the beacon. The signal from the infrared beacon is decoded to ascertain the

particular beacon the robot is near. The orientation of the robot relative to the beacon is signalled

by which sensor is aligned with the beacon, which is determined by the processor examining all

sensor outputs and picking the one with the largest output signal.

Analysis: The above patent describes a system that utilizes one or more arrays of ultrasonic

transducers or infrared detectors to determine the direction of a beacon and then move the robot

based on that. This is functionally very similar to our design. However, the implementation is

different in that it uses multiple beacons to help the robot determine its relative location.

2) System and method for sonic positioning (Pat. No. 5,491,670) [6]

Inventors: Weber; T. Jerome

Date: Feb 13th, 1996

Abstract: A system and method for determining the position of an automatically guided vehicle

within a workspace which operates by detecting sounds generated by beacons placed within the

workspace. The time for the beacon sounds to reach the vehicle is measured and a distance to

each beacon is determined. From these measured distances and the known positions of the

beacons, the vehicle can determine its relative position.

Analysis: The above patent describes a method that triangulates the position of a vehicle by

using the difference in time of signals received by the robot. This is similar to our design in that

it uses sound wave beacons to determine the relative location of the robot. However, it also

-xi-

Page 12: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

differs in the exact implementation as our design uses signal strength to determine the direction

and distance of a single beacon.

3) Obstacle avoidance system (Pat. No. 4,751,658) [7], [6]

Assignee: Denning Mobile Robotics, Inc

Date: June 14th, 1988

Abstract: A system for avoiding obstacles in the path of a vehicle including a sensor assembly

having a field of view with a plurality of sectors for detecting the distance of objects within each

sector. The system further includes an element for identifying obstructed sensors in which

objects are detected within a predetermined range and a device for selecting an unobstructed

sector close in alignment to the direction of the path to designate around the object a clear path

which is close to the original path.

Analysis: The above patent describes a system that uses multiple sensors to determine the

location of sensors and based on whether a sensor is obstructed or not, determines a possible path

around the obstacle. This is similar in functionality as well as implementation on our robot.

Infringements Under Doctrine of Equivalents

1) Beacon proximity detection system for a vehicle (Pat. No. 4,710,020) [6]

Assignee: Denning Mobile Robotics, Inc

Date: Dec 1st, 1987

Abstract: A proximity detection system for determining the distance between a vehicle and a

navigation beacon by resolving the altitude angle between the beacon and the vehicle and

determining the distance between them. The system then defines an optimum distance between

the beacon and the vehicle and compares the determined distance and the optimum distance to

establish any difference between them.

Analysis: The above patent is functionally similar to the beacon proximity detection system in

our design. However, the implementation is different in our design.

Other than the patents detailed above, patents 6,567,044 6,339,709 5,911,767 5,711,388

and 5,111,401 also have some amount of functional similarities with our design [6]. Patent

6,567,044 uses triangulation to determine the location of a beacon with respect to the transmitter.

-xii-

Page 13: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Patent 6,339,709 also has the functionality of determining the location of a beacon. Patent

5,911,767 involves using beacons to supply location information to a robot that determines its

future direction of motion. Patent 5,711,388 describes a robotic golf caddy that appears to use

similar functional systems as our design. Patent 5,111,401 describes a system that obtains

information from sensors that are supplied to a central unit that then directs the motion of the

device. These patents appear to have some amount of functional similarity with our design.

However, they are not generalized enough to cause our design to be included in their scope.

Recommended Action

Our system definitely infringes on patent no. 4,751,658. Licensing or acquiring this patent

would be required to prevent infringement. However, this patent runs out in 2 years time. This

can be taken into consideration while negotiating licensing terms. The rest of the above

discussed patents would require further examination by patent lawyers to determine if an

infringement actually exists.

5.0 Reliability and Safety Analysis

The major functional blocks are the ultrasonic receiver, the ultrasonic transmitter, the

infrared proximity sensor, the motor drive circuitry and the power circuitry. Reliability of the

overall system will be dependent on the reliability of these individual blocks, and will roll-up

into a system level score. Since there is no redundancy in place in this revision, the failure rates

will add up at the system level. While the overall product is safe, there is a possibility of injury

inherent with moving objects, and this will be defined as Critical in the FMECA. The Critical

failure effect is collision, and this could happen with a few failure modes, specifically of the

motors or the IR detection circuitry. Any other failure mode is non-critical, leading to the overall

safety of the shopping cart system.

Reliability analysis

The following high-failure rate or critical components were selected – Microcontroller

Atmel ATMega32L, Linear power regulator chip – Max 663, Power MOSFET – IRL530N.

-xiii-

Page 14: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

These are parts that would operate at higher temperatures (IRL530N, Max663), or are critical to

system availability (ATMega32L). Reliability calculations for these components follow:

1. Microcontroller – ATMega32L

λP = [C1 * ПT + C2 * ПE] * ПQ * ПL [8]

where:

C1 – die complexity (8 – bit) = 0.14

ПT – temperature coefficient (T < 100oC ) = 1.5

C2 – Pin constant (40 pins) = 0.019.

ПE – Environmental Constant (Ground Mobile) = 4.0

ПQ – Quality Factor (Commercial, Unknown screening) = 10.

ПL – Life Constant (In production for about a year) = 1.5

Thus:

λP = [0.14 * 1.5 + 0.019 * 4] * 10 * 1.5

λP = 4.29 failures per 10 6

MTTF = 1/ λP

MTTF = 2.331E5 hours

2. Linear Power Regulator Chip – Max663

λP = [C1 * ПT + C2 * ПE] * ПQ * ПL [8]

where:

C1 – die complexity (linear CMOS, 101 – 300 transistors) = 0.020

ПT – temperature coefficient (T < 100oC ) = 16

C2 – Pin constant (8 pins) = 0.0034

ПE – Environmental Constant (Ground Mobile) = 4.0

ПQ – Quality Factor (Commercial, Unknown screening) = 10.

ПL – Life Constant (In production for 2 years at least) = 1

Thus:

λP = [0.020 * 16 + 0.0034 * 4] * 10 * 1

λP = 3.336 failures per 10 6 hours

MTTF = 1/ λP

MTTF = 2.998E5 hours

-xiv-

Page 15: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

3. Power MOSFET – IRL530N

λP = [λB * ПT * ПA * ПQ * ПE ] [9]

where:

λB – Base failure rate (MOSFET) = 0.012

ПT – temperature coefficient (T < 100oC ) = 3.7

ПA – Application Factor (Switching FET) = 1.5

ПE – Environmental Constant (Ground Mobile) = 9.0

ПQ – Quality Factor (Plastic DIP) = 8.

Thus:

λP = [0.012 * 3.7 * 1.5 * 8 * 9]

λP = 4.7952 failures per 10 6 hours

MTTF = 1/ λP

MTTF = 2.085E5 hours

These analyzed parts have λP not in the 1E-9 range, but in the 1E-6 region. This is three

orders of magnitude higher than the “never” region, and is significant. A major factor in this

unreliability is the assumed temperature maximum of 100oC. This is a very conservative

approximation, and decreasing this by ventilation and heat-sinks would increase the reliability by

at least an order of magnitude. Making the manufacturer run burn-in tests on the parts and tests

from group 1 [10] of the screen/tests would help increase reliability again by around an order of

magnitude, bringing failure rates to 1E-8.

FMECA

The circuit is divided into 5 major blocks for consideration for the FMECA. These are – A

Ultrasonic Transmitter B. Ultrasonic Receiver C. Obstacle Detection IR D. Motor Drive

Circuitry E. Power Circuitry. There are two levels of criticality – Non-critical, which will not

lead to injury, and Critical – which could potentially lead to personal injury. The non-critical

level needs to have a failure rate of at least <1E-7 while the critical path needs at least <1E-9.

Each of these blocks has failure modes associated with them, leading to the FMECA

attached in Appendix H. The critical failure paths involve the motors and IR obstacle avoidance,

-xv-

Page 16: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

as well as the microcontroller that controls the motors. If any of these components fail, and get

stuck in a state that forces the motors running, there is a possibly for collision which is defined as

Critical.

6.0 Ethical and Environmental Impact Analysis

I. Ethical Impact Analysis

From an ethical point of view, safety and reliability must be ensured. Infra Red proximity

detectors are used to implement an obstacle avoidance system. This will ensure that the cart does

not collide into shoppers, aisles or other carts. The motors will be set so as to move at a about the

same speed as an average person. The cart will also be tested under different loading conditions.

It is imperative that only the beacon can control the cart. Tests where errors are introduced in the

signals will be done to ensure that the cart is not affected by other signals that may be floating

around. All major components will be covered using plastic sheeting. A warning sticker will be

placed on the cart to make users aware. Also, users will be cautioned in the user manual. Another

key consideration was to ensure safety of children in the supermarket. The U.S Consumer

Product Safety Commission (CPSC) [11] regulates that certain special rules be followed for

shopping carts used in the presence of children. These rules will be mentioned in the user

manual. A warning label will be placed on the cart as required by the CPSC. An example of the

warning is shown below in Fig. 6.1

Fig. 6.1 – Warning label that will be placed on cart.

The battery pack on the cart must be sufficiently charged so that a shopper can complete his/her

entire shopping. Proper documentation on the battery types and sufficient charging will be

-xvi-

Page 17: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

mentioned in the user documentation. As liquids can be placed in the cart, there exists a chance

of liquids spilling. All electrical components will be covered using water proof plastic sheeting.

However, there will still be sufficient instructions on how to handle a spillage in the user manual.

III. Environmental Impact Analysis

From an environmental point of view, three stages of the carts life cycle have to be considered.

1. Manufacture

The PCB boards used require an extensive amount of soldering involving lead. This lead is

accumulates in living tissue and is considered harmful for humans. After much research, it was

found that lead free soldering does exist but was not found to be feasible due to high costs and

high temperatures required that might damage components on the board [13]. Manufacturing of

semiconductors pose a serious threat to the environment. Anywhere from 500 to 1000 chemicals

are used in the process to make semiconductor chips. Strong acids are used to etch the surface of

metals [12]. Proper disposal of these wastes is an expensive process. However, strict government

regulations in most countries now enforce these disposal techniques. The plastic sheeting used as

casing was chosen in such a way that it was completely recyclable.

ii. Normal Use

In supermarkets all over the world today, shoppers push their shopping carts themselves. As a

result of launching this product, this energy that was supplied by humans will now be replaced

with electrical energy supplied by battery packs. The cart has been designed to ensure the most

efficient use of power as possible. Electricity is a precious resource however, this is the price one

pays for comfort.

iii. Disposal/Recycling [14]

Disposal of the cart can be made an environmentally friendly process by insisting on recycling.

Places and methods of recycling will be mentioned in the user manual. Battery disposal is an

environmentally unfriendly process. To minimize the effect on the environment, the cart shall

work on rechargeable NiCd batteries which can be recharged upto 1000 times and can be

disposed off safely.

-xvii-

Page 18: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

7.0 Packaging Design Considerations

A comparison between the cart and two other products is summarized below:

LB2 (by Antonio Garcia)

The LB2 is a very simply packaged four wheel robot. While analyzing its packaging

design, it was noticed that much of the ugly circuitry is hidden inside its body. Its IR sensors are

mounted on top of the box to avoid interference from other parts. The robot has four wheels for

maximum stability and is covered with plastic for protection. On the other hand, the fact that a

CD-ROM box is used as a body emits a very unprofessional look. A certain amount of wiring

can still be seen on top and could pose a possible danger. The circuitry mounted above the box is

still unprotected from the sides. An opaque sheet of plastic would give a much cleaner look.

Pride Jazzy 1113 Power Wheelchair

The Pride Jazzy 1113 Power Wheelchair is a front wheel motorized wheelchair which is

commercially available on the market. Upon further analysis of its packaging design, it was

noticed that the product is very neatly packaged. No circuitry is visible at all. The four wheels

ensure stability offering excellent maneuverability due to a front wheel drive and pivoted back

wheels. The circuitry in the wheel chair seems to be very well protected.

On the other hand, having extra cushioning on seat and a pair of extra wheels makes the chair

very bulky and since all electrical and mechanical circuitry is hidden inside, it is very difficult to

make any electrical or mechanical changes.

Similarities

Four wheels will be used to provide extra stability.

A front wheel drive will be implemented with the back to wheels pivoted to allow better

maneuverability

Almost all mechanical and electrical circuitry will be hidden.

Motors and batteries will be kept as close to wheels as possible to avoid long wires.

Plastic sheets will be used to cover circuitry so as to provide a neat and professional look.

-xviii-

Page 19: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Specifications

A picture of the final product with all packaging work completed can be seen in figure.

B.1. The dimensions of the cart can be viewed in detail in the diagram in figure B.3.

From above analysis, the following packaging design was implemented. The main purpose of the

cart is to allow shoppers to place their items in the cart. Thus, the packaging of the circuitry was

designed so as to maximize storage space in the cart. The main circuit board and the smaller

ultrasonic receiver boards are all placed outside of the storage area. The main board is mounted

on the bottom tray of the cart whereas the receiver boards are mounted on to the front two upper

corners. All circuitry is hidden by placing the boards inside protective plastic sheeting. This

plastic sheeting also offers protection from liquid/moisture, and tampering. The motors have

been mounted underneath the cart with a front wheel drive implemented by directly pressing

them onto the motor shaft. Two inch diameter rubber wheels were used as they offered to

sufficient torque. Two castor wheels were used as back wheels to allow better turning.

Material List

Material Purpose

Plastic sheets Box to hold the circuit. One box to hold

circuit on shopping cart. One smaller box

which will hold the beacon circuit.

Screws Securely Mount the circuit board to the

box and to mount the box onto the trolley.

Aluminum Cart Main structure that will be moved. Also

the structure on which the plastic box will

be mounted on. The dimensions of the

cart can be seen in the CAD drawing.

Felt material To make a wrist strap which will hold the

beacon on it.

Table 7.1 – Table identifying materials which will be used to build the shopping cart.

-xix-

Page 20: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Tooling Requirements

To build the cart, a number of tools will be required. The original wheels on the cart are

not sufficient and thus will have to be cut of from the pivot and replaced by better wheels. To do

this, some heavy duty tools able to cut through metal will be needed. A metal saw in the EE

workshop will be used to do this. Another vital tool will be a soldering iron, as much of the

mounting will be done using a soldering iron. Besides this the average tool set with a wire

stripper, number of screws, washers and screw drivers will be sufficient.

IV. Packaging Weight And Unit Cost

Part Quantity Unit Cost ($) Weight (Kg)

Atmel ATMega32L Microcontroller1 8.17 0.100

Sharp GP2D15 Sensor, w/connector3 8.25 0.100

Ultrasonic transducers 1 6.95 0.050

Aluminum Cart 1 18.00 1.750

Plastic Project Boxes (various sizes) 5 3.91 0.200

8.0 Schematic Design Considerations

Theory of Operation

The project consists of two major parts, namely, the main board on the shopping cart and

the wrist-worn beacon device. The main board consists of circuitry to receive data from the

various sensors, analyze them, and direct further action. The ultrasonic receiver circuitries,

housed on separate boards to reduce noise, receive the signal and amplify it. These make up two

-xx-

Page 21: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

additional boards that are connected to the main board via headers. The Atmel ATMega32L

receives this amplified voltage input from the ultrasonic receivers and also input from the

Infrared obstacle sensors. Based on this information, the micro-controller controls the motors

through its PWM ports, adjusting the duty cycle to cause the cart to move in the desired

direction.

The wrist-worn beacon device has an ultrasonic transmitter controlled by a 555 timer to

output a 40 kilohertz signal. The major components of the project are listed below in greater

detail.

Atmel ATMega32L Microcontroller

The micro-controller is run at 1MHz and is run off a 3.3V power rail [15] to reduce

power consumption. At this speed, it draws 1.1mA of current (25oC) [15] which is relatively low

enough. The micro-controller has to receive the 40kilohertz wave into the A/D converter and

convert it, which takes an average of 13 ADC clock cycles [15]. The reference voltage for this is

supplied by the supply voltage to the chip after a fall over a small resistance (as the reference

voltage has to be lower than the chip supply voltage) [15]. The system is battery powered and

needs to be as power efficient as possible.

The micro-controller controls the motors via the two PWM ports. The PWM ports are

connected to an IRL530 power MOSFET that acts as a switch in the motor circuit. The MOSFET

is a voltage controlled device and does not draw a lot of current. The two infrared sensors are

connected to the two external interrupt ports of the micro-controller. This allows for the micro-

controller to not only stop at obstacles but also navigate around obstacles based on the sensor

generating the interrupt. Also, the ATMega32L supports on-chip programming and debugging.

These ports allow for programming them without the need for a 12V external voltage.

Maxim MAX663 Linear Voltage Regulator

The Maxim MAX663 linear voltage regulator is used to supply the +6 volt rail to the

ultrasonic amplifier circuitry. It is also used to supply a steady +6 volts to the timer and the

transmitter on the ultrasonic beacon. The chip can receive a wide range of input voltages from 2

to 16.5volts [16]. This allows for greater design flexibility.

-xxi-

Page 22: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

On the main board, the current draw requirement for the +6V supply is a maximum of

40mA when both the receiver boards are drawing maximum power. The typical draw is around

14mA. The chip can supply more than the required current when current limiting is turned off.

The current draw on the transmitter board is around 2mA. Using of a power chip ensures that the

transmitted signal has a steady strength, allowing for better distance approximation.

Maxim MAX764 Linear Voltage Regulator

The Maxim MAX764 linear voltage regulator is used to supply the -6 volt rail to the

ultrasonic amplifier circuitry. The chip can receive a wide range of input voltages from 3 to

16volts [17]. This allows for greater design flexibility. The current draw requirement for the -6V

supply is a maximum of 10mA when both the receiver boards are drawing maximum power. The

typical draw is around 4mA. The chip can supply up to 50mA [17].

Maxim MAX1626 DC-DC Step-Down Voltage Controller

The Maxim MAX1626 DC-DC step-down power supply is used to supply the 3.3 [18]

volt rail to the main board. The chip can receive a wide range of input voltages up to 16volts

[18]. This allows for greater design flexibility. The chip supplies power to the IR sensors and the

main Atmel ATMega32L. It also supplies the ATD reference voltage. The current draw of all

these parts is a maximum of 400mA and a typical draw of around 130mA. The MAX1626 can

supply up to 3A. [18]

Sharp GP2D15 IR Sensor

The Sharp GP2D15 IR sensor provides a logical high if it detects an object closer than 24

cm and a logical low otherwise [19]. This can be used as an interrupt to the micro-controller.

Two of these sensors will be placed at the two front facing corners of the cart. If only one of the

two sensors triggers an interrupt, the cart can take action and move away or around the obstacle.

These infrared sensors are operated on a VCC of 6V @ 25oC. The interrupt pins are active low

[15] and need an inverter to be able to receive the interrupts from the sensors.

Polaroid “L” Series Ultrasonic Transmitters and Receivers

-xxii-

Page 23: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

The Polaroid “L” series ultrasonic transmitters and receivers operate at a center frequency

of 40 KHz +/- 1 KHz [20]. They have a bandwidth of around 2.5-3 KHz where they provide the

best results. This frequency of 40 KHz is ideal with respect to power and range requirements.

Initial testing revealed an approximate range of around 4-5 feet. The small beam angle of around

72o allows for better directional sensitivity [20]. These transmitters and receivers are also pretty

tolerant with respect to temperature. They require a voltage of around 9V to provide sufficient

range.

Jameco Geared DC Motor

The Jameco geared DC motor (part # 253446) has a pretty wide input voltage range of

4.5 – 12 volts [21]. It has a no load speed of 720 rpm, a gearing ratio of 10:1 and a stall torque of

0.35Kg-cm [21]. With these specs, it should be able to draw the cart at sufficient speed of around

3mph without too much of a problem. It also has a no load current draw of 62mA. This is a

pretty large current draw but is small for a motor of this size.

IC555 Timer Chip

The IC555 timer chip is a robust timer chip. It has a maximum speed of around 1 MHZ

and can be adjusted for much lower speeds, keeping track of as low as a few seconds [22]. In our

circuit, it is used as a timer to supply a 40 KHz clock to the ultrasonic transmitter.

LF353 Operational Amplifier

The LF353 op-amp was used to amplify the signal received by the ultrasonic receiver. It

was also used in a rectifying circuit in order to have a DC output from the receiver. The op-amp

had a high Gain Bandwidth Product of 4 MHz [23] to allow for greater gain and a high slew rate

of 13 V/μS [23] allowing the usage of high frequency signals like the 40 kHz ultrasonic signal.

74LVT04 Hex Inverter

The 74LVT04 hex inverter was used to invert the output of the IR sensors to allow the

Atmel ATMega32L detect the interrupts. The 74LVT04 was an ideal choice due to its low

current consumption of only 1.5mA [24] and also its 3.3 V rail usage [24].

-xxiii-

Page 24: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

9.0 PCB Layout Design Considerations

We need to have a means of generation of the ultrasonic signal, and boards for reception

and decoding of said signal. We decided to make a transmitter that fits on the user’s hand, and is

self-contained. We also discovered, through experimentation and consultation with the course

staff, that we should have the amplifier circuitry for the ultrasonic receiver as close to the

transducers as possible, to better eliminate noise. Thus we need 5 boards – 1 for the ultrasonic

transmitter, 3 for the ultrasonic receivers, and 1 main board. We also need to be able to follow

the user, and in doing so, need to drive motors. To do this we have a PWM signal driving a

power MOSFET, to allow for sufficient current that sources current directly from the batteries.

PCB Layout Design Considerations

The layout suffered from a couple of problems, but also had a lot of opportunity for

success. One immediate problem that arose is the large number of boards that we are using. With

5 boards and a limited budget, there had to be some careful planning done to be successful.

Firstly, all the circuits were isolated on the schematic, and connected via headers. This included

naming of the power and ground nets for each sub-circuit independently. Thus, the sub-circuit

itself does not know that it is connected to anything else. Also, we decided that power, supplied

by the batteries, will be connected via a header to a battery pack, for both the main board, as well

as the stand-alone transmitter. We did the same for switches in the transmitter circuitry, replacing

them with headers. Thus, the board can be completely enclosed, with only the transducer, and

control switches being displayed.

With all these fixes in place, routing the board involved routing each individual sub-

circuit. We performed the layout so as to fit on a 60 sq inch board, with space to allow for

cutting, and subsequent separation of the boards. The ultrasonic circuits were laid out on the left

of the board, with the Transmitter circuitry in the center and the main board on the right. Due to

the modular nature of the schematic, the layout was relatively straightforward.

During the layout, we followed several general principles, as gleaned from the Motorola

document [25]. For example, we used as wide and short traces as possible, to reduce the

inductance of the traces, reducing current spikes and noise. To allow for maximum current, we

mostly used 50mil traces on the power and ground connections. We also used 20mil traces

-xxiv-

Page 25: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

wherever possible, instead of 12, for the purpose of reducing inductive noise. We also did not

use 90o angles in our traces, to minimize wave reflections which lead to noise and radiation [25],

[26]. To reduce interference from one part of the circuit to another, we linked individual power

and ground in parallel to their components, and avoided series chains of connections through

multiple components. Now, we knew that the ultrasonic amplification circuitry is susceptible to

noise, and to minimize that, we put noise suppression capacitors across power and ground to

short out high frequency noise, and let smooth DC voltages through. Similarly, bypass capacitors

were put as close to the Atmel32 pins as possible, providing a short pathway for current spikes.

Thus, power (VCC33) and ground (GND) were brought to the microcontroller, to facilitate this,

making sure that the traces were directly from the sources, and not through other components.

Lastly, to reduce noise, and help dissipate heat, we used a copper pour on the Ultrasonic

receivers, and on the main board. We decided however, against doing the same on the

transmitter, where we do not anticipate noise or heat to be a problem.

Documentation

Please see the following documents in the noted appendices:

C. Orcad Schematic.

D. Top board layer (copper only)

D. Bottom board layer (copper only)

E. Parts List Spreadsheet

10.0 Software Design Considerations

Memory Models

An Atmel ATMega32L microcontroller is used to operate the cart. This device is

equipped with 32Kb of flash memory (program space) and 2Kb of SRAM for supporting run-

time data and a program stack. This amount of storage space is sufficient to meet the modest

requirements of the project, while leaving ample room for future expansion. The ATMega32L

also provides 1Kb of EEPROM. However, the project does not utilize non-volatile data and thus

does not make use of this space.

-xxv-

Page 26: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Memory Sections and Mapping

The ATMega32L’s physical memory space is divided into three smaller memory spaces

that are all linear and regular. These are:

Data Memory Space: The data memory space is used to store and access all run-time data. The

lowest 32 addresses of the data memory space access the register file that comprises 32 general

purpose registers. These are typically used to hold values of operands and the results of

intermediate operations while executing instructions. The next 64 addresses are the memory-

mapped I/O ports and peripheral registers (also known as the I/O space). The remainder of the

data memory space accesses the internal SRAM which is used to store volatile variables and the

program stack.

Figure 10.1 - Data Memory Space Mapping

Program Memory Space: The program memory space (flash memory) holds the application

code and other read-only data. The 32Kb of flash memory is word-addressable i.e. it is organized

as 16k x 16. The program memory space is further divided into an application flash section and a

-xxvi-

Page 27: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

boot loader flash section. While the former contains the software to operate the microcontroller,

the latter section houses boot loader code that can be used to automatically upgrade the firmware.

Figure 10.2 - Program Memory Space Mapping

EEPROM Memory Space: The ATMega32L also contains a 1Kb, byte-addressable EEPROM

memory space to hold non-volatile data. Due to the nature of the project, this space is not used

by the design.

All of the software development was done in C and compiled using the CodeVision C

Compiler for Atmel AVR. As a result, the programmer was released from the burden of

organizing the code neatly in memory and ensuring the correct memory mappings. Further

details about the memory organization of the microcontroller may be found in the ATMega32L

datasheet [15].

Startup Code

The startup code has some important duties to fulfill including:

Initializing the stack pointer

Allocating space for global variables

-xxvii-

Page 28: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Copying the value of initialized variables to the appropriate memory locations in the data

section

Jumping to main()

Initializing all on-board peripherals as per project needs

Once again, thanks to the CodeVision Wizard that automatically generated startup code, the

programmer was freed from the burden of having to write it.

Organization of Embedded Application Code

The software reads the ultrasonic and infrared sensors and adjusts the speeds of the

motors driving the cart appropriately. The infrared sensors produce a digital output signal that

can be read instantly. The ultrasonic sensors on the other hand output an analog voltage value

that is converted to a digital value by the microcontroller’s A-D unit. The algorithm to adjust the

motor speeds varies the duty cycles of the PWM output signals. The application code is

organized in a command-driven fashion i.e. as a combination of program-driven and interrupt-

driven modules. The infrared sensors generate external interrupt requests when they are tripped.

One of the on-board timer modules is used to generate a periodic interrupt. The A-D inputs are

polled when servicing this interrupt request. The main loop of the program uses the current and

past voltage samples read by the A-D unit to adjust the PWM duty cycles appropriately.

Software Design Narrative

Function Signature: void main(void);

Return Value: None

Parameters: None

Description: This function is the entry point of the program. Its first act is to initialize all the on-

board peripherals via a call to initPeripherals(). It then sets the global interrupt enable bit before

entering the main loop which implements the motor speed control algorithm. This algorithm

(refer to flowchart in Fig.10.3) adjusts the duty cycles of the drive motors in an attempt to make

the ultrasonic voltage readings converge to an equilibrium value (set at 3.3V). If the cart is

executing a turn (the difference between the two motor speeds is too large), to ensure that the

turn is smooth and the cart does not overcompensate, the larger motor speed is capped at a

-xxviii-

Page 29: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

maximum value. If at any point, the voltage read on both ultrasonic receivers drops so low that it

is indistinguishable from noise (the zero cutoff voltage), it is assumed that either the beacon has

been switched off or is out of range. In this event, both motors are switched off.

Function Signature: void initPeripherals(void);

Return Value: None

Parameters: None

Description: This procedure initializes the microcontroller peripherals and I/O ports as shown in

the following table:

Table 10.1 - Peripheral / Port Initialization Settings

Peripheral / Port Register Settings Purpose

Port A PORTA = 0x00DDRA = 0x00

Port A configured as an input port. Pins PA0, PA1 and PA2 are the inputs to

the A-D unit

Port B PORTB = 0x00DDRB = 0x08

All port B pins other than PB3 are configured as inputs. PB3 outputs the PWM signal for the left

drive motor

Port C PORTC = 0x00DDRC = 0x00

Port C is unused and configured as an input port

Port D PORTD = 0x00DDRD = 0x80

All port D pins other than PD7 are configured as inputs. PD7 outputs the

PWM signal for the right motor. PD2 and PD3 are the external interrupt pins wired to the left and right infrared

sensors respectively

Timer 0 TCCR0=0x61; TCNT0=0x00; OCR0=0xff;

Timer 0 is configured to generate a PWM signal with variable duty cycle for the

left drive motor

-xxix-

Page 30: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Peripheral / Port Register Settings Purpose

Timer 1

TCCR1A=0x00; TCCR1B=0x01; TCNT1H=0x00; TCNT1L=0x00; ICR1H=0x00; ICR1L=0x00;

OCR1AH=0x01; OCR1AL=0xF4; OCR1BH=0x00; OCR1BL=0x00;

Timer 1 is configured to generate a periodic interrupt

every 0.5ms

Timer 2

ASSR=0x00; TCCR2=0x61; TCNT2=0x00; OCR2=0xff;

Timer 2 is configured to generate a PWM signal with variable duty cycle for the

right drive motor

External Interrupts

GICR=0xC0; MCUCR=0x00;

MCUCSR=0x00; GIFR=0xC0;

External interrupts 0 and 1 are enabled to generate requests when the pins

INT0 and INT1 are pulled low

A-D Unit ADMUX=0x60; ADCSRA=0x83; SFIOR&=0xEF;

The A-D unit is configured to use the AVCC pin as the voltage reference and return the result of the conversion

as an 8-bit value

This initialization code was automatically generated by the CodeVision Wizard.

Function Signature: void leftInfraredISR(void);

Return Value: None

Parameters: None

Description: This is the interrupt service routine for the INT0 pin that is wired to the infrared

sensor mounted on the front left end of the cart. When the sensor is tripped and the ISR executed,

the right motor (the one opposite the tripped sensor) is turned off. Based on the strength of the

signal being received by the right ultrasonic receiver, the speed of left motor alone is adjusted.

This causes the cart to swivel about its right wheel, steering away from the obstacle. Lastly, the

routine clears the periodic timer interrupt flag. This implements a hierarchical servicing of

interrupts that gives priority to obstacle avoidance over shopper tracking, thus eliminating

conflicts.

-xxx-

Page 31: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Function Signature: void rightInfraredISR(void);

Return Value: None

Parameters: None

Description: This is the interrupt service routine for the INT1 pin that is wired to the infrared

sensor mounted on the front right end of the cart. It implements the same algorithm as the

function leftInfraredISR(), except the effects on the left and right drive motors are swapped.

Function Signature: void pollAD(void);

Return Value: None

Parameters: None

Description: This routine services the periodic interrupts generated by timer 1. The ultrasonic

receivers mounted on the front end of the carts are polled and the voltage values read are stored

in global variables, to be read by the main loop.

Function Signature: unsigned char readAd(unsigned char adcInput);

Return Value: The converted value of the analog voltage

Parameters: The channel to convert

Description: This automatically generated code segment converts the analog voltage input on

the specified channel into a digital 8-bit value which is returned.

Function Signature: unsigned char getMotorSpeed(unsigned char voltage);

Return Value: The appropriate duty cycle setting for the given voltage

Parameters: The voltage value read on the appropriate ultrasonic sensor

Description: This function maps the input voltage value to a motor speed using the formula:

Duty Cycle = (255 – voltage) * 1.5.

This formula enforces an inverse relation between the voltage reading and the motor speed – the

closer the shopper (higher the sampled voltage), the slower the cart. If the voltage reading is

below the zero cutoff voltage, the motor is switched off altogether.

Please refer to Appendix F for the code listing.

-xxxi-

Page 32: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

-xxxii-

Start

Initialize on-board peripherals

Enable global interrupts

Read the last sampled left and right voltages

Is either left or right voltage non-zero?

Calculate new duty cycle for each motor independently using formula: Duty cycle = (255 – Voltage) * 1.5

Smooth motor speeds if turning and update PWM duty cycles

Y

N

Turn off both motors

Flowcharts

Figure 10.3 – Main Loop Flowchart

Note: Interrupt requests are not explicitly mentioned in the flowchart and may affect program flow. Once the interrupt has been serviced, control is restored to the point from where the jump was made.

Page 33: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

11.0 Version 2 Changes

The following is a short list of enhancements that we would like to implement over the

course of a second design iteration:

Better control algorithm. Despite attempts to smooth the turning of the cart, it still has a

tendency to overcompensate on turns. The cart also has difficulty following the user in a

straight line – rather, it continuously sweeps from side to side. A more sophisticated

algorithm could be used to remedy these problems.

Better noise immunity for ultrasonic sensors and increased beacon range. Currently, the

zero cutoff voltage is rather high with the result that the ultrasonic sensors lose a lot of

resolution. Also, there is a fair amount of jitter on the sensor output that affects cart

performance. Better noise filters would greatly improve the cart’s tracking ability and

increase the range of the beacon.

Ability to send different instructions via the beacon. In particular, we would like to

empower the shopper with the ability to summon the cart closer for loading/unloading

purposes. One possible way to implement this functionality would be to apply a square

wave filter to the transmitter output and in this way, encode instructions from the user.

Support for multiple carts. The target application demands that multiple carts be able to

co-exist in a system without conflicts. This would once again require an encoding

scheme, with possibly unique IDs assigned to individual carts. These ID tags would then

form a part of the signal transmitted by the beacon and be used to distinguish one shopper

from another.

Additional sensors. Currently the cart is incapable of detecting a user standing directly

behind it. This can easily be remedied by mounting an additional ultrasonic receiver on

the rear end of the cart (and modifying the control algorithm appropriately). The cart also

has difficulty avoiding obstacles when it approaches them head-on. This problem can be

addressed by adding an additional proximity sensor right at the head of the cart.

12.0 Summary and Conclusions

The successful culmination of this project is no accident. A lot of hard work, inspiration,

sweat, tears and luck came together to make this a reality. A long term project cannot be

-xxxiii-

Page 34: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

successful if every team member is not fully engaged. We learned early on that effective

communication is a must, as well as effective time management. More importantly we learned

that failures are only stepping stones to success, and perseverance pays off in the long run. A

great idea can only go so far, without the right team to back it up, and thus we learned to work

well together, and to trust in our teammates abilities. Overall then, this has been one of the best

classes to date, a chance to apply all that we have learnt thus far to the fullest, and to stretch

ourselves to the fullest.

13.0 References

[1] Atmel Corporation, AVR ATMega32/ATMega32L Microcontroller Datasheethttp://www.atmel.com/dyn/resources/prod_documents/doc2503.pdf[2] Sharp Corporation, Sharp GP2D12/GP2D15 Infrared Proximity Sensor Datasheethttp://www.junun.org/MarkIII/datasheets/GP2D12_15.pdf[3] Schematics Depot, Ultrasonic Transmitter / Receiver Schematicshttp://www.reconnsworld.com/ir_ultrasonic_ultraswitch.html[4] Lattice Semiconductor Corporation, PALCE16V8 Datasheethttp://www.vantis.com/lit/docs/datasheets/pal_gal/p16v8.pdf[5] Freescale Semiconductor, MC9S08GT32 Microcontroller Datasheethttp://www.freescale.com/files/microcontrollers/doc/data_sheet/MC9S08GB60.pdf[6] www.uspto.gov (US patents and trademarks office)[7] http://www.southcom.com.au/~robot/index.html (Denning Branch International, Robot manufacturer and assignee of patent nos. 4,751,658 and 4,710,020)[8] MIL-HDBK-217F – Section 5.1, Microcontrollers and CMOS logic[9] MIL-HDBK-217F – Section 6.4, Transistors SI FET[10] MIL-HDBK-217F – Section 5.10, Testing/Screening.[11] http://www.cpsc.gov/cpscpub/pubs/5075.html - Consumer Product Safety Commission. Falls from Shopping Carts Cause Head Injuries to Children[12] http://www.faultline.org/place/2002/04/toxictech.html - Semiconductor Etching process[13] http://www.drgreene.com/21_291.html - Lead Poisoning[14] http://www.plugintorecycling.org - Plug into Recycling[15] Atmel ATMega32L datasheet: http://www.atmel.com/dyn/resources/prod_documents/doc2503.pdf[16] Maxim MAX663 Linear Voltage Regulator http://shay.ecn.purdue.edu/~477grp8/docs/datasheets/MAX663-MAX666.pdf[17] Maxim MAX764 Linear Voltage Regulator http://shay.ecn.purdue.edu/~477grp8/docs/datasheets/MAX764.pdf[18] Maxim MAX1626 DC-DC Step-Down converter http://shay.ecn.purdue.edu/~477grp8/docs/datasheets/MAX1626.pdf[19] Sharp GP2D15 infrared sensor datasheet: http://shay.ecn.purdue.edu/~477grp8/docs/datasheets/GP2D15.pdf[20] Polaroid “L” series ultrasonic transmitters and receivers datasheet: http://shay.ecn.purdue.edu/~477grp8/docs/datasheets/lseries.pdf

-xxxiv-

Page 35: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

[21] Jameco Geared DC motor datasheet: http://shay.ecn.purdue.edu/~477grp8/docs/datasheets/253446DC Motors used.pdf[22] The IC7555 timer chip datasheet: http://shay.ecn.purdue.edu/~477grp8/docs/datasheets/ICM7555timer.pdf[23] LF353 Operational Amplifier http://shay.ecn.purdue.edu/~477grp8/docs/datasheets/LF353.pdf[24] 74LVT04 Hex Inverter http://shay.ecn.purdue.edu/~477grp8/docs/datasheets/74LVT04.pdf[25] Motorola App Note AN1259 http://shay.ecn.purdue.edu/~dsml/ece477/Homework/Fall2004/AN1259.pdf [26] ECE311 Textbook and Notes

Field and Wave electromagnetics by Cheng. [27] Jameco and Digikey for footprints and component selection

www.jameco.com , www.digikey.com[28] Discover Circuits website

www.discovercircuits.com

-xxxv-

Page 36: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Appendix A: Individual Contributions

Contributions of Mohan Rokkam

I believe that teamwork is essential for the successful completion of a project of this nature. I

took my role in the team very seriously and worked towards greater teamwork and team unity. I

took it upon myself to remain up to date with each team member’s progress and also to

understand the nature of the progress. I also acted as the devil’s advocate where required, and

also advised and worked with the other team members in debugging or design of the sections that

they were working on. Some of my major contributions were:

I worked on the Schematic homework and designed all the parts of the circuit excluding

the ultrasonic circuitry.

I calculated power requirements and determined the power chips to be used.

I also identified many of the smaller parts on the board.

I also worked with Clive in the debugging and redesign of the ultrasonic circuitry.

I helped Clive with the Layout of the board design.

I did a majority of the soldering for the entire project, and made headers to allow for

easy portability and programming of the main board.

I identified and determined the ISP programming headers and built an easy to use

programming header.

I was the webmaster for the team and designed a common template for the team website

and the team notebooks.

I worked on the Patent Liability homework with some help from Clive.

I worked on the final packaging of the cart, especially the packaging of the main board

onto the cart.

I also identified and located the wheels and motors to be used for the cart.

I also worked on the final testing of the cart and was involved in the shooting and

editing of the videos.

Designed poster for team.

Given my extensive contributions to the team and the successful demonstration of all of our

project success criteria, I believe that I should be awarded an ‘A’ for this course.

- 1 -

Page 37: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Contributions of Clive Lopez:

My contributions have been manifold in this design project, and I have become an

indispensable part of the team. Coming from a EE background, I was afraid that I would have

nothing to offer in a Computer Engineering project. However as it turns out, our project fell

somewhere in between, an eclectic mix of hardware and software, that allowed everyone to have

their fair share of the work. The following are my contributions to the team:

I was in charge of the Ultrasonic transmitter and receiver circuitry. I looked up the initial

circuitry, built and tested it, discarded it, redesigned it from scratch repeatedly, and

debugged it when it wouldn’t perform as intended. This was the most troublesome and

fickle part of the entire system, and took almost the whole semester to get working. With

help from the others, I finally got the ultrasonics working

I did the Reliability analysis on major components on the cart, as well as the FMECA of

the 5 sub-systems in our project

I did the board Layout, and associated write-up.

I did soldering of the transmitter and one receiver, and helped Mohan out in soldering

some other parts

I helped develop the control logic, and timing constraints that were needed in our initial

design of overlaying a 200 Hz square wave filter on the 40 kHz to turn it on and off. I

helped debug the code, helping Raghu find the error (AND instead of OR) that allowed

the motor control to work

I did the cutting of the ultrasonic boards to fit into the project boxes for the final

packaging

Provided use of my car for trips to purchase necessary items

Purchased the cart from EBay

Based on my contributions to the team, as well our fulfillment of all the design success criteria, I

think that I deserve an ‘A’ grade in this class.

- 2 -

Page 38: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Contributions of Raghuram Ramanujan

The following is a brief overview of my personal contribution to the design and testing effort:

Performed the constraint analysis and selected the microcontroller that would be best

suited to the needs of our project

Helped with component selection - shopped for infrared proximity sensors, ultrasonic

transducers, motors, wheels, batteries, the cart chassis and other miscellaneous circuit

components

Played around with the STK500 Atmel evaluation board and determined how to develop

software for our microcontroller using the CodeVision C Compiler

Learnt how the microcontroller’s on-board peripherals (timer, A/D converter, PWM,

external interrupts) worked by tinkering with the STK500 board - wrote some diagnostic

programs for this purpose

Helped determine how to interface the sensors and the motor to the microcontroller

Helped Clive debug the ultrasonic transmitter – in particular, fixed the 50% duty cycle

problem with Mohan’s assistance

Helped refine the ultrasonic sensors’ envelope detection and wave rectification circuitry

Determined the procedure for performing in-circuit programming of our microcontroller

with Mohan’s help

Developed and debugged the steering algorithm for the cart

Helped with component integration and hardware debugging of completed design

Helped develop the presentations for the end of semester evaluation and the ECE270

class demonstration

Given the significance of my contributions to many different areas of the design project, I feel I

deserve an ‘A’ grade for this course.

- 3 -

Page 39: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Contributions of Aliasgar Poonawala:

I believe each of the four team members had an equal share in the success of our project. Each of

us moved on to specialize into one of four fields during the course of the semester. I was

inherently in charge of the entire physical packaging of the cart and thus was called upon when

anything had to be done to the cart. We were quick to do each others work when needed. I

believe teamwork came naturally to this team.

Wrote Ethical and Environmental impact analysis homework.

Wrote Packaging design homework

Designed and implemented packaging for cart using CAD software.

Team leader

In-charge of all physical work on the cart. Ensured that the wheels were cut off and

motors were mounted and wheels pressed onto the motor shaft. Drilled holes in

project boxes and assisted in cutting boards and mounting final packaging onto the

cart.

Went on trips around Lafayette looking for parts.

Wrote diagnostic software code for microcontroller.

Assisted in debugging software.

Soldered parts onto boards.

Assisted in debugging transistor logic using knowledge gained from being ee208 TA.

Consulted previous 477 TA and Mechanical engineering students numerous times for

advice regarding problems with shopping cart.

Kept up team morale.

Helped design poster for team.

Wrote slides for presentations.

Assisted in writing User Manual.

Judging from my individual contributions to the team, the overall success of our work and more

importantly the fact that all five success criteria were met, I strongly believe that I deserve an ‘A’

for the course.

- 4 -

Page 40: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Appendix B: Packaging

Fig B.1 – Front view of the shopping cart Fig B.2 – Side view of the shopping cart

- 36 -Shopping Cart

Top View Side View

Infra Red and Ultra Sonic Sensors

Infra Red and Ultra Sonic Sensors

Circuit Board

11” x 9”

12”

Fig B.3

Page 41: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Appendix C: Schematic

- 37 -

Page 42: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Appendix D: PCB Layout Top and Bottom Copper

Fig D-1 Top Copper

- 37 -

Page 43: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Fig D-2 Bottom Copper

- 37 -

Page 44: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

Appendix E: Parts List Spreadsheet

Item Reference Designator Part Supplier Quantity Unit Cost

Total Cost

1 C4,C1 68uF Capacitor DigiKey 2 0.098 0.1962 C2,C3,C6,C7,C8,C10,C11,C13,C14,C16,C18,C20 0.1uF Capacitor Lab Cabinet 12 0.098 1.1763 C5,C12,C15 1uF Capacitor Lab Cabinet 3 0.098 0.2944 C9 10uF Capacitor Lab Cabinet 1 0.098 0.0985 C19 100nF Capacitor Lab Cabinet 1 0.098 0.0986 C24 0.01uF Capacitor Lab Cabinet 1 0.098 0.0987 C25 680pF Capacitor DigiKey 1 0.098 0.0988 C26 100uF Capacitor Lab Cabinet 1 0.098 0.0989 D1 1N5817 DigiKey 1 0.39 0.3910 D2,D3,D4 1N4148 Lab Cabinet 3 0.07 0.2111 D5,D6,D7 1N5226 DigiKey 3 0.36 1.0812 D9,D8 1N4001 DigiKey 2 0.26 0.5213 F3,F1 0.25A Fuse Block DigiKey 2 2.39 4.7814 F2 500mA Fuse Block DigiKey 1 2.39 2.3915 J3,J5,J10 Receiver Transducer Jameco 3 6.95 20.8516 J20,J23 Infrared Sensor Junun 2 8.25 16.517 J14 SPDT Pushbutton Lab Cabinet 1 1.29 1.2918 J22 SPDT Switch Jameco 1 2.35 2.3519 J17, J21 Motor 1, Motor 2 Jameco 2 18.97 37.9420 J18 GP27A Battery RadioShack 1 3.19 3.1921 J25 Transmitter Transducer Jameco 1 0 022 L1 47uH Inductor DigiKey 1 0.54 0.5423 L2 10uH Inductor DigiKey 1 0.47 0.4724 Q3,Q2 IRL530N/TO ECE Window 2 1.53 3.06

- E2 -

Page 45: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

25 RCL1 0.05k Resistor Lab Cabinet 1 0.088 0.08826 R1,R3,R9,R12,R18,R19,R34 1k Resistor Lab Cabinet 7 0.088 0.61627 R2 600k Resistor Lab Cabinet 1 0.088 0.08828 R4,R13,R20 6.2k Resistor Lab Cabinet 3 0.088 0.26429 R5,R14,R21,R24,R29,R32 15k Resistor Lab Cabinet 6 0.088 0.52830 R6 150k Resistor Lab Cabinet 1 0.088 0.08831 VR1,R7,R8,R16,R17,R22, R23 10k Resistor Lab Cabinet 7 0.088 0.61632 R27,R11 3.62M Resistor Lab Cabinet 2 0.088 0.17633 R28,R15 1M Resistor Lab Cabinet 2 0.088 0.17634 R35 20k Resistor Lab Cabinet 1 0.088 0.08835 U1 MAX764 DigiKey 1 6.1 6.136 U2,U3,U6,U7,U8,U9 LF353 ECE Window 6 0.45 2.737 U4 MAX604 DigiKey 1 4.35 4.3538 U5,U13 MAX663 DigiKey 2 4.64 9.2839 U10 74LVT04/SO DigiKey 1 0.46 0.4640 U11 AtmelMega32L Jameco 1 8.17 8.1741 U16 ICM7555 ECE Window 1 0.25 0.2542 --- Cart Chassis eBay 1 18 1843 --- NiMH Rechargeable Batteries Walmart 1 17 1744 --- Project boxes RadioShack 5 3.91 19.55

Total 186.304

- E2 -

Page 46: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

Appendix F: Software Listing

/*****************************************************This program was produced by theCodeWizardAVR V1.24.3b StandardAutomatic Program Generator© Copyright 1998-2004 Pavel Haiduc, HP InfoTech s.r.l.http://www.hpinfotech.come-mail:[email protected]

Project : The DigijokersVersion :Date : 11/8/2004Author : Raghuram RamanujanCompany : Purdue UniversityComments: ECE 477 Group 8

Chip type : ATmega16Program type : ApplicationClock frequency : 1.000000 MHzMemory model : SmallExternal SRAM size : 0Data Stack size : 256*****************************************************/

#include <mega32.h>

/************************************************************************ * Symbolic constants * TRUE and FALSE are used in Boolean tests * ZERO_THRESHOLD defines the minimum voltage value at which point noise * and a non-existent signal become indistinguishable * ON and OFF define the values which when written to the PWM duty cycle * registers cause the motors to turn on and off respectively************************************************************************/#define ADC_VREF_TYPE 0x60#define TRUE 1#define FALSE 0#define ZERO_THRESHOLD 0x17#define ON 0xFF#define OFF 0x00

/************************************************************************ * Global variables * These two variables hold the last collected voltage samples from the * ultrasonic receivers************************************************************************/unsigned char lastFrontLeftSample = 0;unsigned char lastFrontRightSample = 0;

/************************************************************************ * Function prototypes************************************************************************/

Page 47: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

unsigned char readAD(unsigned char);void initPeripherals(void);unsigned char getMotorSpeed(unsigned char);

/************************************************************************Function Signature: void leftInfraredISR(void);Return Value: NoneParameters: NoneDescription:

This is the interrupt service routine for the INT0 external interruptpin i.e the left IR sensor. It causes the cart to steer away from theobstacle************************************************************************/

interrupt [EXT_INT0] void leftInfraredISR(void){ unsigned char otherSideVoltage;

// Clear interrupt flag GIFR = 0x40;

// Turn off right side motor OCR2 = OFF;

// Adjust left side motor speed otherSideVoltage = readAD(0); OCR0 = getMotorSpeed(otherSideVoltage);

// Clear timer interrupt flag to override A-D polling TIFR |= 0x10;}

/************************************************************************Function Signature: void rightInfraredISR(void);Return Value: NoneParameters: NoneDescription:

This is the interrupt service routine for the INT1 external interruptpin i.e the right IR sensor. It causes the cart to steer away from theobstacle************************************************************************/

interrupt [EXT_INT1] void rightInfraredISR(void){ unsigned char otherSideVoltage;

// Clear interrupt flag GIFR = 0x80;

// Turn off left side motor OCR0 = OFF;

// Poll right side motor and adjust it if necessary otherSideVoltage = readAD(1); OCR2 = getMotorSpeed(otherSideVoltage);

- 42 -

Page 48: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

// Clear timer interrupt flag to override A-D polling TIFR |= 0x10;}

/************************************************************************Function Signature: void pollAD(void);Return Value: NoneParameters: NoneDescription:

This is the interrupt service routine for the periodic timerinterrupt - it polls the ultrasonic receivers and stores the sampled datain global variables************************************************************************/

interrupt [TIM1_COMPA] void pollAD(void){ unsigned char channelToConvert; unsigned char frontLeftVoltage; unsigned char frontRightVoltage; unsigned char rearVoltage = 0;

// Clear the timer interrupt flag TIFR |= 0x10;

// Read voltage on channel 0 - front left ultrasonic channelToConvert = 0; frontLeftVoltage = readAD(channelToConvert);

// Read voltage on channel 1 - front right ultrasonic channelToConvert = 1; frontRightVoltage = readAD(channelToConvert);

// Store voltage samples to global variables lastFrontLeftSample = frontLeftVoltage; lastFrontRightSample = frontRightVoltage;

return;}

/************************************************************************Function Signature: unsigned char readAD(unsigned char);Return Value: 8-bit digital value corresponding to analog voltage on

selected channelParameters: Channel to perform A/D conversion onDescription:

This automatically generated function performs an A/D conversion onthe specified channel and returns an 8-bit number corresponding to theconverted value************************************************************************/

unsigned char readAD(unsigned char adcInput){ // Set up ADMUX register to perform conversion on specified channel, // with result left-adjusted and truncated to 8 bits using AVCC as // reference voltage ADMUX = adcInput | ADC_VREF_TYPE;

- 42 -

Page 49: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

// Start the AD conversion ADCSRA |= 0x40;

// Wait for the AD conversion to complete while ((ADCSRA & 0x10) == 0);

// Clear the AD interrupt flag (just in case) ADCSRA |= 0x10;

return ADCH;}

/************************************************************************Function Signature: void initPeripherals(void);Return Value: NoneParameters: NoneDescription:

This automatically generated function initializes the chip's on-boardperipherals as per the needs of the project************************************************************************/

void initPeripherals(void){ // Input/Output Ports initialization // Port A initialization // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTA=0x00; DDRA=0x00;

// Port B initialization // Func7=In Func6=In Func5=In Func4=In Func3=Out Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=0 State2=T State1=T State0=T PORTB=0x00; DDRB=0x08;

// Port C initialization // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTC=0x00; DDRC=0xff;

// Port D initialization // Func7=Out Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=0 State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTD=0x00; DDRD=0x80;

// Timer/Counter 0 initialization // Clock source: System Clock // Clock value: 1000.000 kHz // Mode: Phase correct PWM top=FFh // OC0 output: Non-Inverted PWM TCCR0=0x61; TCNT0=0x00; OCR0=OFF;

- 42 -

Page 50: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

// Timer/Counter 1 initialization // Clock source: System Clock // Clock value: 1000.000 kHz // Mode: Normal top=FFFFh // OC1A output: Discon. // OC1B output: Discon. // Noise Canceler: Off // Input Capture on Falling Edge TCCR1A=0x00; TCCR1B=0x01; TCNT1H=0x00; TCNT1L=0x00; ICR1H=0x00; ICR1L=0x00; OCR1AH=0x01; OCR1AL=0xF4; OCR1BH=0x00; OCR1BL=0x00;

// Timer/Counter 2 initialization // Clock source: System Clock // Clock value: 1000.000 kHz // Mode: Phase correct PWM top=FFh // OC2 output: Non-Inverted PWM ASSR=0x00; TCCR2=0x61; TCNT2=0x00; OCR2=OFF;

// External Interrupt(s) initialization // INT0: On // INT0 Mode: Low level // INT1: On // INT1 Mode: Low level // INT2: Off GICR|=0xC0; MCUCR=0x00; MCUCSR=0x00; GIFR=0xC0;

// Timer(s)/Counter(s) Interrupt(s) initialization TIMSK=0x10;

// Analog Comparator initialization // Analog Comparator: Off // Analog Comparator Input Capture by Timer/Counter 1: Off ACSR=0x80; SFIOR=0x00;

// ADC initialization // ADC Clock frequency: 125.000 kHz // ADC Voltage Reference: AVCC pin // ADC High Speed Mode: Off // ADC Auto Trigger Source: None // Only the 8 most significant bits of // the AD conversion result are used ADMUX=ADC_VREF_TYPE;

- 42 -

Page 51: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ADCSRA=0x83; SFIOR&=0xEF;

// Watchdog Timer initialization // Watchdog Timer Prescaler: OSC/512k // Disable watchdog for debugging purposes //WDTCR=0x1D; //WDTCR=0x0D;

return;}

/************************************************************************Function Signature: void main(void);Return Value: NoneParameters: NoneDescription:

The entry point of the program, this function initializes the chip'son-board peripherals and houses the main loop that implements the cart'ssteering algorithm************************************************************************/

void main(void){ unsigned char frontLeftVoltage; unsigned char frontRightVoltage; unsigned char motorSpeedLeft; unsigned char motorSpeedRight; signed char difference;

// Initialize peripherals, configure ports initPeripherals();

// Global enable interrupts #asm("sei")

// Main loop while (1) { // Hold voltage values constant while stepping through this algorithm - // otherwise, an interrupt could change these values in mid-execution // with unpredictable effects frontLeftVoltage = lastFrontLeftSample; frontRightVoltage = lastFrontRightSample;

// If either voltage is non-zero, shopper is within range - otherwise,// we switch off the motors

if ( (frontLeftVoltage > ZERO_THRESHOLD) || (frontRightVoltage > ZERO_THRESHOLD)) {

// Determine the two motor speeds independently based on ultrasonic // reading. If the cart is executing a turn, avoid overcompensation // by capping the amount by which the motor speeds can differ

motorSpeedLeft = getMotorSpeed(frontLeftVoltage); motorSpeedRight = getMotorSpeed(frontRightVoltage); difference = motorSpeedLeft - motorSpeedRight; if (difference > 32)

- 42 -

Page 52: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

motorSpeedLeft = motorSpeedRight + 32; else if (difference < -32) motorSpeedRight = motorSpeedLeft + 32; OCR0 = motorSpeedLeft; OCR2 = motorSpeedRight; } else { OCR0 = OFF; OCR2 = OFF; } }}

/************************************************************************Function Signature: unsigned char getMotorSpeed(unsigned char);Return Value: Duty cycle register setting for appropriate motorParameters: Voltage reading from appropriate ultrasonic sensorDescription:

This function maps an ultrasonic voltage reading to an appropriatemotor speed setting************************************************************************/

unsigned char getMotorSpeed(unsigned char voltage){ unsigned char temp; unsigned int largeNum;

// If the voltage is non-zero, duty cycle = (255 - voltage) * 1.5 // Otherwise, the reading is indistinguishable from noise, so switch // off the motor if (voltage > ZERO_THRESHOLD) { temp = ~voltage; largeNum = (unsigned int)temp + (unsigned int)temp + (unsigned int)temp; largeNum = largeNum >> 1; } else largeNum = (unsigned int)OFF;

// Return the duty cycle register setting for the motor in question return ((unsigned char)largeNum);}

- 42 -

Page 53: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

Appendix G: User Manual

Brief

Have you ever been shopping and got upset at bad shopping carts with ruined wheels?

Have you ever been tired and wished that you had someone to push your cart for you? Have you

ever wished that you had an extra pair of hands while juggling a bulky item, and simultaneously

maneuvering your cart? Well, we have just the solution that you are looking for! Enter STAWC

– a cart that pushes itself, so that you can focus on the more important things like buying that

latest must-have gizmo.

An object of desire with its sleek looks and intuitive interface, STAWC is a marvel of

engineering design. It follows you around the store - even around corners and obstacles - so you

never have to worry about crashing into another cart again. All you have to do is wear a

wristband while walking around the store and the cart will follow you. If you slow down, the cart

will slow down, and if you turn, the cart will turn to face you. You can even summon the cart

closer to load/unload it.

The cart has the smarts to avoid obstacles, as well as to decode commands that you send

it. It avoids obstacles by using infrared (IR) proximity sensors to detect any nearby objects and it

then steers around them. The cart can be made to respond to three different user commands –

‘Stop’, ‘Approach Shopper’ and ‘Follow Shopper’. These can be issued using the switches on the

wristband. You can stop the cart from following you by issuing the ‘Stop’ command. The

‘Approach Shopper’ command makes the cart move closer to you allowing you to load/unload

the cart. “Resume Normal Operations” will make the cart follow you at a fixed distance.

Future versions will also include a built-in re-charger, so that all you will need to do is

plug the cart into an AC outlet, and it will charge itself. Right now, it requires a 9.6V power

supply from externally rechargeable batteries, and a 12V battery for the transmitter.

Disclaimer: Use of this cart may be detrimental to animals. Please refrain from using it in their

vicinity, as the ultrasonic emissions will adversely affect them.

G-1

Page 54: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

Product Illustration

Fig G-1: Cart Illustration

G-2

ON

OFF

CALL

FOLLOW

Strap

Mode Select

On/Off Switch

Beacon

Shopping Cart

Top View Side View

Infra Red and Ultra Sonic Sensors

Infra Red and Ultra Sonic Sensors

Circuit Board

DO NOT PLACE

ITEMS HERE

Place Items Here

Page 55: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

Setup Instructions

First time use only:

The product is easy and intuitive to set up and use. When the product is ordered, you will

receive a shopping cart with motors, wheels and PC boards already mounted on it. You will also

receive a wristband tuned to control that particular cart. All that remains are the batteries (not

included). You will need to purchase a 9.6V rechargeable battery pack, and mount it in the black

battery pack holder on the cart. You will also need to purchase a 12V battery for the transmitter

(recommended 1206). Unscrew the back plate of the wrist strap, and insert the 12V battery into

the holder, before closing it back up.

Fig G-2 : Actual Cart

Switch on the main board “On-Off” switch on the shopping cart to complete the

connection, and the cart is ready. The wrist strap will also be operational. Toggle the ‘On-Off’

switch to the ‘On’ position and the LEDs onboard the cart, as well as the wristband’s status LED

should light up, and the cart should commence operations.

Please refer to the troubleshooting guide if this setup procedure fails for any reason.

G-3

Ultrasonic Receiver

Main Board

Wheels

Battery Pack

On-Off Switch and

LEDIR Sensor

Page 56: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

Usage instructions

Our product is easy and intuitive to use. Once the shopping cart is powered on (red LED is lit

on the cart), the only user interaction is with the wristband. To use the cart, perform the

following steps:

1. Wear the wristband on your hand.

2. Make sure there are no LEDs lit.

3. Toggle the ‘On-Off’ switch to the ‘On’ position; the green ‘On’ LED should light up on

the wristband. The red power LED on the cart should also be lit up at this point.

4. Now toggle the ‘Mode Select’ switch to ‘Follow’ mode. This places the cart in the

‘Follow Shopper’ mode, and it will begin to follow you around the store.

5. Feel free to peruse the store and select what you wish to purchase.

6. Once you have decided on an item, walk towards the cart to put your items in. Do not

worry, the built in IR sensors will prevent any accidents. Load the item onto the cart, and

flip the switch back to ‘Follow’, and continue shopping.

7. Note that in case of an emergency, toggle the ‘On-Off’ switch to the ‘Off’ position, and

the cart will stop moving.

8. Once you are done shopping, and leave the check-out line, please proceed to the nearest

station to return your wristband and cart.

Disclaimer: Use of this product may be detrimental to animals due to ultrasonic emissions. If you

have any questions or concerns, please do not hesitate to contact our 24-hour customer service

hotline at 1-800-DIGIJOKE.

G-4

Page 57: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

Troubleshooting Instructions

Problem Possible Solutions

Cart does not move when placed in ‘Follow

Shopper’ or ‘Approach Shopper’ mode

1. Is green LED on wristband lit up? If not,

please replace wristband battery.

2. Is red LED on cart lit up? If not, please

recharge cart batteries.

3. Are the motors humming and yet not

moving? If so, the cart is overloaded.

4. Are you standing more than 7’ away

from the cart during power up of

wristband? If so, please move closer

prior to power up.

Cart does not stop moving

1. Is the ‘On-Off’ switch on the wristband

set to the ‘Off’ position? If not, please

do so.

Suggested solutions do not fix the problemPlease call our 24-hour customer service

hotline at 1-800-DIGIJOKE

Table G-1: Troubleshooting Instructions

G-5

Page 58: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

Appendix H: FMECA Worksheet

Failure No.

Failure Mode Possible Causes Failure Effects Method of Detection

Criticality Remarks

A1 555 output Duty cycle <> 50% +

5%

Shorted resistors or capacitors that

provide the oscillator reference

to the 555

No output ultrasonic signal

from Transducer

Cart does not move

Not Critical System will revert to default stop state,

since no signal received at

microcontroller. A2 No power to 555

timerOpen switches that control logic flow, dead battery, bad

power chip (MAX663)

No output ultrasonic signal

from Transducer

Cart does not move

Not Critical System will revert to default stop state,

since no signal received at

microcontroller. A3 No power to

transmitter Transducer

Bad 555 timer chip No output ultrasonic signal

from Transducer

Cart does not move

Not Crit-ical

System will revert to default stop state,

since no signal received at

microcontroller. A4 Erratic output

from transmitter Transducer

Failing Max663 providing erratic

power, bad switches randomly shorting.

Unpredictable behavior. Possible

acceleration towards user.

Erratic acceleration

and deceleration,

and turning of shopping cart.

Critical System could accelerate to maintain fixed signal strength,

and if IR not working, might cause collision.

A5 No control over functionality

Bad switches Constant signal being

transmitted

Stuck in normal follow

mode of operation

Non Critical

Nuisance, but not a danger. Will be stuck in normal operation,

and will not accept the “Stop” command

B1 Only noise on input ATD

channel

Bad transducer, Non functioning op-

amps

No appreciable output to Micro

ATD

Cart does not move

Non Critical

System will revert to default stop state.

H-1

Page 59: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

B2 Constant 0V output to

microcontroller

Shorted output RC filter/envelope

detector resistor or capacitor, or non functioning op-amps, or main

board power chip bad or shorted noise

suppression capacitors.

No appreciable output to

Microcontroller ATD

Cart does not move

Non Critical

System will revert to default stop state.

B3 Noise on ATD channel.

Frayed wires connecting receiver

boards to main boards, open noise

suppression capacitors, envelope

detector and rectifier circuit components bad

Unpredictable behavior. Possible

acceleration towards user

Erratic acceleration

and deceleration,

and turning of shopping cart.

Critical System could accelerate to maintain fixed signal strength,

and if IR not working, might cause collision.

B4 Constant high (3.3V) voltage to

ATD

Shorted 3.3V line to ultrasonic receiver input ATD channel

No changing signal strength

implying correct distance/speed

being maintained

Cart will move at constant

speed in straight line

Critical No change in speed or direction, and if IR not working, can cause collision.

C1 Constant High input to IRQ

channel

Defective/dirty IR sensor, Inverter

chip not working, pull-up resistor

open

No obstacle avoidance detection

capability.

Cart will not avoid

obstacles, and will cause collision

Critical Collision imminent

C2 Constant Low input to IRQ

channel

Defective IR sensor, Power supply

failure, Pull up

No obstacle avoidance capability

Cart will not move, because it constantly

Non-critical

Cart will “hang”

H-2

Page 60: EE 477 Final Report - College of Engineering - Purdue … · Web viewBoth were relatively inexpensive solutions to the problem of detecting obstacles in the shopping cart’s path

ECE 477 Final Report Fall 2004

resistor shorted to VCC, inverter chip

not functioning.

detects an object’s

presence. C3 Erratic Inputs to

IRQDirty/Defective IR

sensor, failing power supply

Effects Unpredictable.

Erratic Behavior.

Critical

D1 Motor Stuck “Off”

Open switching BJT not sinking current,

non functioning opto-isolator not

transmitting PWM signals to motor.

Stationary cart. Cart will not move.

Non-critical

D2 Motor stuck “On”

Fused opto-isolator shorted to power, mechanical Motor

defect

Microcontroller pins may become

damaged, cart will not stop

Cart will move continuously

Critical No control over speed or direction of

movement – collision imminent.

E1 0V output Short on the resistors and

capacitors providing the biasing control

System unavailable

Cart will not move.

Non-critical

E2 Incorrect output voltages, out of

tolerance

Failure of any resistor or capacitor

generating the voltage on the chips.

Erratic system behavior,

inadequate amplification of

ultrasonics, damage to

microcontroller

Erratic behavior

Critical

H-3