Make: Projects

S.M.A.R.T. Alarm Clock

Setup for Meetings, Appointments, Reminders, and Tasks, this clock uses an Arduino Yún and your Google Calendar to automatically set alarms. And it looks cool too!


 

Wouldn’t 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 you’ve 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 (Setup for Meetings, Appointments, Reminders, and Tasks) uses the Arduino Yún, 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 Yún to work with most Arduino shields and accessories. By using the Arduino Yún, this project can talk to complex web services with the Linux processor, and interface with hardware — an LCD touchscreen — on 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 Yún. To build this project you’ll need to sign up for a free account on Temboo’s website.

S.M.A.R.T. Alarm Clock currently works with Google’s Calendar and Gmail services. If you don’t have a Google account, make sure to sign up before starting the project.

In addition to those accounts, you need only an Arduino Yún with power adapter, microSD card, TFT touchscreen Arduino shield, and a USB speaker. The TFT shield will display the clock interface, while the USB speaker will play the alarm. Make sure to use a USB speaker that receives both power and audio over the USB connection, such as RadioShack #40-380. (some speakers send audio over a separate cable which won’t work with the Yún). The project software includes an annoying alarm clock sound that will jolt you awake, but you can substitute your own MP3 to wake up to something more pleasant.

If you’re new to the Yún, take a moment to read this guide and watch this setup video. You’ll want to make sure your Yún is connected to your wireless (or wired) network and has access to the internet before starting this project. Also, connect the microSD card to the Yún before it’s powered on, so it will mount the card as a root for storing the data used by this project.

1H1A5810

When you’re ready to get started, download the software, then follow the instructions below to build your S.M.A.R.T. Alarm Clock. The code for this project is a basic example of an internet-connected device that you can learn from and modify to build your own smart gadgets. If you have issues with the code or want to contribute, visit this Github page. Meanwhile, enjoy some quality sleep!

Steps

Step #1: Set up a Temboo account

PrevNext
S.M.A.R.T. Alarm Clock
  • Before you begin with any hardware, you'll need to sign up for a free account at https://temboo.com/. If you aren't familiar with Temboo, you can find a video overview of the platform at https://temboo.com/videos#intro.
  • Once you've signed up for an account, go to the Account→Applications page and retrieve your Account Name, Application Name, and Key values as shown here. Save these values because they will be used in the configuration of the Arduino sketch.
  • NOTE: You'll set up several accounts and logins for this project, so we recommend you use easy-to-remember credentials for all Temboo and Google steps — and open up a text editor or notebook to keep track of them.

Step #2: Set up Google Calendar access

PrevNext
S.M.A.R.T. Alarm ClockS.M.A.R.T. Alarm ClockS.M.A.R.T. Alarm ClockS.M.A.R.T. Alarm Clock
  • Follow the setup instructions on Temboo's Google Calendar library to enable Temboo to access your calendar account: https://temboo.com/library/Library/Google/Calendar/.
  • Enable Calendar API access for your Google account in the Google Developers Console: https://code.google.com/apis/console/. Confirm that the Calendar API status is ON (see image one).
  • Next create a new Client ID and choose the "Web application" type. Set the Authorized Redirect URI as provided by Temboo's instructions: https://{Your Temboo Account Name}.temboolive.com/callback/google Also set the Authorized JavaScript Origins to https://{Your Temboo Account Name}.temboolive.com Refer to the second image, but note that my Temboo account is "tdicola" and yours will differ. Once created, take note of the Client ID and Client Secret values on the result page.
  • NOTE: One step the Temboo instructions don't mention is that you need to set a Product Name value on the consent screen page of the Google Developers Console. You can set any value, such as "My App Name," like I set in the third picture above.
  • Run the "choreo" called InitializeOAuth at: https://www.temboo.com/library/Library/Google/OAuth/InitializeOAuth/. (Choreos are Temboo's code shortcuts for various API requests, SQL queries, and such.) Specify the Client ID value you found in the previous step, and input the value https://www.googleapis.com/auth/calendar for the Scope. Once run, visit the authorization URL in the output, accept the permissions, and you should see a blank page.
  • Finally, run the FinalizeOAuth choreo at: https://www.temboo.com/library/Library/Google/OAuth/FinalizeOAuth/. Specify the Client ID and Client Secret values from the Google Developers Console, and the Callback ID returned by the InitializeOAuth choreo. Once run, remember the Refresh Token value that is returned in the output.
  • To recap, make sure you have the following values from the steps above before you continue: Client ID, Client Secret, and Refresh Token.

Step #3: Save a Google Calendar profile

PrevNext
S.M.A.R.T. Alarm ClockS.M.A.R.T. Alarm ClockS.M.A.R.T. Alarm Clock
  • Make sure access to your Google Calendar account is working, and run the GetCalendar choreo on Temboo at https://live.temboo.com/library/Library/Google/Calendar/GetCalendar/. Fill in the Client ID, Client Secret, and Refresh Token values you gathered in the previous steps. For the Calendar ID value, specify your Google account name (typically your email address). See the image above with my example values.
  • The choreo should run successfully. If there are any errors, carefully follow the instructions in the previous steps to make sure you get the required Client ID, Client Secret, and Refresh Token values.
  • Click the Save Profile button and give the profile a name like "GoogleCalendar." Save this profile so the Arduino sketch can access the calendar credentials through the saved "GoogleCalendar" profile.

Step #4: Set up Gmail access

PrevNext
S.M.A.R.T. Alarm Clock
  • Gmail setup is simple. Go to the Gmail Inbox Feed choreo on Temboo at https://live.temboo.com/library/Library/Google/Gmail/InboxFeed. 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."
  • NOTE: If the choreo fails to run and you're sure your username and password are correct, try accessing your Google account's security page to check if Temboo's access has been inadvertently flagged as suspicious. Access this page at https://security.google.com/settings/security/activity and confirm the activity was from you. Wait a few minutes and run the Inbox Feed choreo again to verify it works.

Step #5: Install the TFT Arduino library

PrevNext
S.M.A.R.T. Alarm Clock

Step #6: Connect TFT shield to Arduino Yún

PrevNext
S.M.A.R.T. Alarm Clock
  • Connect the TFT Touch Shield to the Arduino Yún by inserting the header pins of the shield into the pins of the Arduino.
  • NOTE: The shield won't sit completely flush, as the Ethernet port pushes it up slightly on one end. This is OK and should not affect the connections, just make sure the shield is pushed into the Arduino as far as it will go.

Step #7: Format the SD card

PrevNext
S.M.A.R.T. Alarm Clock
  • The SD card must be formatted properly for the sound files to work. Follow the guide at playground.arduino.cc/Hardware/Yun#using_sd_card, particularly this instruction:
  • Create a folder on the microSD card called arduino/www starting from the root of the microSD card. This will let you upload your www folder when using wi-fi to upload.
  • In its factory setup, Yún supports the file systems FAT32 (including vFAT), EXT3/4, HFS(+), Reiser, Fuse, and NTFS. You can install additional packages for MSDOS, ISO, BtrFS, MinixFS, UDF, XFS, CiFS, NFS, and even AutoFS. FAT64 is not supported.
  • Windows should allow you to format a card in FAT32/vFAT/NTFS file systems by default (for vFAT it may say "Extended FAT," and this option may be missing in XP).
    Mac OS lets you use either HFS+ ("Mac OS Extended") or vFAT ("ExFAT"), but HFS+ cards can be quirky in Linux, so it's best to stick to one of the FAT file systems.
    Linux users should have little-to-no trouble formatting the card in any of the other fully supported file systems.

Step #8: Install Arduino Yún dependencies

PrevNext
S.M.A.R.T. Alarm Clock
  • Power up your Arduino Yún using the wall wart, and wait about 2 minutes for the Linux processor to finish booting. (All programming will be wireless, so we don't recommend plugging the Yún into your computer.)
  • When you boot the Yún, it will create its own wi-fi network. Open the Yún's web panel at arduino.local/ and configure it to connect to your home wi-fi network. The Yún will restart. Connect your laptop to your home wi-fi, open the Yun's web panel again at arduino.local/, and copy the IP address.
  • Now connect to the Yún using SSH so you can access its Linux command prompt. Follow the steps at http://arduino.cc/en/Tutorial/LinuxCLI if you need more information on connecting to the Yún over SSH. Be patient, this can take 25 seconds or more.
  • Once connected to the Yún, run the following command: opkg update && opkg install kmod-usb-audio madplay alsa-utils python-openssl
  • NOTE: The command should fit on one line. Any line breaks in the text formatting above should be ignored.

Step #9: Connect the speaker

PrevNext
S.M.A.R.T. Alarm Clock

Plug the speaker's USB connection into the Arduino Yún's USB Host port.

Step #10: Set up the S.M.A.R.T. Alarm Clock sketch

PrevNext
S.M.A.R.T. Alarm Clock
  • Download the sketch for the S.M.A.R.T. Alarm Clock from: https://github.com/tdicola/SmartAlarmClock/archive/master.zip.
  • 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. Set TEMBOO_ACCOUNT to your Temboo account name, TEMBOO_APP to your Temboo application name, TEMBOO_KEY to your Temboo application key, and CALENDAR_ID to your Google account name (same value used in testing the calendar choreo earlier). If you used different names, adjust CALENDAR_CREDENTIALS and GMAIL_CREDENTIALS to the credential profile name you saved on Temboo's site earlier.
  • Other #define configuration values don't need to be changed now, but take a look to see other adjustments you can later make to the sketch. In particular the ALARM_FILE value points to an MP3 to use for the alarm sound. If you'd like to change the sound, put your own MP3 into the www subfolder and update the ALARM_FILE value.

Step #11: Upload and run the sketch

PrevNext
S.M.A.R.T. Alarm Clock
  • Once the #define configuration values have been adjusted, upload the sketch to your Arduino Yún. Make sure to upload over wi-fi by selecting the "Arduino at (Arduino Yún)" port in the Arduino IDE. Don't use the USB cable/serial connection for the upload or else the required Python scripts will not be installed!
  • Once the sketch is uploaded (it can take about 5 minutes, so be patient) the TFT display should refresh with a clock image. The current time will be displayed as both a watch dial and numerical formats.
  • NOTE: You can set the time by adjusting the time on the Arduino Yún at its web admin panel (typically accessed at http://arduino.local/).

Step #12: Using the alarm

PrevNext
S.M.A.R.T. Alarm Clock
  • To test that the alarm sets itself based on calendar appointments, 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.
  • After adding the event, press the REFRESH button on the clock. The clock should update to show the alarm in the upper right corner. The clock will check your calendar every two hours and set itself appropriately (this can also be changed in the #define configuration).
  • If an alarm is enabled but you'd like to disable it, press the CANCEL button. This will remove the alarm and stop checking for new alarms for the next 24 hours (or until you press REFRESH).
  • If the alarm goes off, press anywhere on the touchscreen to stop it.
  • NOTE: When you restart the Arduino Yún, the time might be displayed incorrectly, since the Yún needs to connect to the internet to get the current time. Press the REFRESH button to force the time to be refreshed a few minutes after the Arduino Yún finishes booting.

Step #13: Using the wake-up e-mail

PrevNext
S.M.A.R.T. Alarm Clock
  • The Yún will periodically check your Gmail account for unread messages that contain "WAKE UP" in the Subject line. This allows family or friends to wake you up in case there's an issue that needs your immediate attention.
  • To test this functionality, try sending yourself an email with the text "WAKE UP" in the subject. (This keyword is case-sensitive and should be in all capitals.) Press the REFRESH button to force the clock to check for new messages. The alarm should sound! (Press anywhere on the touchscreen to stop the alarm)
  • By default the clock will check for wake-up messages once every two hours. You can change this frequency with the ALARM_KEYWORD_MINS #define value in the sketch.
  • NOTE: Each mail check will cause a choreo to execute, and your free Temboo account allows 1,000 choreo executions per month.
  • You can also change the keyword used for wake-up mails by changing the GMAIL_ALARM_KEYWORD #define value. Remember this value is case-sensitive!
  • Now your S.M.A.R.T. Alarm Clock is fully configured and ready to wake you whenever it's needed — and let you get some sleep when it's not.
Tony DiCola

Tony DiCola

Tony DiCola is an engineer who works at Adafruit Industries and has a passion for making things that use Arduino, Raspberry Pi, and other embedded platforms.


  • YellowCoin

    I want make this but was wondering if the tft v2 from seeed works? I am sure I most likely need to change the code around to work with it.

  • sherrie g

    Tony: Any recommendations for 1) customizing it so the TFT shield fits flush, and, 2) creating/obtaining an enclosure/case for the unit once completed? Thanks!

  • YellowCoin

    sherrie g

    1) To make the TFT shield sit flush you will need header extenders obtainable at adafruit or ebay.
    2) You can buy a case for the Yun on ebay or amazon which has holes that let you put everything together.

    • sherrie g

      Thanks, YellowCoin.

  • Simon

    Hi Tony. I’m a complete noob with all things Arduino, APIs, have almost no programming experience, etc, etc… I picked this project to get started with Arduino and bought my first 2 boards (an Uno and a Yun) to play around with.

    I followed all the steps up to the OAuth authorization, and get this back from Google:
    —————————–
    400. That’s an error.

    Error: redirect_uri_mismatch

    Application: SimonGoogAPITest

    You can email the developer of this application at:[censored]@gmail.com

    The redirect URI in the request: https://jude999.temboolive.com/callback/google did not match a registered redirect URI

    ——————————–

    What did I do wrong?

    • Simon

      Fixed .Went through the steps again and had forgotten an “s” in https…

  • Simon

    Hi Tony, me again. All good until this step 11. I don’t see my Yun in the ports when connected to the wall power. If connected to the computer via USB is shows in t Arduino IDE (had to lay around with drivers for a while to make it work). My Yun shows in Bonjour Browser and I can connect to the setting page on arduino.local, so it’s there.

    In my device manager I have an unknown device, but not sure it’s that, It won’t recognize a driver when I point the device to the driver in the Arduino folder.

    I read things around: I opened port UDP 5353, no firewall (except for Windows) on this computer, running Win7.

    I am determined to make it work, any advice would be appreciated. Thanks!

    • YellowCoin

      did you set up your YUN for wireless? If you did IDE should show it when you select the ports.

      • Simon

        Yes it is all set up, I can access it on the network, I did the firmware update wirelessly, I see it in Bonjour and have accessed it via ssh and putty on the network. So it is there and it works.

        When I open ports on IDE, all I see is a “COM3″ option. I tried it just in case but does not work. No “Arduino at Arduino Yun” option as indicated…

        • YellowCoin

          try the new beta version of IDE. You should be able to see the yun via IP as a port on the list. There shouldn’t be any additional software you need to install. Unless that is you’re using the micro usb port to see the yun. Worse case you can try the NIC port on the Yun.

          Another thing you can try is make sure the YUN is boot up completely before you open IDE sometimes IDE doesn’t refresh the port list.

          • Simon

            I am using the beta, downloaded 2 days ago (unless there is a new one since?). It works fine when connecting to micro USB (but the instructions of the project say specifically to upload the sketch wirelessely).

            My only issue is the IDE to Yun via wifi. Everything else works…

            I have disconnected/reconnected probably 50 times by now, making sure the yun boots completely before I launch IDE.

            I’ll try with my wife’s Mac tonight, see if that works, but even if it does, I will have to find a way to make it work on my Windows machine.

          • YellowCoin

            FYI You can program it through the wired NIC connection as it doesn’t necessary need to be wireless. You can’t use USB because I think the WWW folder won’t be copied over correctly. This project has it’s own quirks for me as I wasn’t able to get the old TFT model listed on the instructions. I had to deal with the newer V2 model and did a bunch of reprogramming of the code.

          • Simon

            Thanks for the tip, I’ll try that.

            I think I have the TFT v2 model too. I just bought it directly from Seeed in China (I live in China). Reprogramming the code might be beyond my current capabilities…

          • YellowCoin

            it’s not that hard to do. You just need to compare the V2 files with the V1 provided by the tutorial. You will need to copy some of the functions that was added by frankie chu for screen direction. If you have any problems just let me know and i’ll try the best to my ability.

          • Simon

            Thanks, I’ll probably need help when I get to that part, but I ran into another problem:

            So I tried with my wife Mac, and I see my Yun in the ports, however, evertime I try to upload the sketch, I get prompted for my password, then it starts uploading, but very fast i get a message saying “Double check connections and try again, or use -F to override this check”. What’s wrong? Tried many times.

            Figured out I didn’t have a network cable lying around at home so could not try wired NIC connection. I’ll try that tonight too.

            Also don;t really get why i don;t see my Yun in ports on Win7 but do on the Mac.

          • YellowCoin

            I am on the mac too. For the avrdude error try uploading it without the LCD connected. I found with the V2 it freaks out whenever the LCD is connected while you do the upload. Upload first then connect LCD.

          • Simon

            OK. Uploaded the sketch, disconnected the LCD and that did the trick. Thanks!

            I still have a blank/white screen though, I suspect that is because I have the V2. Any help to get it to work will be appreciated.

            YellowCoin, I’ll need the name of your local pub so I can put a couple beers on a tab there!

          • YellowCoin

            https://github.com/yellowcoin

            You can get the download for my version of the files here for the SEEED v2 TFT Touch. Make sure you [download zip] after you click on each sub link. Download button should be on the right side.

            I am from New York so not sure if you can get me a beer from china haha. If you like you can send me some Donations via bitcoin at this address 15kFAbgWsSM28N7x5ZbWAehABkGnp9dPPT

          • Simon

            Houston… (Edit, Houston can go back to sleep. issue fixed)

            Downloaded your files (Thanks!), however:
            Sorry for the length of this, and please excuse my noobiness… I am really new to Arduino… Did I do something wrong?

            Arduino: 1.5.7 (Windows 7), Board: “Arduino Yún”

            C:UsersSimonDocumentsArduinolibrariesTFT_Touch_Shield_V2-masterTFTv2.cpp: blah blah blah…

            Cut the 100 lines long list of errors, because I fixed them.

            I was reading through the errors and figured our it looks like quite a few “;” and “)” were missing at the end of sentences. I added them where the errors pointed me to and, to my huge surprise, I now have a working clock!!!

            Trying to figure out how to share the file (TFTv2.cpp) on github, I just created an account there so fresh noob again.

          • YellowCoin

            Sorry about that I was cleaning up the code via github at work and didn’t notice it deleted the ; marks when I was fixing the comments. I triple check it and made the corrections.

            Flip side you got your hands dirty with coding haha!

          • Simon

            We are up and running. I edited the file that had errors with the corrected version on github here: https://github.com/jude999/TFT_Touch_Shield_V2 (hope it’s fine, it’s the file that worked for me)

            A million thanks to YellowCoin for the help! 3 beers on me when i’m in NY (bound to happen, and I keep track of beers I owe), I have learnt a lot from this project already.

          • YellowCoin

            NICE! Glad to see everything is working out for you. There is a bunch of settings you can change on the smart alarm INO file. If you want to see if your alarm works with google you can set the #define ALARM_LATEST_HOUR to 24. That setting is used in case you do not want the alarm to go off after a certain time.

            Eventually I will change my version of it to remove the clock and make it straight up numeric. It will be later in the future hopefully.

            Cheers and beers!!!

          • Simon

            Yeah, I chose that project because I want to play around with a connected clock. End goal would be to have an alarm clock that shows key notifications from my phone or the internet next to my bed, but can leave my phone/pad far from my bed… So I can focus on sleeping when in bed.

            I don’t have a USB speaker lying around so for now it’s not making any sound. I’ll try to play around with code to learn first, then see if I can make it show other things (weather first maybe). I’d like to switch the screen for e paper too, or something that lights up when my hand gets close. The LCD is a bit too bright for bedroom. Anyway, jumping ahead of my capabilities, but it gives me goals to learn.

  • Guest

    @disqus_GQ0X9RPpAg:disqus did you set up your YUN for wireless? If you did IDE should show it when you select the ports.

  • Thomas Johnson

    anyone encounter the red L13 constant light?
    Everything else is working fine on the board itself. WIFI, SSH, SD mounting.
    I checked the sd card and it has the file structure and what looks like the sketch uploaded. I have rebooted with the card in and without, and with the tft and without and the same thing shows. THe sketch never loads into the screen so Im stuck. Help ??

    • Simon

      I have it constant on, but is it an issue? Looks like it is on in the video too…

      • Simon

        Edit: can’t ltell from the video, looks on in the picture above though.

    • YellowCoin

      You tired updating YUN to 1.3?

      • Shawn

        How do you know what yun version you are using? Where would I look to see? Also, I am using the TFT from the directions. Is there another version I should download?

      • Shawn

        Figured it out. updated to the latest version of the yun. still just get a white screen.

    • Guest

      did you tried updating to 1.3?

    • Thomas Johnson

      Well, I have been playing around with this for a few days now and I can get no results. Im not even close. Its funny but the google and Temboo part was the easiest. In a Nut shell I have tried loading this sketch on Windows with a windows format of the sd card, Ive tried it on mac with various IDE and mac format and it fails consistently. Ive checked everything in the advanced config of the Yun over my wifi yet when I load a sketch I get fails. Is there anyone out there who has made this work?

      • YellowCoin

        which version of the TFT you are using?

      • Simon

        I made mine work, and it is my very first experience building anything remotely close to electronics, let alone arduino. I am actually going through tutorials now. So it is doable. Yellow Coin helped me a lot as you can see from the other comments.

        What version of the TFT are you using, and where did you get your sketch from? I am using the seeed v2 and it didn’t work with the original sketch because it was made for v1. So I used the one YellowCoin made, linked further down in the comments (it needed some fixes, but I believe he fixed it already).

        To format my SD card, i used this: http://arduino.cc/en/Tutorial/ExpandingYunDiskSpace, it takes care of the formatting. Not sure if that would help you.

  • Boda

    I’m going to try and make this. Two quick questions: can you easily configure the alarm for snooze? Maybe make it set the alarm for every event before noon, not just the first one? Second, what size TFT touchscreen should I be buying? 2.8″? Thanks in advance!

  • Lucas

    Hi I made this project and have gotten the touch screen working.

    Where I am struggling I believe is getting files onto the SD card. I can compile the sketch and upload over WiFi, but it seems to end much faster than specified in the steps, and I get a “Warning: problem accessing board folder /www/sd”

    I have formatted the card to FAT16 and FAT32, and both times saved a folder arduino/www there.

    Is this not the correct folder name? I also have never seen my mac recognize the sd card through the Yun, but am not sure if I checked correctly. I used the disk utility and found nothing, but it shows up in my card reader.

    Any help would be great! Seems like such a cool project.

  • Lucas

    Hi there,

    So I went through this project and was able to get the touch screen working, but I don’t have any communication with any Google services. I uploaded over WiFi, but when I get a warning message saying there was ano issue with the /www/ directory. I’m not able to view the card from the arduino Yun, but I put it into a card reader and the arduino/www folder I created is empty.

    Does a gone. Have any ideas what I might be doing wrong? This is my first arduino project so i am still getting my bearings with it. I’d really appreciate any help though!

    • Lucas

      Sorry for the double post… the first I one didn’t show up originally.

  • DaveC

    Did no one else notice that 12:15 in the afternoon is displayed as 12:15AM and 12:15 in after midnight displays as 12:15pm?

    Small fix

    // Convert from hour (24 hour format) and minute to minutes in day.
    int time_to_minutes(int hour24, int minute) {
    return hour24*60+minute;
    }

    // Convert from minutes in day to hour (12 hour format), minute, and AM/PM.
    int time_to_hour_minute(int time, int& hour12, int& minute, bool& am) {
    hour12 = time / 60;
    minute = time % 60;
    am = true;
    if (hour12 > 12) {
    hour12 -= 12;
    am = false;
    } else if (hour12 == 12 && minute > 0) {
    am = false;
    } else if (hour12 == 0) {
    hour12 = 12;
    am = true;
    }
    }

  • Ron G

    I don’t think I will be attempting this one, since all I see in comments are people who can’t get it to work. That, to me, means inadequate documentation and vague incomplete instructions. From looking this over, there seem to be many of the details needed missing or glossed over with general statements.
    Pass.

  • Josiah Stiffler

    Is there a way that I can make the Ethernet wireless..so I don’t have to run a Ethernet cable through my bedroom floor

  • Stephen Mann

    The clock works and gets the time from the internet when I refresh, but the alarm part doesn’t work. I’ve gone through the instructions three times but always the same results. Looking at the sketch, I see where the python program for getting the alarm data is supposed to be at “/mnt/sda1/arduino/www/SmartAlarmClock/find_alarm.py”. However I connected with PUTTY and do not see any files or folders in “/mnt/sda1/arduino/www/”. How are the python files created and how do I get them into the folder?

    • DaveC

      They should be a a folder named “www’ in the same folder as your SmartAlarmClock.ino sketch. when you upload the sketch they should be uploaded with it.

      • Stephen Mann

        Thanks – found my error. I made a copy of the original sketch to experiment with, but I did not copy the www folder to the new sketch folder.

        Looks like it’s working now.

        New question – I want to learn more, but I cannot find the references to any of the libraries used in this project. Tips would be appreciated.

        Thanks again

        • DaveC

          Can you be more specific?

          • Aarushi Dham

            I am having the same error but not with python code. The clock image works but the alarm does not. What is even sopposed to be in the www folder?

          • DaveC

            When you say “the clock image works”, does the “Alarm” text display but the alarm never sounds or does the alarm text not display?
            Somewhere in the text of this article it says the time of the event has to be early in the day.
            I don’t remember what time it said.
            If you SSH to the YUN you can run the python script and see if it’s returning what you’d expect.

            Try this:

            SHH to YUN
            #cd /mnt/sda1/arduino/www/SmartAlarmClock
            #python find_alarm.py TEMBOO_ACCOUNT TEMBOO_APP TEMBOO_KEY CALENDAR_CREDENTIALS CALENDAR_ID | hexdump

            Of course replacing what you put in the Arduino script for #define TEMBOO_ACCOUNT etc.
            The last bit “| hexdump” will let you see the output if it works because the output of the python script is in binary.
            You should see something like this:

            0000000 091e 0a00
            0000003

            The 091e in this case means 9:30am (09=9 1e=30).
            Otherwise you’ll see a bunch of text trying to tell you what went wrong.

          • DaveC

            www should contain:

            dateutil
            temboo
            temboo_new
            159,141 Annoying_Alarm_Clock.mp3
            2,269 check_email.py
            2,496 find_alarm.py

      • Pellumb

        how?

      • Pellumb

        how are they uploaded with it??? you can manually upload them but you need explain what you trying to say above “when you upload the sketch they should be uploaded with it.”

  • http://wwwimagedigm.com Shams S

    Total noob here, have done some minor programming in the past. SMART clocks looks great, I want to build this with my son. Do you know what I would change to have it report, say the weather, such as how to use the NOAA choreo? Want to try this, since my kiddo can’t get a gmail account…

  • Carlos Qualls

    Could the Arduino YUN be replaced with a Raspberry Pi?

  • Rony Macarone

    been working on this project for several days… got all components working. NEVER got this ‘smart’ clock to work in any way… just a white screen

    • Shawn

      I just get a white screen also

      • Rony Macarone

        Still have not got it to work either… no help from author or here.

        • Shawn

          I got it to work by using the files located at: https://github.com/yellowcoin

          The white screen comes up but then give it time and it will refresh with the clock.

          • Rony Macarone

            Thnaks.. Ill try that!

          • Rony Macarone

            DONE and it’s working now! Thanks for the help…

          • Shawn

            Glad you got it working!

          • Pellumb

            you are glad! and you say you took files from yellowcoin but you are not consistent as at the beginning you said you made an arduino folder….how did you upload the www folder to the YUN??? Is it working at all??

          • Pellumb

            what is working??? the alarm & cancel not showing on the screen yet. It means that is not working. thx

  • brandon$1010

    I built the clock about two months ago and have played with it since then. I have followed all of your instructions according to the web site exactly as I understood them. I have been on countless forums from GETHUB, to ARDUINO, to YOUTUBE.

    Here’s the basics.

    The alarm clock shows the clock.
    It refreshes the time when touched on the touch screen and the time is correct.
    I can see the alarm clock ip address when I select it in my arduino ports menu.
    There is no problem uploading the code.

    The problem is…
    The clock will not update according to my google calender.
    The clock will not sound an alarm when I send it the WAKE UP. email with the WAKE UP headder.
    I double checked all of the settings on my Temboo account including double checking all my #’s.

    I contacted Temboo. Their stumpped. All they told me was to, “rewrite the code on Temboo and upload it to my Arduino from there,” or “modify the code to use Terminal” I believe the way I read your code it already does that.

    I’ve double checked my router, computer, and network firewall settings.

    I just cant make it work.

    Any help would be appreciated.

    Brandon.

    • SD

      Brandon – I’ve the same issue where I cannot sync the clock to Google Calendar. Were you able to resolve your issue?

      Thanks for the help!

    • Gordon

      did you ever find out how to get it to talk with your google calenders? I’m having the same issue you had. I need this to work, its part of a final project i need to graduate. thx

  • MoralRight

    This is what I needed today. Volume on cell was way down got a call last night and this morning for a project install. They cancled it, costing me 100.00 out of a 450 dollar project. The problem I have with this project…where is the shell ?? one jolt of the table and this thing hit the floor in pieces.
    2. It needs a battery for backups!!
    3. Can it do a fetch of dates, in the event the internet is lost?

  • Shawn

    How do you format the SD card and create a folder called www? where do you go to do this at?

    • Khalid

      I am stuck at that part too. I connected the TFT Shield to the Yun, and inserted the SD card. I powered it up but it shows a blank screen.

  • Khalid

    Im having problems on the InitializeOAuth step. I put the info in and when i click run i get the AuthorizationURL and CallbackID. When i go to the link for the AuthorizationURL to accept it, it gives me a page that starts with 400. That’s an error.
    Any help would be appreciated!!

  • Khalid

    Im stuck on step 5. I got the Arduino IDE Version 1.5.6-r2 BETA. Now, do i just download the TFT library fork, go onto the IDE version i got, and import the library? Also i’ve downloaded the touchscreen library but how do i install it?

    • Shawn

      to install the library go to… Sketch, Import Library, Add Library then tell it where the folder you saved is at.

      • Khalid

        Thanks for the reply. Alright so i downloaded the file and then did as you said and imported the file. Is there anything else i need to do for that step?
        Also have you figured out how to format the SD card?

        • Shawn

          You are good there. I stuck the sd card in my computer and created the folders. Have not figured out how to do it using the Yun yet. Right now I have everything done except it just goes to a white screen :(

          • Khalid

            Is there just one file that you are supposed to make? I tried making the arduino/www file but when i try to it says it cannot contain the “/” key.

          • Shawn

            I made a folder called arduino, then inside that folder made another one called www. Did you figure out how to do it with the yun? I just popped the sd card into my computer and made those folders, then took it out and put it back in the yun.

          • Khalid

            Ahh ok. Nope not yet, i’ve been looking for a way to do that all day. I’ll keep you posted though!

          • Shawn

            I have been messing with this all day with no luck. I still just get the white screen.

          • Shawn

            I got it to work finally!

          • YellowCoin

            The Yun has this weirdness to it at times. Sometimes it acts in a way where it won’t load up the code. When i first started this project there were countless hard resets i had to do. What I found that works for me is don’t attach anything to the Yun, upload the code first, then attach the screen (tft v2 in my case) to the Yun. Sometimes you may need to turn up the refresh rate of the code so it draws the clock faster.

            FYI the newest version of Yun firmware is 1.5.3 so maybe that will help with the weird bugs.

            Just my 2 Cents…

  • Shawn

    I got it to work. I used the files from https://github.com/yellowcoin and that worked. I just have to fix the clock time now.

    • Shawn

      time fixed itself once I hit refresh

  • http://www.omnuino.com/ JethroNull

    Nice! Maybe we should join forces: http://goo.gl/TFuaDL

  • Aarushi Dham

    What files are supposed to be in the www folder???

    • DaveC

      dateutil
      temboo
      temboo_new
      159,141 Annoying_Alarm_Clock.mp3
      2,269 check_email.py
      2,496 find_alarm.py

      • Pellumb

        DaveC? Please come up with clear easy steps as how to upload the www folder together with SmartAlarmClock (arduino sketch) as everyone is hitting the wall with this and the ALARM & CANCEL is not showing on the screen!! nothing is syncing. Thanks in advance

        • DaveC

          You should have a folder named www in the same folder as your sketch. The upload routine in the Arduino development environment knows to upload the folder with the sketch. If your www folder is in the right place you don’t have to do anything special, it will be uploaded for you.

  • Michael

    Am I able to use another arduino board than yun?

    • Eric Stacy

      Don’t know, but going to give it a go with a Uno this weekend.

      • Michael

        Remember to share the result :)

    • DaveC

      This question comes up a lot. The Yun is two devices on one board. Its an embedded Linux machine with an Arduino uno. The Linux part runs the Python code and the Uno part runs the Arduino code (the display part). So if you wanted to run this on another board, say the Raspberry Pi, It would run the python code, but you’d have to interface the display (which is possible) and rewrite the Arduino code. If you wanted to run it another Arduino board you would have to add a network shield and rewrite the python code in C.

  • La Kuana

    I am a n00bs to coding. I am planning on buying a Rasberry pi 2. Will this SMART Alarm clock work on the Rasberry board as well?

  • Logan Sessions

    About how much this project cost?

    • DaveC

      The Yun is $75 and the display is $40

  • Gordon

    Can I do this project with the Arduino Mega 2560 and the Wifi Shield? I am hoping to use the Arduino board for more than just the clock and it seems the TFT shield uses all the pins, making what I have in mind impossible with the Yun.

  • shawn

    I can no longer see the directions to this project

    • DIYer

      I can’t see the instruction either!!!! I saw it 2 days ago……

  • Pellumb

    How to upload WWW folder to Arduino YUN???

  • Khalid

    anyone still active on comments that has successfully finished this project?!

    • DaveC

      Yes

      • Khalid

        Sweet! Could I get some help?!

        • DaveC

          Sure, ask a question.

          • Eric Burns-White

            I’m not Khalid, but I’ll gladly ask for help.

            I’ve got the system fully set up, but when I try to upload the sketch, I get avrdude errors and “content type mismatches.” This is when I can get the Yun to show up as a Port over WiFi in the first place.

            For the record, what Programmer should we be using? And is there any way we can just upload this through USB instead?

          • DaveC

            I’ve never tried to use the USB to program my YUN. So I’m not sure if it would work correctly. I’m using Arduino IDE 1.6.0, Had some trouble with the later versions crashing.

          • DaveC

            I’ve now tried programming via the USB port. Seems to work fine.

          • Khalid

            Thanks Dave. So I don’t fully understand step #5. From what I understand is that I need to install the TFT library from the link under the first bullet point, then go to sketch-import library-add library. Then I download and install the touchscreen library from the link under the 3rd bullet point. Please correct me if i misinterpreted anything wrong! Thanks in advance.

          • DaveC

            Sounds correct. Which touch shield do you have? There’s one with an SD card reader on it and one without. (Easiest way to tell) You what the one without. I’m not sure if the one with will work with the V1 library, You may need the V2 library. If you have the one with the SD card reader on it let me and I’ll set one up and see if I can get it working.

          • Khalid

            I believe i got the one with the SD card reader. I bought the same, exact parts listed above from radioshack.

          • DaveC

            I believe RadioShack has sold both shields under the same part number(?) Try running the example programs. (File->Example->TFT_Touch_Shield_V1->Text) If that doesn’t display text on the screen, then download the V2 library at https://github.com/Seeed-Studio/Touch_Screen_Driver and try the same example. If the V2 works then you would need to modify the clock code to use the V2 library. btw, I pulled out another YUN and tried both V1 & V2 displays, my working clock code does not work with V2. The example programs work with both V1 & V2. I looked at the libraries but only as far as seeing that some of the methods have different names.

          • DaveC

            So I’ve download the V2 library and have it working with the V2 board and my clock code. At least the display part. The library doesn’t support the text orientation function so I had to modify the library. I’ve not yet fixed the touch part of the library code, that has to happen before the buttons will work correctly. If anyone shows interested in the using the V2 board I’ll post the code when I finish it.

  • freezingzz

    Why not try this new UART TFT LCD, it support the WYSIWYG editor to build your UI in PC and download it via USB. It can be control by Arduino via UART, so just use the Serial.print() you can make it display many images. And do’t worry about the font ! You can build it yourself and download to the TFT LCD.

    Its indigogo page here with detailed in introduce:Amazing price!! 10USD 2.4″ with free shipping…..

    https://www.indiegogo.com/projects/nextion-a-cost-effective-high-performance-tft-hmi/x/4283045#home

    Here is 2 blogs about using the Arduino to build the UI tutorial:

    http://blog.iteadstudio.com/product-preview-nextion-in-an-arduino-project-3/

    http://blog.iteadstudio.com/product-preview-nextion-in-an-arduino-project-2/