I'm a 7th grade "engineer" of sorts who is having a little bit of trouble with this one project. I'm using an Arudino Uno with the Relay Shield, and am trying to have it go on an alarm so when the alarm goes off, the relay shield communicates with some motors that are attached and buzzes the pillow to wake up the user at their desired time. Is there a library or some sort of code that I can use to program this alarm into the Uno and the Relay Shield? I've gotten the motors to buzz just by using some code I found somewhere through the Relay Shield, and really all I need is the alarm part of it, otherwise everything else is good.
Normally, you use a Real Time Clock module (RTC).
There are time functions built-into C/C++ so a clock module isn't required, but the oscillator on the Arduno isn't super-accurate, plus if you loose power you have to re-set the clock. (Most RTC modules have a battery built-in or a connection for a battery that just powers the RTC and lasts a long time.)
And, you need a way to set the clock. That usually means an LCD display and some buttons.
So the bad news is... All of this clock stuff is more complicated than what you've already done.
The next step* would be to get an LCD display and learn how to connect it and write to it.
Then add the RTC and learn how to read from it.
- If you don't feel you need a display you can use your computer to set the time and the alarm-time. In that case, you'll have to learn to send information from the computer to your Arduino (to set the clock, etc.). You can use the Serial Monitor to get information from the Arduino to the computer, so that's fairly easy.
Many years ago I make a "sunrise dimmer" (with a different microcontroller), that slowly turns-on a light in the morning, And, I made a special beeper to wake me "gently" after the light is fully-on. Now... I'm a real engineer but I cheated on the real-time cock! I've got an [u]X-10[/u] home automation system, so I just added an X-10 relay module and and I added a "wake-up" event to the X-10 timer controller.
DVDdoug:
Now... I'm a real engineer but I cheated on the real-time cock! I've got an [u]X-10[/u] home automation system, so I just added an X-10 relay module and and I added a "wake-up" event to the X-10 timer controller.
Snap (on the cheating part). I just wired up my Sunrise lamp from my existing alarm clock (built from a kit from several decades ago).
In fact, buying a super-cheap LCD alarm clock and modifying it (eg taking feed from the piezo buzzer input) may be simpler than all that RTC faffing around.