Morning Wakeup and Routine Helper
by alonx12345 in Circuits > Arduino
262 Views, 0 Favorites, 0 Comments
Morning Wakeup and Routine Helper
We will show you how to make to make a small helper to help get up in the morning, and streamline the morning routine using a combination of hardware and digital apps.
Functionalities:
- A wake alarm to a melody of your choice (we will use 3 pre-made) a snooze every 5 minutes, and the ability to turn it off.
- Get information about room and outside temperatures and the light level in the room, as well as recommendations for what to wear and if you should get more light around you.
- Receive a notification regarding upcoming calendar events with push notifications.
- Get via email links to news articles about subjects of choice.
- Send out a greeting notifications via sound, light and phone to house residents whenever you return home.
Required Components:
- Circuit Playground Express (Device: https://adafruit.com/product/3333, Drivers: https://learn.adafruit.com/adafruit-circuit-playground-express/adafruit2-windows-driver-installation)
- ESP8266 ESP-12E CH340G
- Micro USB cable
- Remote charger or Battery
- Android smartphone (iPhone is also fine but won't have al features)
- Arduino IDE (https://www.arduino.cc/en/software)
- Blynk app for either Android or IOS (https//blynk.io)
- Integromat Web Services (https://www.integromat.com)
- Integromat app for Android or IOS (for Android please follow the instructions in the link)
Setting Up the Environment
*All download links can be found in the intro or the app store for phone apps
Arduino:
- Download and Install the Arduino IDE
- Download and Install the drivers for CPX board.
- Once Arduino is installed, add the following libraries to your environments (instructions on how to add new libraries on link):
- Adafruit Circuit Playground (CPX)
- Adafruit ESP8266
- Adafruit NeoPixel
- Blynk
- Create a new sketch with File -> New, and then save it.
Blynk:
- Download and Install the Blynk app via app store for IOS or Google Play store on Android.
- Sign up through the app with valid email you can access later on.
- Create a new project with the plus sign and choose "Arduino MKR1000" as your device.
- You will then receive an email with an authentication token for the project, save for later.
- To make the app go live tap on the "Play" icon in the top right and tap the "Stop" key to go back to edit mode.
- In edit mode, tap anywhere on the screen of the app to open the widgets menu, and add the following to your project (You may need to buy more "Energy" for all widgets):
- Button
- Eventor (Only for android at the moment :( )
- Webhook x 3
- Menu
- GPS Trigger
- We will configure all widgets later on.
Integromat:
- Sign up for Integromat services in the via the official website.
- We recommend you try and create a simple scenario to get familiar with platform (link).
- Download and Install the Integromat app via App store for IOS or the instructions in the link given in the intro for Android users.
- The reason not to download the app from Google Play store is because it offers a more restrictive version, unsuited for our needs.
- Sign in to you Integromat app via the credentials you got from the official site.
- The app will prompt you to configure your phone for further use, and via the settings, make sure the app can receive and send out Push notifications and GPS location.
In the next steps will go over each functionality, see how to set it up using Blynk and Integromat and have quick snippets of our code that you will get in full by the last step.
Morning Alarm (Android Only)
Every day, we wake up to an alarm of our choice. With the magic of IOT, the simple buzzer on our CPX and our ability to schedule events in Blynk we can create our own melodies and use them as music to help us wake up in the morning.
Blynk:
We will use the Eventor, Button and Menu widgets.
The Eventor will trigger our alarm a few time over 10 minutes to simulate the snooze.
The Button will be used to turn off our alarm once we woke up.
The Menu will be used to choose from a few different melodies as our alarm ringtone.
- Eventor
- In the Eventor, we will set 3 triggers (do more or less depending on you preference), each with 5 minutes apart from the other when the first starts at 7:50.
- Each event should write a value to virtual pin 5 (V5) that for our purpose is different from 0.
- Button
- Our button will always output the value 0 to V5.
- We will set it Push instead of Switch.
- Menu
- The menu will have 3 different option for our ringtones, numbered and named correctly.
- Each change in the menu will write to V7 the value of the item index in the menu and thus give us the ability to switch between the melodies.
Arduino:
First off, as part of our code you will see in the beginning the next 3 lines:
char auth[] = "[Blynk Auth]";
char ssid[] = "[SSID]";
char pass[] = "[PASS]";
Instead of [Blynk Auth] paste in the authentication you got via email for creating the Blynk project.
In the [SSID] and [PASS] write your home network's SSID and Password.
Alarm Related
- We will receive via V5 from the Eventor a value different from 0, which will cause our CPX board to start playing the current selected melody (when first uploading we will be formatted to the first melody).
- The melody is played note by note on a timer and won't interfere with background operations of the code.
- If we receive via V5 the value 0 from the button, the melody will stop playing.
- Receiving a value from V7 (the menu) will also stop the alarm and set the melody to a different one according to the value.
Collect Temperatures of the Room and Outside, As Well As the Rooms Light Value, Sending Out Recommendations Accordingly
Each morning before we get out of bed to start our daily routine we should always have a good feel for whatever we should wear and have enough light to help us up.
Using the CPX's accelerometer we will trigger to send information with recommendation for what to dress and if the room is too dark.
Integromat Website
- Create a new scenario.
- The first bubble (trigger) should be a custom webhook.
- We will configure the trigger by adding a new webhook a URL with 2 parameters.
- Connect the trigger to a router which connects to a Weather module which gets the current current weather in your living area.
- Connect the Weather module to an Android module that sends Push notifications.
- In the Android module select your device from the dropdown menu (it should appear after you signed in through the phone app).
- In the body of the notification add the parameters from the Webhook as well as the temprature collect from the Weather module.
Blynk:
- We will use the first Webhook widget (note we will be using the same Webhook for another functionality).
- In the Webhook widget we will set the output pin to V1 and set the URL to the one generated in step 3 of the Integromat setup, and setting the parameters to pin values received in indexes 0 and 1 (as shown).
- Set the method to post.
Arduino:
- We will set a double tap algorithm that will trigger whenever we tap our CPX on the table twice using it's accelerometer.
- Whenever our triggers sets the CPX will collect the light and temperature values in the room, generate helpful messages accordingly and send them out as to pin V1 for the Blynk app to trigger the webhook.
Receive a Notifications Regarding Upcoming Calendar Events With Push Notifications
We all have events planned in our calendar but we often forget about them until just before at best and after them at worst. By just clapping twice, our CPX will check for all new events coming up for the day and let us know in advance.
Integromat Website
- Create a new scenario
- The first bubble (trigger) should be a custom webhook.
- We add a new URL to the webhook with no parameters.
- Connect the Webhook a Google Calendar module that searches events.
- Connect the calendar module to your Gmail account, choose the desired calendar to search events on, and the start date to "now" using the date and time functions and the end time to now plus 12 hours. check the "Single Events" box.
- Connect the calendar module to a router that connects to 2 Android push notification modules and an HTTP Make a request module.
- On the router, for each connection to an Android module set a filter that checks if the number of events collected from the calendar module is equal to 0.
- If yes, set one module to sent out a notification that no new events where found.
- If no, set the other module to sent out a notification regarding how many new events were found today.
- In the HTTP settings, set the URL to: http://188.166.206.43/[Your Blynk auth token]/update/V8?value=[Number of events], where [Number of events] will the the "Total number of bundles" collected from the calendar module. This will send via Blynk the number of events found to pin V8 on the CPX.
Blynk:
- Use the second webhook and set the output pin to V9, and the URL to the from step 3 in the Integromat setup.
- Set the method to POST.
Arduino:
- We will set a double clap algorithm that will trigger whenever we clap our hands twice. The CPX will use it's microphone to detect a rise in the volume twice in a given time.
- Whenever the triggers sets, we will digital_write to pin V9 a value (doesn't matter) that will trigger via Blynk the webhook.
- We will receive via pin V8 the HTTP request from step 8 in the Integromat setup and color LEDs on our CPX according to the number of events gathered to signal another way of telling how many event we have today (in case our phone is far away).
Get Links to News Articles About Subjects of Choice Via Email.
Every morning we like open and the read the latest news articles. However, some of the more niche subjects that we love to read about often gets lost the heap and forgotten.
With a simple shake of our CPX we will get to our email all of the latest articles in whatever subject we choose and never have to miss a thing!
Integromat Website:
- Go to the scenario from step 3.
- Link the router to an RSS "Retrieve RSS feed items" module.
- Set filters on the links to the weather and RSS modules.
- The filter for the weather module should pass if the first parameter from the webhook is not equal to 1.
- The filter for the RSS module will pass if the first parameter is equal to 1.
- In the settings for the RSS module, set URL to an RSS feed from a news website of choice.
- Instructions on how get RSS feed URL from websites in the Link.
- Another way to find a URL is to search for it on google in regards to the desired website.
- We will use the URL for the digital section on ynet news website.
- Set the Date from section to "now" before 12 hours and the Date to section to be "now", so the articles gathered will be from the past 12 hours.
- Link the RSS module to an Email module of type "Send me an Email" that contains the Title of the article collected, the link to it and other parts collected from the RSS module you find relevant.
Blynk:
- We will use the webhook widget from step 3 so no further configurations required :).
Arduino:
- Our code will use an algorithm that will let our CPX detect whenever we shake it using it's accelerometer.
- Once our CPX detect it's been shaken it will write to Blynk on pin V1 the value 1 as the parameter checked in the Integromat part in part 3. It will also cause the Blynk to make the webhook POST request, triggering Integromat.
Send Out a Greeting Notification Via Sound, Light and Phone to House Residents Whenever You Return Home
After a day out working, studying or doing whatever that fulfills us, we come home and let pretense
Integromat Website:
- Create a new scenario
- note we can achieve the same results by adding another router to the scenario from step 3 and setting filters accordingly. This will be cost effective on the Blynk side and will allow you to stay within the limitation of 2 active scenarios on the Integromat free version.
- Create a Custom webhook module with a new webhook with no parameters.
- Link the trigger module to an Android module that sends push notifications.
- In the settings for the android module add a phone configured with the Integromat app and add a message about being home.
- You can now use a router to send out the same message to all phones configured.
- If you are using Android you can use the "Send text message" Android module to send SMS messages to recipients using their phone number, thus omitting the need to configure other phones with Integromat.
Blynk:
- Use the last webhook widget and put the URL of the webhook configured in Integromat and set the pin to V4.
- As mentioned, not necessary if you reuse the Integromat scenario from step 3.
- Configure he GPS trigger widget to be around and close to the location of your house (let Blynk use location services) and with a small radius.
- Set the "TRIGGER WHEN" to "ENTER".
- Set the output pin to V4.
Arduino:
- Whenever V4 is triggered, the CPX write to Blynk on the same pin a value of choice to trigger the webhook.
- It will also set the melody to 4th one (or another melody from the ones used before) and triggers it to play.
Code Files
I added below the main .ino file and the files required for the different melodies.
Hope you implementing our small helper as much as we enjoyed making it :)