Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13898
Lua rocks!
|
 |
« on: June 09, 2011, 01:32:30 am » |
This might seem trivial compared to some of the fancy things I have seen here (I'm still learning!) but it was fun. I got a spare Atmega328 chip, a spare 4-digit 7-segment display, a spare prototyping board, and a few miscellaneous parts, to make a fairly sophisticated alarm clock:  Full details, including the circuit and sketch are here: http://www.gammon.com.au/forum/?id=11165Basically it sounds an alarm at a designated time, every weekday (but not weekends), automatically dims at night, and can be converted to daylight saving time by just sliding a switch. The built-in clock chip with battery means it survives power outages. It has a simple voltage regulator circuit because it needs to be powered by a wall-plug, as the LEDs drain a battery pretty fast. By the time I finished I had used almost every pin on the processor. The sketch demonstrates: - Multiplexing an LED display
- Generating sounds by manually pulsing a speaker
- An interrupt for handling the Cancel button
- Talking to the DS1307 chip using I2C
- Handling common-anode or common-cathode LEDs
- Timed events (turning the alarm off after 15 minutes)
|
|
|
|
|
Logged
|
|
|
|
|
Arlington, MA, USA
Offline
Sr. Member
Karma: 0
Posts: 251
|
 |
« Reply #1 on: June 09, 2011, 07:33:05 am » |
Very nice! Just the sort of thing I wish I had the gumption to put together.
|
|
|
|
|
Logged
|
|
|
|
|
Port Elizabeth, South Africa
Offline
Full Member
Karma: 2
Posts: 165
Life's to short to be an adult!
|
 |
« Reply #2 on: June 09, 2011, 09:50:59 am » |
Thats a cool clock, much better than the standard one thats inside my Nokia E72 Navigator
|
|
|
|
|
Logged
|
"The really amazing thing is how many people are successful with their Arduino projects considering the fact that so many of them do not have a technical background. A lot of them seem to try, and succeed with, projects that no sane engineer would even attempt." - floresta commenting on the proper use of LCD displays
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5949
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #3 on: June 09, 2011, 11:50:37 am » |
Cool project. All done with wire wraps. I just started using wire wrapping and I love it. Just forgot one relay output on your board: to shenanigan. 
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 11
Arduino rocks
|
 |
« Reply #4 on: June 10, 2011, 08:42:41 am » |
Wow, Nick! That's terrific! I've got all those parts and I've been wanting to try a stand-alone project like this. Thanks for sharing.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13898
Lua rocks!
|
 |
« Reply #5 on: June 10, 2011, 05:22:25 pm » |
Thanks everyone! Just to cost it all: - 7-segment display: $4
- Atmega328: $6
- DS1307 breakout board from Adafruit: $18 (however similar one for $7.90 from Futurlec)
- Switches: $2 each approx
- LM7805: $5
- Buzzer: $1.50
- 16 MHz resonator: $0.80
Plus a few other small parts, the board, wires, etc. But the fun thing is, you probably have the parts lying around anyway. 
|
|
|
|
« Last Edit: June 10, 2011, 05:58:44 pm by Nick Gammon »
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 48
|
 |
« Reply #6 on: June 11, 2011, 08:21:38 pm » |
Excellent point to point wiring technique. Very nice and clean design.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 249
Posts: 16583
Available for Design & Build services
|
 |
« Reply #7 on: June 11, 2011, 09:07:54 pm » |
Wow, you guys get raped for material costs down under!
|
|
|
|
|
Logged
|
|
|
|
|
Grand Blanc, MI, USA
Offline
Faraday Member
Karma: 43
Posts: 2518
"We're a proud service of the Lost Electricity Reclamation Agency"
|
 |
« Reply #8 on: June 11, 2011, 10:29:55 pm » |
Nice job, Nick! I'm a clock fan myself. Still in the breadboard phase here but thinking towards something more permanent. I'm storing time zone offsets and DST adjustment rules in EEPROM, setting the RTC to UTC, and doing UTC-to-local conversion before sending the time to the display. Might save a couple bucks on the switch 
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 249
Posts: 16583
Available for Design & Build services
|
 |
« Reply #9 on: June 12, 2011, 12:03:42 am » |
I made different clocks back in college - transformer to get voltage down to a rectifiable voltage to make DC, dividing down the mains to make 1Hz. One design had 60 LEDs in an outer circle for minutes, 12 in an inner circle for hours. Learned about switch bounce on that one too. I still have the board for it, covered in dust in a box, chips pulled out for a later project. The mix of hardware/software that uCs bring to the table make things a lot easier to bring to completion without a big pile of chips.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13898
Lua rocks!
|
 |
« Reply #10 on: June 12, 2011, 01:13:50 am » |
Thanks for all the complimentary remarks everyone.  Wow, you guys get raped for material costs down under! Yes, I'm starting to feel that more and more. There are quite a few things which I can buy 10 of overseas for the price of one here. I'm storing time zone offsets and DST adjustment rules in EEPROM ... Well I was tempted, and of course it could be changed. However the government here keeps changing the rules. Something comes up like the Commonwealth Games, and they bring DST forwards or back a week or two. My ultimate goal would be a heap of clocks that keep reasonably good time, and then a GPS-based "central clock" that gets highly accurate time (eg. daily) and then updates all the other clocks with a radio transmission to them. And that central clock could keep track of daylight savings time as well.
|
|
|
|
|
Logged
|
|
|
|
|
New River, Arizona
Offline
God Member
Karma: 15
Posts: 876
Arduino rocks
|
 |
« Reply #11 on: June 12, 2011, 03:19:34 am » |
I was coordinating my house clocks using a NIS server until....it was down for several hours. I'm a bit of a nut about having the little machines monitor their own operation and reboot as necessary and when the NIS server went down, I lost my clock because it rebooted at the end of every retry interval. That prompted me to get a (relatively) cheap GPS module and take time from the satellites. That is working really, really well. In my case I provide the time from a single clock over my ethernet network and a XBee broadcast. That way I can sync devices based on either protocol. The little GPS module has a RTC in it too so I don't have to be as careful about reboots.
Your clock is a really cool device. Doing it from the ground up is impressive and fun. I would have made the cancel button about 100% larger though; my aim is bad in the morning.
|
|
|
|
|
Logged
|
|
|
|
|
Arlington, MA, USA
Offline
Sr. Member
Karma: 0
Posts: 251
|
 |
« Reply #12 on: June 12, 2011, 04:09:23 pm » |
My ultimate goal would be a heap of clocks that keep reasonably good time, and then a GPS-based "central clock" that gets highly accurate time (eg. daily) and then updates all the other clocks with a radio transmission to them. And that central clock could keep track of daylight savings time as well.
I have a similar goal: every clock in every appliance (and standalone, too) should be able to keep reasonable time on its own, but should be capable of "listening" (I was thinking power line comm, like X-10) for a reliable source clock. Then you'd need only one "master" clock in a house, although every standalone clock should be able to be a master. That would give everyone the flexibility to even have a cheap clock be the master, but they'd only have to set one clock at home. When DST changes, I have about 15 clocks that have to be touched. Aren't we living in the 21st century? For the experts here, what would you guess it would cost to add that bit of circuitry to an appliance -- essentially a minimalist X-10 listening circuit?
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 249
Posts: 16583
Available for Design & Build services
|
 |
« Reply #13 on: June 12, 2011, 04:42:36 pm » |
About $4.80. RLP434 from laipac.com or similar receiver if appliance is equipped to accept serial data with the new time. http://www.laipac.com/easy_434a_eng.htm
|
|
|
|
|
Logged
|
|
|
|
|
Arlington, MA, USA
Offline
Sr. Member
Karma: 0
Posts: 251
|
 |
« Reply #14 on: June 12, 2011, 08:56:32 pm » |
Cool, though I believe that's the wireless module that would go with Nick's idea. I was curious about an X-10 like power line comm. system. I just think that a standard for the receiver could be made and published, and implemented for short money (my un-educated guess would be less than $2 in the kinds of volumes manufacturers do) on each appliance, but the value add, esp. across an installed base, would be huge.
|
|
|
|
|
Logged
|
|
|
|
|
|