460 likes | 938 Views
ROOM OCCUPANCY INDICATOR. SUNIL KALWANI, KWANWOO LEE, RAKESH PATEL TEAM 9 | ECE 445 | 5/1/09. INTRODUCTION. Our senior design project aims to create a functional system where the number of people in a room can be determined based on tabulating people entering and exiting a room. . OBJECTIVE.
E N D
ROOM OCCUPANCY INDICATOR SUNIL KALWANI, KWANWOO LEE, RAKESH PATEL TEAM 9 | ECE 445 | 5/1/09
INTRODUCTION Our senior design project aims to create a functional system where the number of people in a room can be determined based on tabulating people entering and exiting a room.
OBJECTIVE Accurately sense whether or not someone enters or exits a room through ultrasonic sensors Keep/Update count value in the microcontroller Transmit and receive the count value wirelessly Convert count value so a computer can understand it using MAX-232/RS-232 Display count value on the computer through LabView
BENEFITS & FEATURES Low overall cost Easy to use Wireless transmission of occupancy data Ability to toggle between two counting modes Mode I: keeps track of total number of people in room (adds if people enter, subtracts if people leave) Mode II: keeps track of highest count (adds if people enter, does not subtract if people leave)
ORIGINAL DESIGN Room A5 people Channel 0 5 people Room A Wireless Communication Room B4 people Channel 1 4 people Master Room Room B Sensors -> Pic -> Transmitter -> Receiver -> Pic -> MAX -> RS -> Display
PROJECT BUILD AND FUNCTIONAL TESTS Ultrasonic Sensors Microcontroller Wireless system MAX-232/RS-232 Display through LabView
BLOCK DIAGRAM TX MODULE RX MODULE SENSOR #1 MICROCRONTROLLER PERSON DISPLAY MAX-232 RS-232 WIRELESS RECEIVER WIRELESS TRANSMITTER SENSOR #2
1/3 OF DEVICE voltage regulator transmitter oscillator microcontroller Ultrasonic Sensor
2/3 OF DEVICE RS232 voltage regulator receiver MAX232
3/3 OF DEVICE count display
ULTRASONIC SENSORS • Send out an 8 cycle burst of ultrasound at 40khz • Raise its echo line high (or trigger line in mode 2). • Listens for an echo, then lowers it • Echo line pulse width proportional to distance of object • Range up to 4 meters
PRELIMINARY TEST DATA FOR SENSORS 3 in (minimum) 10 in 18 in 43 in 32 in
ENTER AND EXIT PATTERN A B Enter: A on first, then B on Exit: A on first, then B on Exit Enter
STATE MACHINE 00/11 ENTRY (ADD 1) STATE 0 (START) 01 (S1 on 1st) 10 (S2 on 1st) 00/11/01 00/11/10 EXIT (SUBTRACT 1) 10 (S2 on 2nd) 11 01 (S1 on 2nd) STATE 1 STATE 2 TRANSITION STATE unconditional unconditional 00/10/01
STATE 1 DETAILS ENTRY (ADD 1) STATE 0 (START) 01 E=1 11 E=0 STATE 1 00/11/01 01/10 E=1 STATE 1 STATE 1B STATE 1A E=0
MICROCONTROLLER Master Clear/ PIC Reset LED Output – For Testing LED Output – For Testing LED Output– For Testing LED Output – For Testing LED Output– For Testing LED Output – For Testing LED Output – For Testing LED Output – For Testing (5V) (GRND) (5V) (GRND) 4 MHz oscillator Count transmitted to wireless circuit Input – Sensor 1 Switch Input – Mode Type of Count Switch Input – Count Reset Input – Sensor 2
1 HZ OSCILLATOR (PIC) • In order to avoid referencing the sensors through the function generator, we created an oscillator through the PIC • Timing delays were set such that the PIC obtained a 13% duty cycle for a 1 Hz signal • Delay time for high and low PIC outputs were determined through trial and error by measuring the results on a oscilloscope • For future production of this circuit, a 555 Timer would be a more cost effective choice as an in-circuit oscillator PIC FUNCTION GENERATOR
WIRELESS SYSTEM LINX TXM-900-HP3 transmitter LINX RXM-900-HP3 receiver Occupancy count sent through channel 0 902.62 MHz
TRANSMITTER Vcc
RECEIVER Vcc Vcc
PRELIMINARY TEST DATA FOR TX/RX Function generator into TX data pin Output from RX data pin Sent thru channel 0
SENT DATA FOR TX/RX 0101010001 TRANSMITTED 0101010001 RECEIVED Value of 21 (00010101) was sent Start bit = 1, stop bit = 0 1000101010 is inverted and sent, with LSB sent last Thus 0101010001 is seen on the oscilloscope
Max232 and RS-232 1 CD Carrier Detect 2 RXD Receive Data 3 TXD Transmit Data 4 DTR Data Terminal Ready 5 GND Ground 6 DSR Data Set Ready 7 RTS Request to Send 8 CTS Clear To Send 9 RI Ring Indicator No Handshaking
Total Data Being Tx/Rx Signal on RS-232 Line Signal that Enters/Leaves PIC
Testing • Shorted pins 2 and 3 • Wrote code to echo character pressed in hyperterminal using the PIC • Probed stages in the circuit
Results on Oscilloscope Data is transmitted from Hyperterminal The data sent to PIC
HYPERTERMINAL TESTING ‘a’ is pressed ‘a’ is echoed count in ASCII
SUCCESSES Correctly keeps track of the count value Wireless system works Correctly takes count data from the microcontroller and sends it to the receiver Receiver has the same data as the transmitted data Data is correctly displayed on computer
CHALLENGES Main source of problems was existence of jitter in sensor outputs Led to few glitches in count values Microcontroller code not immune to speed at which people enter/exit
OTHER TESTS Wireless range distance 10.77m – distance across room Distance between the two sensors Sensor range
SENSOR DISTANCE & RANGE x = ? x = ? 22° 22° 22° 22° y = ? y = ? wall wall NOT PREFERRED PREFERRED tan 22° = 0.4 ≥ x/(2y) x/y ≥ 0.8
TRIAL AND ERROR I DATA Sensor/Wall Distance kept constant *used Mode 1
TRIAL AND ERROR I GRAPH jitter Efficiency (%) Sensor/Sensor Distance (in.)
TRIAL AND ERROR II DATA Sensor/Sensor Distance kept constant *used Mode 1
TRIAL AND ERROR II GRAPH jitter Efficiency (%) Sensor/Wall Distance (in.)
ETHICAL ISSUES Whether or not count value should be made public or private Information sent/received wirelessly should be efficiently sent so as to not consume too much of the RF spectrum/network
RECOMMENDATIONS Optimize code for converting sensor output data to count data, perhaps by increasing the input oscillator’s frequency Include usage of infrared sensors to make sure humans are detected as opposed to inanimate objects Rather than having a reset for the PIC and a switch to reset the clock after the next clock cycle, the circuit could make use of an interrupt switch for reset. This would create an instantaneous reset of the count
SUMMARY • Project worked! • Jitter in the sensor readings made the occupancy readings inconsistent at times • Focused on the system of capturing data from the sensors and passing that along • Worked on both hardware and software and successfully implemented both
CREDITS Nigel Goodwin Mike Stracey Ethan Miller Wally Smith Tony Mangognia Gary Swenson