After a long night of studying and planning to wake up early to start the grind over again, it would be very inconvenient for you to miss your alarm clock the next morning. This has most likely happened to all of us at least once or twice. Whether you are a heavy sleeper or were just having a dream about getting an A on the IOT Project, you can’t afford not to wake up.
Our future trademarked and patent pending alarm clock will make sure you never miss an opportunity to grind ever again. This alarm clock with not only beep at you, but it will also turn on your bedroom lights. Using three Particle photons we will give you the most rude and effective way to wake up and start your morning.
How it WorksThis alarm clock functions using three distinct Particle Photons. Using If This Then That (IFTTT) to create an Alarm Applet, the Applet creates an event and triggers the first Photon. The main photon connects to our Thingspeak channel. We did not use Webhooks to configure Thingspeak within our code, instead we used the library file which the Particle console provides. The main photon then configures itself to the correct time. After these functions, the first photon publishes an event to communicate to the other photons called MEGR3171_DillonT_AlarmClock. At the same time it subscribes to the events that the other photons are publishing. Once the other two photons subscribe to the MEGR3171_DillonT_AlarmClock event, they run a if/else code function. The buzzer will ring and LEDs on the board will light up while the servo motor photon will switch the lights on and off. After the two photons complete these actions, they will publish an event that the first photon is subscribed to. The data will be collected by Thingspeak and graphed according to alarm detection and motor/lights status. The alarm will then turn off. This alarm is repeated Monday through Friday at 9:00 am Eastern Standard time.
The Applet is set to publish an event every morning of the week through Monday-Friday at 9:00 am. On the weekends you are allowed to sleep in and relax.
For testing purposes, because we wanted to show the process at different times, the Applet will publish a notification of the event to your phone. As the main photon waits, it is constantly checking the time and if the IFTTT Applet has not gone off it will send out an alarmOff event.
If the photon sees the IFTTT event, it will publish an alarmOn event. The alarmTime will also display the time of the alarm.
The light switch is controlled by a servo motor which is connected to the second photon. The second photon will have code which triggers the servo motor after subscribing to an event the main photon publishes. The servo motor then flips to turn the light switch on and off repeatedly. The lights will flicker until you finally wake up to turn them off for good. This will help start your day off bright and early.
The loud piercing sound is generated by the buzzer. The third photon has the responsibility of the buzzer and the LED lights on the board. Similar to the servo motor code, the third photon has code which is subscribed to the main photon. This event triggers a series of events in the code and triggers the “alarm”. The code will go through the functions and publish an event. The buzzer and LEDS will go off twice then the alarm will then stop. Hopefully by now you will be wide awake and already dressed.
Thingspeak is used to record the data/status of the Alarm and the Motor/Lights. We had the Buzzer status within Thingspeak but it would not display the data for it. Using the Channel ID and the API key from Thingspeak, we were able to communicate the data between the photons and the program. The figure above shows what it looks like when the alarm is off and how the data is recorded onto the graphs.
The figure above shows the detection of the alarm clock. These are test results, but it gives an idea of how you would be able to tell if the Alarm was set off. The graph spikes at a value of 1 and drops back down till the next detection. It could be set to any value, but the value 1 is described within the code.
Comments