OSU ENGR H192 - Lecture 31 - Software Design Project Hints

Unformatted text preview:

Software Design Project HintsGeneral DescriptionIR Transmission and ReceptionThe IR Beacon SignalA Possible ApproachSimple Loop in "main"Find All "up" Transitions in IR Data ArrayCalculate the "Average" PeriodThe "Noisy" IR Beacon SignalA Possible "Noisy" ApproachLect 29 P. 1 Engineering H192 - Computer Programming Winter QuarterThe Ohio State UniversityGateway Engineering Education CoalitionSoftware Design Project HintsLecture 31Lect 29 P. 2 Engineering H192 - Computer Programming Winter QuarterThe Ohio State UniversityGateway Engineering Education CoalitionGeneral 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 frequenciesLect 29 P. 3 Engineering H192 - Computer Programming Winter QuarterThe Ohio State UniversityGateway Engineering Education CoalitionIR 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 displayedIR ReceiverIR Transmitter6 to 12 inchesLect 29 P. 4 Engineering H192 - Computer Programming Winter QuarterThe Ohio State UniversityGateway Engineering Education CoalitionThe IR Beacon SignalIR Beacon Signal"Digitized" copy of signalX X X XX X X XX X X XX X X X01TimetX X X XLect 29 P. 5 Engineering H192 - Computer Programming Winter QuarterThe Ohio State UniversityGateway Engineering Education CoalitionA Possible Approach•Take a number of measurements of the received signal at regular intervals•Determine how long it took to take all of those measurements & calculate time between samples•Find the each of the "up" transitions•Calculate an "average" period •Calculate an "average" frequency•Display appropriate frequency•RepeatLect 29 P. 6 Engineering H192 - Computer Programming Winter QuarterThe Ohio State UniversityGateway Engineering Education CoalitionSimple Loop in "main"while (!stop_button( )) { get_IR_data ( ); find_transitions ( ); calculate_period ( ); calculate_raw_frequency ( ); calculate_adjusted_frequency ( ); printf ("Frequency = %d\n", adj_freq); }Lect 29 P. 7 Engineering H192 - Computer Programming Winter QuarterThe Ohio State UniversityGateway Engineering Education CoalitionFind All "up" Transitions in IR Data Arrayvoid find_transitions ( ){ int i; n_trans = 0; for (i = 1; i < D_SIZE; i++) { if (IR_data[i-1]==0 && IR_data[i]==1) { transitions[n_trans] = i; n_trans++;} } }Lect 29 P. 8 Engineering H192 - Computer Programming Winter QuarterThe Ohio State UniversityGateway Engineering Education CoalitionCalculate the "Average" Periodvoid calculate_period ( ){ int i; float sum = 0.0; if (n_trans > 1) { for (i = 0; i < n_trans - 1; i++) {sum = sum + (float)(transitions[i+1] - transitions[i]) * delta_t; } period = sum / (float) (n_trans-1); } else period = 0.0;}Lect 29 P. 9 Engineering H192 - Computer Programming Winter QuarterThe Ohio State UniversityGateway Engineering Education CoalitionThe "Noisy" IR Beacon SignalIR Beacon Signal"Digitized" copy of signalX X X X X01TimeX X X X XX X X X XX X X X XX X X XXLect 29 P. 10 Engineering H192 - Computer Programming Winter QuarterThe Ohio State UniversityGateway Engineering Education CoalitionA Possible "Noisy" Approach•Take a number of measurements of the received signal at regular intervals•Determine how long it took to take all of those measurements & calculate time between samples•Find the each of the "up" transitions•Calculate an "average" period –Ignore periods substantially shorter than average & calculate new "average" period•Calculate an "average" frequency•Display appropriate


View Full Document

OSU ENGR H192 - Lecture 31 - Software Design Project Hints

Documents in this Course
Strings

Strings

22 pages

Load more
Download Lecture 31 - Software Design Project Hints
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 31 - Software Design Project Hints and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 31 - Software Design Project Hints 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?