Tool box light dimmer helps out a friend, offers up design tips

toolbox-lighting

[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.

Comments

  1. DanJ says:

    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.

    • Taylor Alexander says:

      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.

      • charper says:

        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! :)

      • DanJ says:

        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. Th3badwolf says:

    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.

    • Taylor Alexander says:

      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. patteb says:

    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. Monty Werthington says:

    Its a neat package but I can see how this could be made in analogue. That being said it fits the needs excellently.

  5. miceuz says:

    Monty, could you share you thoughts on analog implementation? Beeing a programmer, i’m quick to jump into microcontrollers, but i’m eager to learn analog side.

  6. ewanuno says:

    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.

  7. Morgen says:

    yes i can

  8. Morgen says:

    is there a world of hackers?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 94,439 other followers