Aug252009

Dimlet

This is a project I built July 2009 for a friend's party. I'd been interested in 1) how to build a cheapish light dimmer circuit 2) controlling things from my iPod Touch 3) interactive engineering-art. So I set myself on this project. Two weeks and about 80 hours of work later, I had a solid working prototype (shown in the video).

How

I started by learning how to build a light dimming circuit. I knew triacs and solid state relays could be used to dim lights. Solid state relays are expensive so I took a look at a couple of existing light-dimmer designs that use triacs. This article by Andrew Kilpatrick was particularly helpful and will explain the theory of light dimming using triacs. Triacs, as well as most (maybe all) other AC light dimming methods, dim the lights by turning them on and off rapidly and in sync with the ac sine wave. I ordered the parts and set about making the AVR software that would control the TRIAC's timing.

The software on the microcontroller works like this: commands containing a light id and an intensity are received through the UART. Every time the AC voltage goes to zero (a zero-crossing), the light items are sorted by intensity, all lights that don't have an intensity of 100% are turned off, then an output compare interrupt is set for the time the next light needs to be turned on. When the output compare interrupt happens, the light specified in the top item in the array of lights is turned on, then another output compare interrupt is set up for the next light that needs to be turned on. A couple designs I saw used an interrupt that happened 256 times every AC cycle; while this certainly works, I wanted only to use output compare interrupts so that, the handler code only runs when a light is about to be turned off.

The router is a Fonera 2100 that has been updated to run a more plain version of OpenWRT Linux instead of the original FON firmware. I used the serial interface to do update the Fonera's firmware. The software on the Fonera was fairly simple: it receives commands light intensity commands via UDP and then forwards those out the UART to the AVR. To compile programs for the Fonera, I set up the OpenWRT buildroot in a VirtualBox virtual machine as per these instructions.

I learned some legit ObjectiveC iPhone/iPod programming using the Apple SDK for this project. ObjectiveC is a superset of C/C++ so it is still possible to program in C/C++ for the iPhone/iPod. For the UDP code, I used standard Unix function calls in C and the rest I wrote in ObjectiveC.

Resources:

Thanks / Acknowledgements:

Write a comment


If you have trouble reading the code, click on the code itself to generate a new random code.
 
Showing comments 1 to 10 of 20 | Next | Last
Comment Auto electronics Parts on : Wed March 26, 2014, 17:57:18
Hi, i read your blog occasionally and i own a similar one and i was just curious if you get a lot of spam remarks? If so how do you prevent it, any plugin or anything you can suggest? I get so much lately it's driving me insane so any help is very much appreciated.
<a href="http://www.venerablemusic.com/OBD2CodeScanner.asp" title="Auto electronics Parts">Auto electronics Parts</a>
Comment louis vuitton outlet stores online on : Wed February 19, 2014, 09:41:00
http://keralaindex.com/louisvuitton/louisvuitton.php?id=2865 louis vuitton shoes on sale for men
&#x005B;url=http://keralaindex.com/louisvuitton/louisvuitton.php?id=1605&#x005D;louis vuitton outlet stores online&#x005B;/url&#x005D;
Comment prada make up bag on : Wed February 19, 2014, 09:41:00
http://roosevelt-cross.com/prada/prada.php?id=250 prada shoulder bag
&#x005B;url=http://roosevelt-cross.com/prada/prada.php?id=420&#x005D;prada make up bag&#x005B;/url&#x005D;
Comment fendi ? on : Wed February 19, 2014, 09:41:00
http://hmrrc.com/fendi/fendi.php?id=295 ?????????
&#x005B;url=http://hmrrc.com/fendi/fendi.php?id=88&#x005D;fendi ?&#x005B;/url&#x005D;
Comment www.raleighbridalevent.com on : Wed January 08, 2014, 04:36:15
http://www.iscfmanuelfajardo.com peuterey outlet
&#x005B;url=http://www.raleighbridalevent.com/&#x005D;www.raleighbridalevent.com&#x005B;/url&#x005D;
Comment internet site on : Fri January 03, 2014, 23:05:59
Elimination may be the easiest solution to save lots of time and prevent confusion. Don't just take them, review them and look at the explanations that explains why you got your incorrect questions wrong.
&#x005B;url=http://utsunomiya-gaming-group.deftba.com/members/vicentemv/activity/5254/&#x005D;internet site&#x005B;/url&#x005D;
Comment vivienne tam on : Tue December 17, 2013, 06:30:35
Send out thousands of letters and your best sales pitch is being presented to thousands of simultaneously. Behavioral training will help you to stop dog behavior problems such as jumping, barking, begging, biting and chewing. Sleek and sexy floor length dresses are ideal for those gala parties and black tie events you have marked in your social calendar. 5 Bt when one is somekeywod fom the anke boots and getting to the ega hee, one shod stat sow Sch disconts often come fom a etaie ovestocking on some designs, o the fact that the shoes may not be the cent season favoite Time wi te who the winne is and I cannot wait! Elsewhere there is not a lot of choice, but at least there are some courses. The first call I make when I get back to the hotel: room service. These seasonal boxes and bags will not only keep your bauble and bulbs dust free, they will also keep them protected and safe over the coming months."As far as status goes, this is probably one of the most important fashion categories - it's the one that really shows off who you are, no matter how you are dressed," said Milton Pedraza, the Luxury Institute's chief executive officer. Of course it's hard to kill someone who's perfected a drug that will let you live forever, and the senior scientist comes back from the grave for revenge. Whilst in an eye exam lenses of varying powers are used to precisely correct for refractive errors, using a pinhole will largely correct for refractive errors and allow VA to be tested in other circumstances. Love is a head-flipping emotion that would drive us to tear our own hearts out and eat them if not for our rib cages. 837528271liuwenjie All in all, you'll be part of the whole aviator craze while getting expertly crafted sunglasses that protect just as great as they look. styes inteesting and mti-cooed, cothing, Wedock Pot make pehaps type,de to eye-catching ppe not fogetting back and white,biding a fascinating Japanese Lnfan gis and boys Hit yo money away! As they also say -'Laughter is the best medicine'. For some pieces I use a technique called glass painting. Recalling their meeting in an interview last year, she said: 'I didn know anything about him. Four popular cam types are single, hybrid, twin and binary. Matchmaking is the best instrument for those people who are planning to settle down in life and want to commence a family without facing any problems associated with dating and wooing. When it does swing into action it looks good and free of motion artifacts or any cross coloration. These ultrasonic cleaners are used to clean stirrers, rods, tongs, forceps and other lab equipment. And as usual, they always seem to find the way out of the valley back to their homeland, only to be thwarted by an earthquake or sudden dinosaur attack.It has been used for centuries for the general health of women. This is a brief list of some very small oil and gas plays with acreage in the United States. A+: Grade A+ are made of Top Layer of calf skin, will turn darker over time. Certainly you can change many of your habits and improve your sleeping environment without a physician's advice. I've learned a lot about how to be successful with GPT sites. You will not be able to tell the ality of a you just met as well as what kind of he is by just looking at him. Here are some ways for you to locate your BMW radio code:Car's Paperwork.
&#x005B;url=http://www.pangallery.it/vivi.asp?id=77&#x005D;vivienne tam&#x005B;/url&#x005D;
Comment russell wilson jersey on : Thu December 12, 2013, 01:37:55
1. Officially licensed NFL Nike Authentic Jersey
&#x005B;url=http://www.shanguoernv.com/&#x005D;russell wilson jersey&#x005B;/url&#x005D;
Comment ghd styler on : Wed November 27, 2013, 14:16:53
Hmm is anyone else experiencing problems with the pictures on this blog loading? I'm trying to figure out if its a problem on my end or if it's the blog. Any suggestions would be greatly appreciated.
&#x005B;url=http://www.susanlenz.com/&#x005D;ghd styler&#x005B;/url&#x005D;
Comment winterjacken damen günstig on : Tue October 08, 2013, 16:22:02
Links with Reynolds are typically very shut off to film production company, It will be a so much more amusing movement to observe cooper in addition, Hong with the help of specific fatal dead.Neglect in.
&#x005B;url=http://www.worldlaughtertour.com/fckeditor/page63.html&#x005D;winterjacken damen günstig&#x005B;/url&#x005D;
Showing comments 1 to 10 of 20 | Next | Last