Tool Box Light Dimmer Helps Out A Friend, Offers Up Design Tips


[miceuz] has a friend that works as a theatre technician, and in the course of his job he often needs to jigger with various stage components while shows are in progress. As you can imagine, the lighting situation is far from ideal, so he asked [miceuz] to build him an adjustable lighting solution for his tool box.

The circuit itself is relatively straightforward, using an ATMega88 to provide the PWM required for dimming and color control. Input is taken from three different sources, a rotary encoder for color selection, a pot for brightness control, and a button to turn the light strip on and off.

[miceuz] says that while project came together pretty easily, it still presented some issues along the way which provide some useful design reminders for beginners (and some veterans) alike.

First and foremost: debounce, debounce, debounce. [miceuz] forgot this mantra and made a mad dash to add capacitors to his design after etching the PCB to ensure that his inputs were not bouncing all over the place. He also noted that one should always be sure to read the ADCL before the ADCH register when decoding ADC data. His final observation is that using thick traces is the best policy whenever possible – he ran into a lot of issues with traces detaching during assembly, which he had to rework with wire and solder.

In the end, his friend was happy with the result, and [miceuz] is a better hacker for having worked through his issues. What sorts of important/useful lessons have you learned through the course of your projects? Be sure to share them with us in the comments.

12 thoughts on “Tool Box Light Dimmer Helps Out A Friend, Offers Up Design Tips

  1. It’s less expensive to debounce switches in software. Most small buttons have a bounce period of less than 10 mSec. But even a larger debounce period, say 25-50 mSec, yields good results for most user interface functions.

    1. Less expensive, yes. By a trivial amount. Debouncing in hardware can be very complicated if it turns out that blocking the main loop isn’t acceptable. Debouncing in hardware, however, costs $0.06 and works every single time, regardless of how you change your code.

      I think “…most user interface functions.” is far too naive a thing to say. Sometimes your MCU is doing lots of things that aren’t UI related, and blocking the main loop for even 10ms could be disastrous. I didn’t read this article so I have no idea if it applies here, but you were saying that like it applies most of the time. I can assure you thats not true.

      1. Ok… I hate this misunderstanding. You should never block a uC program for a de-bounce. You detect the switch push (preferably in an interrupt) and do what you want with it, and then set a “do not check” bit or disable that switch’s interrupt routine and set up an interrupt timer. When the timer interrupts main code, just clear the “do not check” bit or re-enable the button’s interrupt. Your little microcontroller’s have had parallel processing for years… use it! :)

      2. I stand by my assertion. It’s almost always better to handle it in software. Much more flexible and simpler, less expensive hardware. And as charper says, you never block for something like debouncing. It takes a trivial amount of code and execution time.

  2. Thick traces,I see no needs for small traces except when there’s no other solution. I usually design then boost the traces in the end. Also,thicker trace and filling planes waste less chemical on the long run.

    ProTip: Add your artwork/logo as filling plane.

    1. Agreed. I try to do thick traces for everything I can get away with. I don’t stress if its not necessary, but if I can, I go thick. And adding your logo to the silkscreen or even the copper layer is baller. People don’t have enough fun with PCBs.

  3. I once experienced some difficulties whille meddling with JK-Flipflops… I didn’t need R and S inputs so I left them in my design, the result being a lamp which had “mystery powers”, switching on/off on its own will.

  4. you could add dmx to this for the cost of a sn75176 and a pair of 5 pin xlr connectors.

    then it’d be really useful for a theater tech.

    i made an arduino sheild that does rgb strips with dmx control. no onboard pots/encoders though.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.