During this past winter break I decided to make a second alarm clock. You can read about the original intelligent alarm clock that a friend and I made for our Computer Interfacing class.
Jump to section:
The new clock as several new features and advantages:
Instead of having a 7-segment display for time and a 16x2 character display for the menu, I opted for a single 84x48px graphic LCD. This allows for a better menu system and custom fonts for displaying the time.
I had no problems with the PIR Motion Sensor used in the original clock except for it's size. It was simple and easy to use but the bulb stuck out quite a bit and wasn't very visually appealing. The Zilog ePIR Motion Sensor has a lot of features but I am using it in hardware interface mode. A pin goes low when it detects motion. The ePIR sensor gives a much cleaner signal, keeping it low for a couple of seconds instead of a constant change from high to low. Check out this YouTube video for a comparison of the two sensors.
In the original project, we had included a full Arduino UNO board in the box. For this project, however, I created a minimal Arduino compatible setup using the ATmega328 chip with an Arduino bootloader. This is not only much smaller, but also cheaper. The chip is only a few dollars!
Probably the biggest addition to the hardware is a RN-XV WiFly Module. This allows the clock to get the current time through the Network Time Protocol. In addition to getting the current time, the clock also uploads all sleep motion data to a web server for later viewing and analysis.
Here's my attempt at making a schematic using Fritzing. You can download the fritzing file at the bottom of this post.
The ATmega328 chip along with a 5v regulator and DC barrel jack connector for power setup on a protoboard. It could just be my poor soldering skills but working with this RadioShack protoboard was not a very good experience. On the underside of the board, the holes have copper around them. If I had to fix a joint, the copper would come off the board before my wires separated from each other!
This is how I planed the bottom layer of the assembly to look. There are still some parts missing, including the reset button, 3.3v regulator circuit and a small piezo buzzer for the alarm. The displaly, motion sensor, and input buttons will go on another board which will be stacked on top of this one.
The top board includes the display, motion sensor, and four input buttons.
This is what the finished device looks like! I later added the buzzer next to the reset button (empty space in top right of second picture) but the rest of the stuff is there. I also realized I mounted the LCD upside down and had to flip it over. All of the resistors used with the LCD are hidden underneath the screen. The two boards are held together with 1" standoffs except for the corner where the power plug goes. This was a huge oversight on my part because there was no easy way to secure that corner... and the buttons are there, too, causing the board to flex whenever I pushed a button. So as you can see in the top picture, I used two half inch standoffs to hold that part together. The standoff on the left rests on top of the barrel jack connector to provide some support. It actually works pretty well.
I ditched the Arduino IDE for Visual Studio for this project, using the VisualMicro plugin. Development is way easier; there's no comparison. I won't go into too much detail about the code in this post, but it's attached at the bottom so you can see it if you want. The code is straight forward and well documented.
Once the system powers up and initializes all of the components, it shows 12:00 Thursday, Jan 1, 1970. Network time is disabled by default. The menu system i have uses the left/right buttons for navigating between menu options and screens, and the up/down buttons for changing configuration values. The menu rolls around as well, so by going left from the main clock screen, you can go to the last page, which conveniently shows the current weather conditions.
Here's a rundown of each of the pages:
The clock continuously records data from the ePIR sensor and every hour, uploads it to my website where I can view a graph of the data for any date.
The biggest problem I had, and am still figuring out, is with the WiFly module. For one reason or another, it randomly crashes the entire system! That's unacceptable since it means your alarm may not go off. I haven't been able to pinpoint the problem but I am constantly trying new ideas and changing how the code works to see if I can stop it from happening.
I'm pretty happy with how everything turned out. I should have put some more thought into where I placed the components on the board to avoid the problem with the standoffs blocking the power jack. I'm also a little disappointed with how the WiFly module is performing but apart from that, everything works well. It was a really fun project and a great way to keep myself busy and learn new things over the break.