Adding A Timer Feature To This Desk Lamp


[Steven Mackaay] added a simple user interface that implements a shutoff timer for his desk lamp. His project log comes in two parts, the breadboarding and the actual implementation.

He wanted a few things out of the build. The first is an LED that would help him find the lamp in the dark. The second feature is a shutoff timer with different delay options. To get everything working he used a PIC microcontroller to drive a mechanical relay. That relay switches the mains power to the lamps. Now he uses one button to switch the lamp on and off. The other selects a shutoff timer of one, five, or thirty minutes. Power for the control circuitry is provided by the green wall wart PCB seen in the photo of the electronic guts.

This is a pretty general setup that could be applied to a lot of other mains switching applications. Just connect the logic hardware to some type of relay.

18 thoughts on “Adding A Timer Feature To This Desk Lamp

    1. What do you mean? aren’t the neutral and hot always next to each other in the walls and almost everywhere?
      Do you mean the connector? I don’t think the nearness is a problem, it all goes inside a closed case.

      1. I think he’s talking about the screw terminals. I’m not an expert with mains-level electricity in the slightest, but it does seem like wire nuts would have been a a safer choice. Then again, I’ve heard wire nuts are illegal in some countries.

        1. Wire nuts are frowned upon in many places, the replacement is these:

          The terminal block he is using has plastic strips between each connection so they can’t touch, they usually come with covers for mains stuff so you don’t stick your finger in there.

          These are better and more commonly used:, they can be cut to size & have mounting holes.

          He needs a grommet where the cable enters the lamp and a cable clamp as well. No, terminal blocks aren’t strain relief, even if you use ring terminals Adding an earth wire wouldn’t have gone astray either.

          1. I only use those terminal strips and in Europe you’ll see these in installations dating centuries.

            There are some things to consider,the Ceramic are way better than the plastic ones for high current even if you can find properly rated plastic,and for quality work the cheap will always cause trouble with the screw.

            However for really heavy duty installation NONE of these offer as tight joining as wire nuts,and specially for high current it’s the only proper way,imagine how good contact huge nuts make.

            If someone knows how and where to install them there will be zero problem.

          2. Sorry i misunderstood,when i say wire nuts i mean wires and nuts or screws not the wire nuts that cover twisted wires.

            Those are really the worst thing you can use on joined wires,Terminal Strips all the way.

    1. Hahahahaha. Of course. It is true.

      But how do you know where to draw the line ?
      There are many aspects to consider the micro(from someone who likes micros, like me)
      -it’s more flexible and you can change functions/variables via software which is cleaner than soldering a new res/cap in
      -you like it because you like programming micros
      -you have the time to develop with the micro(i guess it takes more time)
      -you have many micros in your parts inventory but no 555
      -it’s more complicated with a micro and that makes you feel better because your design is more complex
      -who cares, it’s the idea that matters.

      1. I’m designing complex relay circuits that have the same features as a single simple microcontroller,simply because anything that involves programming,computer,software and all that makes my interest go away.

        There’t nothing more enjoyable for me than solely analog-electromechanical circuits and the feeling of developing features by adding components.

        I guess some people feel the same for microcontrollers.

  1. Nice project,specially if you are forgetting to turn off the desk lamp!!!

    However i can see no reason for all this headache with microcontrollers involved.

    This could be done with a simple configuration on 555 with a potentiometer that could be powered by a small 5v usb charger circuit that would be hooked to the down side of the lamp taking power directly from the lamp cord instead of having a dedicated wall outlet just for the power supply it needs and extra wires.

    Otherwise really a nice project!!!

  2. I added a ‘shutdown timer’ to my Microvision ShowWX pico projector a while back, so I can watch a big screen in bed and not worry about the projector running all night :)
    I soldered an SMD Picaxe 08m2 and an SMD p-channel mosfet to some stripboard, a p-channel was chosen because I wanted to control the +5v line as controlling the GND might have caused issues with the GND line coming from the VGA connection. The largest component is the SMD mounted stereo headphone socket for programming the Picaxe. Not the most tidy of soldering but worked first time (and still works to this day) without needing any modifications.
    The single button controls how long you want the power to stay on for, press it 5 times and it blinks back 5 times to indicate the number of presses then switches output power off after 50 minutes, the LED then blinks once a second to show it’s not providing power to the projector. Press & hold it for 2 seconds and it cancels the countdown and stays on permanently.
    The blue SMD LED is PWM controlled and found I had to keep its brightness right down or it became distracting in the dark.

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.