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.