Sunday, July 10, 2011

Tornadoes are Everywhere!

Back on the east coast a tornado was pretty rare. There was one water spout outside Sullivan's Island when I was living there, and I worked a 22-hour shift in Beaufort repairing tornado damage to power lines once, but in Tennessee there's a tornado within 50 miles of me probably once a week. On a related note, I have a radio scanner which doubles as a weather radio! I used to have it in Sue, and I'd listen to the Clemson police arrest streakers running across Death Valley and bust underage drinkers. That's about all they ever did I think.


The only problem is I either lost the power cable for it, or used it for something else. But! This was the perfect excuse to build a 120VAC to 12VDC rectifier. Actually, kind of a boring and common job. But! One thing I will note is my use of LM7812C voltage regulator instead of a zener diode. I figure it's better at regulating to 12 volts than one teeny diode is. The other thing is that I'm pretty sure it's more able to dissipate its waste heat. Which is why I attached a cheap heat sink to it. Its thermal conductivity with air lowers the chip from 65 degrees C per watt to about 25. Which is OK, because the regulator only handles a small amount of power normally.


I've had it on non-stop in weather alert monitor mode for about three weeks now, with no problems.

Wednesday, July 6, 2011

I am Known for my Environmental Streak.

My TV was mentioned in a previous post for being very awesome. To the best of my knowledge it's at least five years older than me, making it around 30 years old. It has two knobs (VHF and UHF) and a button that pulls out to turn the TV on and pushes back in to turn off AND turns for volume. There is no remote control and, needless to say, no sleep timer.

Well I had another microcontroller sitting around so I decided to build a sleep timer. I usually have some sort of sitcom on when I am going to sleep, especially on the weekends, but I don't like the (future) ramification of an increased power bill with the TV on for 10 hours a day. Especially if I'm not actively watching it.

When I am paying my own power bill in my future apartment (in less than a month I suppose) I want even the timer circuit itself to be energy efficient, so I designed it so that when it is off, absolutely nothing is drawing any power. No transformer or rectifier or LED drawing a teeny bit of current, not the slightest watt wasted. Plus the perks of 11.5 hours less of TV operation per day. This makes me very environmentally conscious! I can now sell carbon credits, but I'm not sure how much power the TV actually draws is because my ammeter is cheap and only works up to 200mA AC. But hopefully less than 1.2 kilowatts because the relay I used can only safely break 10A. (Don't worry, I put in some fuses and such... for safety!) Any way, here is a quick video of how this works:

Timer Circuit, part 1

I attached all of this behind the lightning protection on an old surge protector my dad gave me probably more than 10 years ago. I cut the hot (black) conductor inside the surge protector and attached one wire to each of the new ends (one going to my timer, one coming from the timer) and then just attached a third wire for a system neutral/ground.


To preface: I have never cut Plexiglas with anything other than a computer-controlled laser. As is apparent from the pictures, I did not have one of these. But I think the finished product still looks pretty neat! Beats a black Radio Shack project box any way.

I don't think I mentioned in the video, but the light switch on the side is a bypass. If the switch is on, the timer can be on but will not be able to shut the TV off, and vice versa. The universal OFF switch for the entire device (if the timer is running it cannot be stopped besides removing power to the microcontroller) is the original on/off switch on the surge protector that this is attached to.

The only real problem I had is that I mounted the microcontroller too close to the top of the box, and caused a short circuit in it's 12V power cable. It didn't do anything damaging, only caused the relay to not activate. I remounted the microcontroller lower in the box, replaced the power adapter, and now it is just dandy.



UPDATES!

So for some reason the bypass switch shorted out. Probably because I found it in a house I used to rent, and my landlords were notorious for buying really, really cheap things around the house. Like CFL bulbs that would burn out every month, or a chain on the back door that was made out of brass and broke after two days. ANY WAY. I coincidentally got my first supply of ATtiny microcontrollers and decided that this was a good chance to liberate the Arduino from this project and play with an ATtiny. And I went ahead and added some functionality while I was playing around.

There are a few details about this project that I didn't share, such as how I was able to allow this device to consume zero power when it is off, and as a note to myself in the future, I wrote it down in my green book. So there.

So the functionality I wanted to add was an adjustable timer. Before, I took an EXTREME programming shortcut with the Arduino as far as the timer functionality went. Pushing the main button automatically started the timer by turning on the Arduino, setting the system time to 0900 hours, and then waiting for 0935 to shut off. Regardless of what time it actually was, every time power was turned on, that's what the Arduino did. It was also impossible to stop the timer once it was started, unless you unplugged the entire device or flipped the switch on the surge protector, which is hidden behind my desk normally, and very hard to access.



I removed the bypass switch (which was faulty) and wired the ATtiny up to the breadboard, adding in a 5V DC regulator for microcontroller power. I also added some control circuitry for a potentiometer (timer length adjustment), an extra LED (existing LED will be used for power indication, and the new one for timer indication), and two new pushbuttons. The existing pushbutton is wired to 120 AC and momentarily delivers power to the circuit when it's pushed, which turns the microcontroller on. But this means that it can't be used as a microcontroller input to turn the circuit back off. To solve this problem, I added a smaller red pushbutton that the microcontroller monitors. If this second button is pressed, it turns everything off (including itself). The new small black pushbutton starts and stops the timer. This also allows me to eliminate the bypass switch, as I can now turn everything on (with or without the timer) and off electronically.


WHEW that was a mouthful. Long story short, it works pretty well now, and is a little bit more user friendly. The buttons are easier to push than it seems. The plexiglass in the picture is extremely clear...