F16: Door Alarm System
Contents
Project Title: Door Alarm System
Abstract
Our project would use a motion detector and light sensor on the SJOne board to control the output of a speaker. If the someone opens the door during daytime, the speaker would output a song as a welcome. However, if the door opened at night where there’s no light, the speaker would output an alarm because there might be thieves coming in during midnight.
Objectives & Introduction
The objective of this project to create a realizable indoor anti-theft system. The system is able to detect the people's motion by using the motion sensor, and judge the current brightness by using the on-board light sensor.
In order to accomplish the objective, we need to the following things:
- Modified the Pulse-Width Modulation(PWM) source code to allow the speaker to play a song.
- Figure out how to amplify the sound signal.
- Using the ADC code to receive the signal from motion sensor.
Team Members & Responsibilities
- Bowei Zhang
- Program the speaker.
- Programming the ADC code.
- Testing the software.
- James Huang
- Improve the playing song algorithm.
- Design the hardware connection between MCU and external parts.
- Programming the ADC code
Schedule
The following table is our schedule for this project.
Week# | Date | Task | Completion | Comment |
---|---|---|---|---|
week1 | Oct31 - Nov4 | Project Plan & ordering parts | Completed | Parts Ordered |
week2 | Nov 7 - Nov11 | Circuit Design & Writing Software (part 1) | Completed | Finalizing the idea. |
week3 | Nov14- Nov18 | Circuit Design & Writing Software (part 2) | Incomplete | Speaker with low volume. Consider ordering Amplifier. |
week4 | Nov21- Nov25 | Finish Testing | In completed | Motion Senor came with damage. Ordering new one. |
week5 | Nov27- Dec2 | Project Report | Completed | Working on Report. Waiting for sensor. |
week6 | Dec 3 - Dec9 | Cont. Testing & finish project report | Incomplete | Waiting for Motion sensor. Consider moving to plan B. |
week7 | Dec12- Dec16 | Cont. Testing | Completed | Report finished. Testing sensor. |
week8 | Dec17- Dec19 | Finish Report & Testing | Completed | Done |
Parts List & Cost
Part Name | Quantity | Cost | Notes |
---|---|---|---|
SJone Board | 1 | $80 | SJone Board |
Speaker module | 1 | $2 | Buzzer |
SD card | 1 | ~$10 | |
LEDs | 4 | <$1 | |
Motion Sensor | 1 | $15 | Detector |
Signal Amplifier | 1 | $1 | 2N3904 |
Design & Implementation
Hardware Design
The following figure is the system level design of our project.
Hardware Interface
Pulse-Width Modulatio(PWM)
- As the Figure 1 showed,we connected the speaker with an 2N3904 Amplifier, and then connected it to the on- board PWM Pin (pin2.0)directly. When the speaker output condition is triggered, pin 2.0 will send a PWM signal to the amplifier and it will be amplified to allow the speaker output louder.
Analog to Digital Converter(ADC)
- In order to receive the data from motion sensor, we connected it with the on-board ADC pin (pin 2.6), the ADC pin will send a 20us trigger signal to trigger the sensor, and then the sensor will return an analog signal. By decoding the signal, we will able to know did the sensor detect something or not.
General Purpose Input/Output (GPIO)
- The General Purpose Input/Output(GPIO)Pin is used to control the LEDs.
Sensor Connection
The left figure showed us the sensor circuit. The middle pin which is the trigger pin has been tied to the ADC, so the analog signal that send by the senor is able to transfer to the digital signal that the MCU is able to read.
Speaker Connection
The right figure showed us how to tie the Speaker. First, we use a 1k pull-up resister to prevent the current flows. Then we used the amplifier to amplify the PWM signal to make the song comes out of speaker is loud enough.
Software Design
Figure 4 showed us the state machine of the project.
Show your software design. For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level. Do not show the details of the code. For example, do not show exact code, but you may
Implementation
This section includes implementation, but again, not the details, just the high level. For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash. You can include sub-sections for each of your component implementation.
Testing & Technical Challenges
Describe the challenges of your project. What advise would you give yourself or someone else if your project can be started from scratch again? Make a smooth transition to testing section and described what it took to test your project.
Include sub-sections that list out a problem and solution, such as:
My Issue #1
Discuss the issue and resolution.
Conclusion
Conclude your project here. You can recap your testing and problems. You should address the "so what" part here to indicate what you ultimately learnt from this project. How has this project increased your knowledge?
Project Video
Upload a video of your project and post the link here.
Project Source Code
References
Acknowledgement
Any acknowledgement that you may wish to provide can be included here.
References Used
List any references used in project.
Appendix
You can list the references you used.