Archive for the 'Alarm Clock V3' Category

Alarm Clock V3 UPDATE (1/2/13) – FINAL

The alarm is finished and functional! I have not been able to update as frequently as I would have liked so this will be an overview of what the design is now, some changes that I had made from the last update, and (of course) what I plan to do for the next version.

The Current System The alarm on the iPod or phone goes off silently with only lights going off. This is the primary alarm, or PA (contrasted with the secondary alarm, or SA, which is the Arduino). The PA is resting on the top of the box, which contains an Arduino Uno and a circuit board. Also included is a photoresistor, which has its head sitting flush with the box. A photoresistor is an electrical component whose resistance varies with how much light it gets. When the alarm goes off, the Arduino can sense it by the difference in the resistance given by the photoresistor. When this happens, the SA begins its work. For the rest of the SA’s sequence, it will ignore the PA completely.

The first thing the SA does is to slowly increase the brightness of two white LEDs mounted into a sleeping mask worn by the user. These LEDs are mounted over the eyes, making sure the user gets all the light and none is expelled to the room. The LEDs are mounted in soft foam and the entire mask is made from a thin fabric that fits over the user’s head, keeping it in place over night. The mask is connected to the SA with a flexible wire that leave out of the top of the mask to the SA, which is placed behind the user. This makes sure the cord cannot be accidentally wrapped around the user’s neck.

After the LEDs are at full brightness (about five minutes), they begin to blink slowly. The idea here is that the fading on is a gradual transition for the brain from sleep to wakefulness. Since the brain will most likely not completely wake up from the fading, the blinking then begins to transition the brain from being “half asleep” to fully awake. This blinking continues until one of three things happen.

The first thing that can happen is the off button on the SA can be pressed, resetting the program. The SA can now be activated by the PA once again.

The second thing that can happen is the SA’s snooze button can be pressed. This causes the blinking to stop momentarily, after which the SA will blink once for every time the snooze button has been pressed. The pause in blinking is so the user can differentiate between the blinking to wake the user up and the blinking showing how many times the snooze button has been pressed. This second blinking gives the user some indication of how long it has been since the alarm has gone off.

The third and final thing that can happen is mainly there for Sabbath observers, although it is also useful if you’re afraid the alarm will go off by accident while you’re away and can’t turn it off. Because the alarm cannot be turned off on the Sabbath, the SA is programmed so that if it has been blinking for 10 minutes, it automatically resets, just as if the off button had been pressed. The assumption is that if it wasn’t the Sabbath and the user just hasn’t woken up after 10 minute of a light blinking in their face, they’re not going to wake up if it continues either.

Improvements There are many improvements I plan to make to this design. However, these will be improvements to the current design, and not a new design in itself, making this future version V3.2.

Changes to physical design:

  1. For safety reasons, I plan to make the cord connecting the mask to the SA built so that if it’s pulled, it will come out of the mask as an extra precaution against choking. However, I am trying to think of different ways this problem can be avoided, as this method can also cause the alarm to be disconnected for other reasons, like it getting caught on the bed.
  2. The base of the SA, now a cardboard box, will be built into a more permanent structure, probably either wood or plastic.
  3. The Arduino will be replaced with a PICAXE microcontroller. This was actually part of the initial design but because I was unable to connect to the PICAXE chip, I had to use the Arduino instead. The PICAXE will be used because it is significantly cheaper and I prefer to use the Arduino continually and not have it stuck in one project.
  4. The mask will be completely redesigned. One thing I noticed while using this alarm is that the mask, while soft, is not very comfortable for longer periods of time. Although it is completely soft and cannot dig into the user’s face, I’d prefer if it were flat. The foam will be removed and the LEDs possibly replaced with flat ones.
  5. Right now, the PA must be placed face down on the SA’s base. I might make the photoresistor removable and attached to a smaller plate so that it can be pressed against any surface that the user wants to use the PA as. This means that the user won’t have to worry about the PA falling off the SA as well as the ability to use multiple PAs at once. The user can simply put the photoresistor plate in a dark box with whatever PAs they want and if any of them go off, the SA will be activated.

Changes in the programming

  1. I will be making the fade take a little longer to get to full brightness and stay at full brightness for a minute or two before it starts blinking. This is more of a personal preference that I want to try out.

Here is a gallery of pictures from the build process.

Here are pictures from the design right before this one. You can see the evolution the design had from this to the final product.

April 26, 2015 update: I have realized that this project doesn’t make sense to continue since I no longer have a need for a specialized alarm. While the project would be fun and I might come back to it later should circumstances change, for now I’m going to work on projects that are fun and useful.


Alarm Clock V3 8/3/12 UPDATE


Until now, I was planning on posting on the alarm clock once it was finished but I have decided that for projects from now on, I will post on them as a blog, saying what happens each day of work.

So here is the update on the alarm clock up to this point (Full details will be in the Instructable on it).

The coding was done first and, after some difficulty, was completed. Due to problems with the cables for the PICAXE chip, I have switched to Arduino. When I get back to school and have access to Windows computers, I may try to go back to the cheaper PICAXE. As of now, I can unplug the alarm wires when I want to use the Arduino for something else. As of now, The Arduino is powered by 4 AA batteries connected to a modified plug but I will be replacing them with a 9V battery soon. The plug will still be explained in the Instructable, however. Other general changes have been the switch from yellow to red LEDs. Yellow LEDs did not get bright enough and I was trying to avoid using a separate circuit + transistor to power them. This might change in the future.

Another problem I ran into was connecting the Arduino to the alarm clock. When the transistor alone or the primary alarm input alone was connected to the Arduino, everything was fine (i.e. if it was just the transistor, the Arduino was able to turn the primary alarm [PA] off and if it was just the input, the PA was able to tell the Arduino that the it was starting). However, as soon as both were connected, things started acting strangely. At one point, if I pressed the “Alarm” button on the PA, the entire PA shut off, apparently being shorted. Eventually, I thought to use a voltmeter to see if it could help. It showed that the “Alarm” button and the speaker on the PA were operating on very different voltages and by wiring them to the Arduino, I had set two different “grounds” to be equal, which they were not. To try to remedy this, I connected a large resistance to the higher voltage to try to create a voltage drop. This started as a motor but it was replaced with a 1M ohm resistor. This seemed to do the trick.

With everything wired up, I did a test with the alarm. The Arduino successfully started when the PA started going off and shut it off. One problem I noticed was that if I held down the “Alarm” button on the PA, the Arduino would start and even pressing the Reset button wouldn’t help. My current theory is that by pressing the “Alarm” button, I made the alarm input pin on the Arduino “float”. To help with this, I wired that pin separately through a switch to ground, which I pressed whenever I pressed the alarm button. This did the trick. (Later on I ended up changing from a digital pin to an analog one and this problem disappeared completely.)

Recently in tests with using the alarm to actually wake me up, the alarm has not worked to wake me. I am not sure if the alarm is not going off or if the lights are not working but I believe it is the former. I believe that the 1M ohm resistor does not work for extended periods of time (like 6 hours) but only for shorter ones. Ideally, there would be only one electrical connection between the Arduino and the PA so this wouldn’t be an issue. The best thing would be like a transistor except unlike a transistor, the “bigger” circuit wouldn’t have to go to the ground of the “base” circuit. Unfortunately, no such thing exists.

Except that it does. It’s called a relay and I found out about them today. If a transistor is an electric switch, a relay is an electrically powered switch. While a transistor is completely electrical, a relay uses voltage to mechanically move (using an electromagnet) a switch, leaving both circuits completely isolated. Although this will require me to un/resolder a lot of parts, this option is ideal because it will actually work.

Another development is that I realized that using an iPod as the PA is a good idea because it doesn’t have an issue with transistors (iPod alarms give up after a while automatically) and multiple alarms can be set. Using an old pair of headphones, I discovered that the voltage from the iPod directly was not enough to be seen by the Arduino (this was done by attaching the headphones into the analog port in the Arduino and having the Arduino report the value on the serial monitor). After connecting an op-amp amplifier circuit, the alarm could be tripped with a minimal volume of 2-3 bars of “harp” (the quietest one), which can easily be muffled. Interestingly, an increased gain did not make it better always. A gain of 1-10 seems ideal.

Next I will speak about the power issues.



I wanted to keep the number of external factors to a minimum so I didn’t want to have multiple things plugged into the wall outlet. Ideally I would have one power source for everything. But if I used the alarm clock version, I would need a plug for that, a power source for the Arduino, and a separate power source for the relay. If I used the iPod, I would need a power source for the Arduino and two power source for the op-amp (the iPod wouldn’t be an issue because I use it all the time so I don’t worry about it dying without me realizing it). However, all of those things could be run off 9V, which means that one plug could solve all the problems. However, I found out that the alarm clock ran off 9V AC while the Arduino ran off DC. The alarm clock’s backup battery slot also did not work. I decided to use the iPod. However, after multiple tests, I decided that I did not trust the system of using the headphones as it would sometimes not work. This led me to the system I am currently using, which works much better, is more versatile  and, of course, a lot simpler.

The system is to have a box with the iPod in it. Also in the box is a photocell, who’s resistance changes depending on how much light is shone on it. This is connected to a resistor, 3.3V and ground. The resistance over the photocell is also sent to an analog pin on the Arduino. This means that when the iPod’s alarm goes off and the screen lights up, the Arduino knows. This system is a lot easier to make and means it works on any iPod, cellphone or anything else that lights up when the alarm goes off. You could even put multiple things in the box so that any of them can set off the alarm. Also, it means that it is completely independent of sound, so I can set the alarm to Silent. Right now I’m stil working out some kinks so the Instructable isn’t done and the whole thing is just glued to a board. The final version will be contained in a single unit with a space to put an iPod/phone.