Physcomp: project 1
Background: In this project, we are trying to create a wake up alarm system that prevents you from snoozing and falling back to sleep again.
time: Sept 22nd - Oct 6th
team: Peiyu Eva Zhou and Kelin Guang
Our Workflow and Challanges: During this judgement, there are several possible path that we need to orangize and define. There are only one ways that when both force and duration are reach to certain amount, the alarm will stop. Otherwise, it wont.
If force > 500 && duration >= 30; ︎︎︎ alarm stops
If force < 500 && duration >= 30; ︎︎︎ loop
If force < 500 && duration < 30; then duration = 0; ︎︎︎ loop
If force > 500 && duration < 30; ︎︎︎ loop
Every second, we record the force, if the force > 500, duration ++;
when duration = 30, alarm stops; else continue loop.
We come up with one possible way to realize this judgement. First, right after the clock reaches the set alarm time, we will initiate a new variable (duration = 0). Then We will collect the data for force every second. When force ≥ 500, duration ++. When force < 500, duration = 0. On top of this, at the end of each loop, we will check of duration = 30. If true, alarm stops and the time will be reset. Else, the loop continues.
Step by Step: We tested the three compoments, photocell, speaker and time of flight individually and make sure these three are able to work.
Speaker: We started with the speaker, after we connect the circuit, we first use a simple code to let the speaker have sound left image. Then choose use Marios as our music right image.
Photocell: It took us very long time to debuging photocell, ad first the code and circuit work very well, after we tested the speaker and trying to combine these two, it only worked once and then the photocell started to generated random states on the seriel monitor. We change four different photocell, and three different ways to code, even changed the connection twice. Below are the circuit and the code.
Time of Flight: This component can measures the range to a target object up to 2 m away. it have 7 different pinout and we did some research about how to code and connect it with the Arduino.
Combine: After tested the three compoments successfully, we started to combine these one by one. First we use Fritzing to drew a parallel circuit with both three compoments.
Speaker + Phorocell: This component can measures the range to a target object up to 2 m away. it have 7 different pinout and we did some research about how to code and connect it with the Arduino.