Lab
1 – Building a Burglar Alarm System
Assigned:
February 7th 2002, Demonstration Date: February 27th 2002
Microcontrollers are elements that fall between electronic hardware and software. They are computers in that they are programmed using algorithmic languages, but they are hardware in that they are installed by being wired into the system with all of the other electronic components. In the first project, we take our first step into the hardware domain by interfacing our first few electronic components: LED’s, pushbuttons, seven-segment displays, LCD display, etc., and initiating interaction with our microcontroller. By completing these exercises, we can then integrate these devices to build a burglar alarm system
1.
Gain
familiarity with BS2 programming environment
2.
Implement
digital inputs from pushbuttons
3.
Perform
digital outputs to a seven-segment display
4.
Interface
a LCD display
5.
Integrating
these elements into a useful system
Please read the corresponding experiments thoroughly before you begin
connecting the various pieces:
Write a PBASIC
program and implement the following in hardware using the Stamp Works Board.
You will be required to demonstrate only Part e. (Parts a, b, c, and d are
intended to help you break down the task into manageable portions –however,
while doing so please keep in mind the final outcome desired and optimize your
I/O pins).
a)
Turn
a LED on and off in response to pushbutton inputs
Interface
the pushbutton switches D1-D3 with LED 0 to the Stamp.
The
initial state LED 0 is off and pressing a given switch alters the mode of
operation of the LED. Pressing Switch D1 starts the flashing of LED0 (once every second) and pressing Switch D2
turns the flashing off. Pressing Switch D3 keeps the LED0 permanently on.
Note:
-
Review the discussions of the class
with respect to (i) adding a resistance in series with the LED and (ii)
ensuring the polarity of the LED before implementation.
-
The "button" command could
prove useful.
b)
Interfacing
a Seven Segment display
To
part (a), we would like to add a feature that permits us to keep track of the
last button pressed. Also, we would like to implement MAX7219 to reduce the
number of I/O pins required. Using the pin diagram from the datasheet, connect
the pins of one of the seven-segment
display directly to the digital I/O lines of the Basic Stamp and set
it up to display the last key pressed on the pushbutton keypad.
Note:
-
These displays are common cathode
displays with built-in current limiting resistors.
-
The display needs to be explicitly
enabled.
c)
Interfacing
the LCD Screen
Interface the Basic Stamp to LCD Screen so that you can keep track of the number of the last button (S1-S3) pressed display the button that has been pressed.
d)
Interfacing
a Piezo Beeper
Interface the Basic Stamp to with the Piezo Beeper
built in the Stamp Work Board using the FREQOUT or DTMFOUT commands so that it
will create different sound effect.
e)
Implement
a burglar alarm system
Create
a burglar alarm system based on the simple sets of sub-parts that you have
tried from parts a to d. As discussed in class, please ensure that the device
has the following features:
-
It can be engaged/activated and turned
off by some sequence of actions.
-
It has a password checking mechanism –
as the passwords input device you could use multiple pushbuttons, one
pushbutton keying in Morse code.
-
It should have a time-keeping function
that ensures that a user inputs the password within a given period before
sounding the alarm.
-
Displays relevant information using
some combination of seven-segment displays and LCD screens. For example, you
could use the seven-segment display to show the input passwords, and the LCD
display to show messages to the user – however, we will leave it up to you to
optimize a suitable configuration for your system.
Reporting:
Each
group should send in a weekly e-mail to the TA, Mr. Chin-Pei Tang (chintang(at)buffalo.edu) briefly outlining
their progress for the week and outlining a schedule for proposed completion of
the rest of your lab assignment by the group (these will be due on the Thursday
of each week).
For
the lab report, please provide a self-standing document, which describes and
explains the complete system and would enable someone else to replicate your
work easily.
·
Please follow the guidelines provided
at http://www.eng.buffalo.edu/Courses/mae576/ReportFormat.htm.
·
For sample reports see http://www.eng.buffalo.edu/Courses/mae576/SampleReport.pdf
and http://www.eng.buffalo.edu/Courses/mae576/Spring2002/LAB_REPORTS/.
Specifically
in your report:
·
Describe the implementation and
operation of your system. How secured
is your alarm system? How could you improve its features?
·
Document your system with a circuit
diagram, and a list of components.
·
Include a listing of your program with thorough
comments.