Adding a Dimmer to Your DOTKLOK




Introduction: Adding a Dimmer to Your DOTKLOK

I love my new home-built DOTKLOK (, but at night, that darn clock is too bight.  I decided to add a photoresistor, also called a photocell, as a dimmer and hack the 'KLOK a little. Photoresistors are basically resistors that change their resistance based on the amount of light that hits it's face.  They are very inexpensive and easy to incorporate into projects.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Open the DOTKLOK

Unplug your DOKKLOK from the power source and get a soft cloth for your work surface.  A microfiber cloth would be best, but here I'm using a clean bath towel.  

Un-screw the screws and nuts on the DOTKLOK case and lay it out on a soft cloth so you don't scratch the surfaces of the acrylic faces.  

You'll then want to carefully remove the SURE LED Matrix.  Mark the plug and socket so you know how to hook it up again.  Then, unplug it from the main board.  Set it aside for now.  

Step 2: Prototyping the Photo-resistor on the Arduino

With the LED Matrix removed, I spent some time with a prototyping Breadboard Arduino from Dale Wheat at and some code from @ladyada at to work out how to incorporate the photo-resistor into the board.

Note: Not all photo-resistors are created equal and you may have to fool around with the settings to get it to work with your configuration. 

Step 3: Simple Schematic

The circuit is very simple.  The DOTKLOK board includes a 'hackable' prototyping area with pinouts for the Arduino's A0-A3, D2-D3, and D12-D13...along with corresponding GND and 5V holes.  

After prototyping the photoresistor on the breadboard, I determined that a 1K resistor would work best.  So, looking at the available pins, I'll be using Analog-0 to read the value of the photoresistor.  

If you're looking for a good tutorial on adding photoresistor to your Arduino project, check out @ladyada's site at

Step 4: Attach Pull-down Resistor to the Photoresistor

Because there are limited pinouts on the DOTKLOK board, I decided to add the pull-down resistor to the photoresistor directly.  I like to use shrink-wrap tubing to keeps things neat and to keep the leads from touching.    

Step 5: More Shrink-wrap Tubing

Add more shrink-wrap tubing to make it as neat as possible.  Use a heat-gun to shrink the tubing when it is all in place.  Now there are three leads.  One for one side of the photoresistor by itself (to 5V), one lead for the resistor itself (to GND), and one lead that includes both the 1K resistor and the photoresistor (to Analog-0).

Step 6: Attach Ribbon Cable

I found some solid-conductor ribbon cable laying around the shop and I pulled off three conductors. I stripped the ends and added more shrink-wrap tubing to each conductor.  Then, I soldered the leads to the ribbon cable. Using the heat-gun, shrink the tubing around the newly soldered conductors.  Remember to add the shrink-wrap tubing BEFORE you solder the conductors to the leads of the photoresistor.  You only forget once and then you always remember to do it first.  

Step 7: Bendy Ribbon-Cable

Bend the ribbon-cable around the board and place the photoresistor near the top of the DOTKLOK.  Make sure the correct leads are arranged at the correct terminals. 

Step 8: Solder It In

Solder the correct leads to A0, GND, and 5V.  It's now time to close your DOTKLOK back up.  Connect up the LED Matrix and attach it back the way it was originally.

Step 9: Modify the Code - Add the Brightness Function

Now that the photoresistor is installed in the DOTKLOK and the hardware is put back together, it's time to add some code to tell the LED Matrix to dim according to the value received on pin A0.  The first modification is to the HT1632.pde file.  Here you need to add the brightness function.  The raw reading from A0 (0-1024) will be converted, or mapped, to the value expected by the HT1632 driver (0-15).  So, the function will receive a passed integer called intensity that will have a value of 0-15.  I added some code to increase the intensity at high levels, and decrease it a really low levels.  

Step 10: Define the Global Variables

Next, we'll define two global variables.  In the dotklok_rev_1_2.pde file, add the two lines included in the photo below.  One for the pin to read the value, and the other for the value itself.  

Step 11: Modify the Code - Read the Value

Next, we need to read the value of the photoresistor and call the brightness function to change the brightness of the LED Matrix.  You can see the 'map' function used to map the analog value to the 0 - 15 value expected by the HT1632 driver.  

These two lines of code will need to be added at the bottom of the do-while loop of each animation in time_animations.pde.

Step 12: Load the Code and Test It Out

Follow the instructions to reload the code to the DOTKLOK's ATMEGA328P processor and then test it out.  Here is mine:

MakerBot Challenge

Participated in the
MakerBot Challenge

Be the First to Share


    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest
    • Fix It Contest

      Fix It Contest

    4 Discussions


    8 years ago on Introduction

    Looks good! I'll be posting full DOTKLOK assembly instructions soon!


    Reply 6 years ago on Introduction

    Sadly I never got around to posting it here, but all the instructions are still available at my site:


    Phil B
    Phil B

    8 years ago on Introduction

    Your project is very clever and very well done. I would have a lot of "catch up" in the technical part to be able to do all that you have done. With age, light sources in the bedroom, even an LED clock, interrupt sleep patterns. I simply set our LED alarm clock back farther on a taller chest of drawers so its face is not in line of sight with my eyes. When I need to know what time it is, I just raise my head a little so I can read the clock. Thank you for posting this.