Contents
S.M.A.R.T. ALARM CLOCK
Setup for Meetings, Appointments, Reminders and Tasks (S.M.A.R.T.), this clock uses an Arduino Yn and your Google Calendar to automatically set alarms. And it looks cool too!
TONY DICOLA
ENGINEER
Wouldnt it be nice to have an Internet-connected alarm clock that automatically sets itself, based on your calendar? You would never miss an early appointment, never forget to set your alarm and enjoy more restful sleep knowing youve solved the nightmare of regulating your alarms. An internet-savvy alarm clock could even watch your inbox and wake you up if friends or family send you an important email.
This S.M.A.R.T. Alarm Clock uses the Arduino Yn, which is a special Arduino with two processors. One processor runs an embedded version of Linux and is connected to the internet over Wi-Fi or Ethernet. The other processor uses the same chip as the Arduino Leonardo microcontroller, allowing the Yn to work with most Arduino shields and accessories. By using the Arduino Yn, this project can talk to complex web services with the Linux processor and interface with hardwarean LCD touchscreenon the second processor.
The software for the S.M.A.R.T. Alarm Clock uses the Temboo service to communicate with calendar and mail utilities. Temboo is a platform for simplifying access to many web services, and it has great support for the Arduino Yn. To build this project, youll need to sign up for a free account on Temboos website.
Temboo uses what it calls choreos, which are code shortcuts for various Application Programming Interfaces, or APIs. In other words, it will help you work with online services that would otherwise be very time-consuming to code yourself. For example, you could parse Yahoo! Weather data, receive PayPal payment notifications or even submit free-form Wolfram Alpha queries. Hundreds of APIs from Amazon, NPR, Twitter, YouTube and others are available.
The S.M.A.R.T. Alarm Clock can easily be modified or extended to integrate with other APIs, but currently is designed to set alarms using Google Calendar and Gmail services. If you dont have a Google account, make sure to sign up before starting the project.
Build the S.M.A.R.T. Alarm Clock.
www.radioshack.com/DIT
PARTS
Arduino Yn microcontroller/computer board RadioShack 276-357
2.8" TFT Touch Shield, for Arduino RadioShack 277-070/276-382
USB speaker such as RadioShack 40-380
(Make sure your speaker receives both power and audio over USB.)
MicroSD Card such as RadioShack 55060858
(Any size card will work; at least 15MB of space is required.)
USB cable, Micro-B to Standard-A RadioShack 26-3260
AC adapter with USB, Enercell 5V/3.6A RadioShack 273-437
TOOLS
Computer with USB port, running Arduino IDE Version 1.5.6-r2 BETA free download from arduino.cc
Sign up for a free account at temboo.com. Go to the Account Applications page and retrieve your Account Name, Application Name and Key values. Save these values because they will be used in the configuration of the Arduino sketch. Follow the setup instructions on Temboos Google Calendar library to enable Temboo to access your calendar account. Enable Calendar API access for your Google account in the Google Developers Console. Create a new Client ID and choose the Web application type. Set the Authorized Redirect URI as provided by Temboos instructions.
Run the choreo called InitializeOAuth. Once run, visit the authorization URL in the output, accept the permissions and you should see a blank page. Run the FinalizeOAuth choreo using the Client ID and Client Secret values from the Google Developers Console and the Callback ID returned by the InitializeOAuth choreo. Run the GetCalendar choreo with the Client ID, Client Secret and Refresh Token values. Save this profile so the Arduino sketch can access the calendar credentials through a saved profile with a name like GoogleCalendar. Go to Temboos Gmail Inbox Feed choreo. Enter your Gmail account username and password, then run the choreo to check that it runs successfully. Save the profile for access to your Gmail account, just like you did for the Calendar account. Give this profile a name like GoogleMail.
Download my custom version of the TFT Arduino library. Using the Arduino IDE version 1.5.6, add this library by clicking Sketch Import Library Add Library. Also download and install the Touchscreen library. Connect the TFT Touch Shield to the Arduino Yn by inserting the header pins of the shield into the pins of the Arduino. (The shield wont sit completely flush, as the Ethernet port pushes it up slightly on one end. This is okay and should not affect the connections. Just make sure the shield is pushed into the Arduino as far as it will go.)
Follow your operating systems instructions to format the microSD card with a Yn-compatible file system such as FAT or EXT3/4. Power the Yn with a DC wall adapter and configure it to connect to your home wireless network. After you save the settings and the Yn reboots, it will be connected to your Wi-Fi network. With your computer connected to the same network, get the Yns IP address from the Arduino IDE under the Tools Port menu. Open your computers command line application and connect to the Yn via SSH. After logging in, execute the command opkg update && opkg install kmod-usb-audio madplay alsa-utils python-openssl to install the necessary dependencies. Plug the speakers USB connection into the Yns USB Host port.
Download the sketch for the S.M.A.R.T. Alarm Clock. Unzip the archive and open the sketch in the Arduino IDE. Toward the top of the sketch, adjust the #define values to match your Temboo account details. The ALARM_FILE value points to an MP3 to use for the alarm sound. If youd like to change the sound, put your own MP3 into the www subfolder and update the ALARM_FILE value. Upload the sketch to your Arduino Yn via Wi-Fi. If necessary, update the time zone in the web admin panel accessible at http://arduino.local.
To use the S.M.A.R.T. Alarm Clock, add an event to your Google Calendar for early the next morning. By default the alarm clock will only look at meetings before noon and set itself to go off one hour before the earliest meeting. You can change this behavior by adjusting the #define values ALARM_LATEST_HOUR and ALARM_BUFFER_MINS in the sketch. If the alarm goes off, press anywhere on the touchscreen to stop it. To test the email functionality, try sending yourself an email with the text WAKE UP in the subject. Now your S.M.A.R.T. Alarm Clock is fully configured and ready to wake you whenever its neededand let you get some sleep when its not.
FIRST Robotics Teams use ShopBots to Help Them Become Champions!