Presentation is loading. Please wait.

Presentation is loading. Please wait.

Software Design Project

Similar presentations


Presentation on theme: "Software Design Project"— Presentation transcript:

1 Software Design Project
Engineering H192 Winter 2005 Software Design Project Lecture 29 To the Instructor: The Engineering H192 two person design project is a software design problem. Two-person teams will design, code, test and document their product. Winter Quarter Lecture 29

2 ENG H192 Software Design Project
Engineering H192 Winter 2005 ENG H192 Software Design Project Problem: Detect frequency of IR transmitter Two-person teams will -- Design Code Test Document Teams will be provided -- Handy Board Sharp GP1U5 IR receiver Access to IR transmitter beacon To the Instructor: The Engineering H192 two person design project is a software design problem. Two-person teams will design, code, test and document their product. The "General Description", excerpted from the problem assignment which should be handed out, is as follows: General Description: Each two-person team is to design, code, test, and document a software program to detect the frequency of an infrared (IR) transmitting beacon using a Sharp Model GP1U5 IR receiver connected to the Handy Board Controller. The necessary hardware will be provided in class. A modular software design is encouraged. The software design team should develop a user-written function (or package of functions) that will be able to detect each of up to five (5) possible frequencies of IR transmission and display the results on the LCD screen of the Handy Board. The five frequencies will be specified in class. Winter Quarter Lecture 29

3 The Handy Board Engineering H192 Winter 2005 To the Instructor:
The hardware platform will be the Handy Board controller, the same controller to be used in ENG H193 to control the robot project in the spring term. Winter Quarter Lecture 29

4 The Sharp GP1U5 IR Receiver
Engineering H192 Winter 2005 The Sharp GP1U5 IR Receiver The Sharp GP15U Infrared receiver is an older receiver used in a variety of application, primarily as the receiver embedded in devices which could be controller via an IR remote (TVs and the like). Here is a wiring diagram for reference only. For this design project, a pre-wired IR receiver is provided. Winter Quarter Lecture 29

5 Engineering H192 Winter 2005 General Description Your software must detect each of five (5) possible frequencies of transmitted IR light Frequency detected must be displayed on Handy Board LCD screen Frequencies will in the range of 20 to 150 Hz No frequency will be closer than 15 Hz to any other possible frequency Transmitted frequency will change automatically and randomly to one of the other possible frequencies To the Instructor: Here is a general description of the problem. A test beacon will generate up to five different frequencies of transmitted IR light. The software running on the Handy Board must analyze the signal received by the IR receiver and determine which frequency is being transmitted. The range of possible frequencies is know. The software must be able to track changes in transmitted frequency. Winter Quarter Lecture 29

6 IR Transmission and Reception
Engineering H192 Winter 2005 IR Transmission and Reception Program should continuously detect frequency of the transmitting beacon Handy Board screen should display received frequency in Hertz as an "integer" value Only one of the specified frequencies (or 0) should be displayed Some additional program performance requirements are given on this slide. IR Receiver IR Transmitter 6 to 12 inches Winter Quarter Lecture 29

7 The IR Beacon Signal IR Beacon Signal 1 "Digitized" copy of signal
Engineering H192 Winter 2005 The IR Beacon Signal IR Beacon Signal 1 X X X X X X X X To The Instructor: Here is a diagram on which brief explanation of a possible scheme to analyze frequency can be demonstrated. The IR beacon will alternate between "off" and "on". If the software program were to capture a number of samples (uniformly spaced in time) of the received signal and then look for the number of transitions from off-to-on and on-to-off, the frequency being transmitted could be calculated. X X X X X X X X X X X X "Digitized" copy of signal Time Winter Quarter Lecture 29

8 Engineering H192 Winter 2005 A Possible Approach Take a number of measurements of the received signal at regular intervals Determine how long it took to take those measurements Analyze set of measurements Display appropriate frequency Repeat To The Instructor: Here is brief explanation of a possible scheme to analyze frequency. The IR beacon will alternate between "off" and "on". If the software program were to capture a number of samples (uniformly spaced in time) of the received signal and then look for the number of transitions from off-to-on and on-to-off, the frequency being transmitted could be calculated. If this procedure were repeated in a loop, the software should be able to track changes in transmitted frequency. Winter Quarter Lecture 29

9 Useful Handy Board Functions
Engineering H192 Winter 2005 Useful Handy Board Functions digital (p) -- Returns the value of the sensor connected to digital port "p" as a true/false value. The parameter "p" should be in the range of 7 through 15, matching port to which receiver is connected Note that "true" = zero volts, which is sometimes called "active low" start_button ( ) -- Returns the value of the start button. "True" when button is pressed. To the Instructor: Some useful functions in the Handy Board support library. The IR receiver should be connected to a digital input port on the handy Board. Winter Quarter Lecture 29

10 Useful Handy Board Functions
Engineering H192 Winter 2005 Useful Handy Board Functions stop_button ( ) -- Returns the value of the stop button. "True" when button is pressed. mseconds ( ) -- Returns a long integer value representing the system time in milliseconds. Like the seconds ( ) function, but data type of returned value is long & units are milliseconds reset_system_time ( ) -- Resets the count of system time to zero milliseconds. To the Instructor: More useful functions. Note that "mseconds( );" or "seconds ( );" can be used to measure the elapsed time of a burst of sampling the values detected on a digital input port for example. Winter Quarter Lecture 29

11 Engineering H192 Winter 2005 Interactive C Remember, there are things that are different in IC (compared to ANSI C): No function prototypes Limited formats possible in printf Array bounds checked at run time No #include statements Smaller set of allowable data types -- only int, long, float, char, and struct To the Instructor: There are some features of the subset of the C language support by Interactive C of which students should be aware. Winter Quarter Lecture 29

12 Interactive C More things that are different in IC (compared to ANSI C): Can only do +, -, and * on long integers All source files must be compiled together or the source file must have “#use” preprocessor commands #define has global scope User functions come first in source file No mixed mode arithmetic Winter Quarter

13 Design Project "Deliverables"
Engineering H192 Winter 2005 Design Project "Deliverables" List of brainstorming ideas Neatly written algorithm and/or flow chart of user-written functions Documentation package which must include: A description of the program for use by developers, complete with a list of variable names and uses. A description of the program for use by a general user with an abstracted discussion of the program. To the Instructor: These are the deliverables of this design project. Winter Quarter Lecture 29

14 Receiving in a "Noisy" World
Engineering H192 Winter 2005 Receiving in a "Noisy" World Real world communications are affected or "degraded" by noise, for example: Normal conversations in a busy public place Cell phones in fringe reception areas ("Can you hear me now?"™) AM radio stations during thunderstorms Often measured as a "signal-to-noise" ratio which is usually called SNR Almost all forms of communication are range dependent -- longer range => lower SNR To the Instructor: Communications in the real world are affected, sometimes seriously, by noise -- the received signal is almost never is a perfectly clean, pure signal. Signal quality is defined by a metric call Signal-to-Noise ratio, or SNR. Winter Quarter Lecture 29

15 Receiving in a "Noisy" World
Engineering H192 Winter 2005 Receiving in a "Noisy" World The IR transmitter and receiver system we are using is "range dependent" How does light intensity vary as a function of distance? IR receiver "drops out" if transmitted signal is too weak What does "drops out" mean? Can we improve our ability to "see"? To the Instructor: In solving this design problem, students will be challenged to devised ways of improving accuracy in detecting the frequency of the received signal while faced with a noise environment that becomes worse as the distance between the transmitter and receiver is increased. How do you attack this problem? Winter Quarter Lecture 29

16 The "Noisy" IR Beacon Signal
Engineering H192 Winter 2005 The "Noisy" IR Beacon Signal IR Beacon Signal 1 X X X X X X X X X X X To the Instructor: Here's the same diagram as before, now with a "noise" spike in the digitized data. X X X X X X X X X X X X X X "Digitized" copy of signal Time Winter Quarter Lecture 29

17 A Possible "Noisy" Approach
Engineering H192 Winter 2005 A Possible "Noisy" Approach Take a number of measurements of the received signal at regular intervals Determine how long it took to take those measurements Analyze set of measurements and ignore periods that are shorter than average Compare results of several sets (Steps 1 - 3) Display appropriate frequency Repeat from beginning To the instructor: A possible method for accounting for noise in the received data. The key here is ignoring those periods that are shorter than the average period. Winter Quarter Lecture 29

18 Possible Programming Pitfalls
Engineering H192 Winter 2005 Possible Programming Pitfalls Failing to use global variables, particularly for medium or large arrays Scarcity of comments in code (comments don’t take any memory space) Improper use of Handy Board functions Not using modular approach to designing code Too much floating point arithmetic Too much code – exceed memory of Handy Board To the Instructor: Tips and hints for avoiding some troubles with the project. Winter Quarter Lecture 29

19 Maximum HB "Sampling" Rates
Engineering H192 Winter 2005 Maximum HB "Sampling" Rates          Method of input                          Rate (sps) Analog port with digital( ) function:   530 (ch 2-6) Digital port with digital( ) function:    430 (ch 10-15)  570,530 (ch 8,9) Analog port with analog( ) function:  690 (ch 2-6) Digital port with analog( ) function:   330 (ch 10-15)  400,380 (ch 8,9) Instructor: Summary of Handy Board sampling rates by port and function. Winter Quarter Lecture 29


Download ppt "Software Design Project"

Similar presentations


Ads by Google