Automatic Desk Lamp Concept

From Makerpedia
Jump to navigation Jump to search

by Bobby Eleveld


Project Overview

A desk lamp or reading light is a ubiquitous tool for anyone reading or working in dark areas. However, a typical desk lamp has limited functionality: it can be turned on and off and it must be unplugged to move. This project aims to create a concept for a desk lamp with more built-in functionality. The lamp dims itself as the light in the surrounding area brightens and turns itself off when the user leaves the room or after a set amount of time has passed.

Tools and Materials

  • Breadboard
  • Wires
  • 5V power source
  • Resistors (in ohms): (2) 1M, (1) 3k, (1) 2k, (1) 1.5k, (14) 450
  • Capacitors (in μF): (1) 1, (1) .01
  • LEDs – one needed, more can be used for testing
  • (1) 1N4148 Diode
  • (2) 74192 ICs
  • (2) 7447 ICs - BCD to Seven Segment Decoder
  • (2) Common Anode Seven Segment Displays
  • (1) 74108 IC – 4 x 2 in AND gate
  • (1) 7402 IC – 4 x 2 in NOR gate
  • (2) 74107 ICs – JK flip flops with clear inputs
  • (1) 7432 IC – 4 x 2 in OR gate
  • (1) LM555 Timer IC
  • (1) LF356 – Op Amp with JFET input
  • (1) LF411 – Op Amp
  • (1) GL5528 – CdS Light Dependent Resistor
  • (1) Switch


Step-by-Step Instructions

Building the 555 Timer. The 555 Timer will have a charge time of 1.1*R¬1*C and a discharge time of 1.1*R1*C. Build the circuit in Figure 1 using a 555 Timer IC. The pins on the chip are labelled in the diagram but be careful to correctly wire the circuit. A 10 nF capacitor is connected to the Control pin to prevent electrical noise from affecting the internal behavior of the chip. Using the given values of resistance and capacitance gives a charge time of 0.7s and a discharge time of 0.7s. The counters used in the rest of the circuit are rising edge triggered, so the given values result in a clock frequency of 1.4s for the circuit, which can be adjusted by changing any of the resistance or capacitance values on the left side of the circuit.

Building the Countdown Timer. Build the circuit in Figure 2. The clock signal from the 555 Timer is input into the first 74192 chip, which is a Binary Decade Counter that can count up or down. To force the chip to count down, refer to the chip pin diagram and send a high input to CPU, a low input to MR and PL, and the clock signal to CPD. If we want to set the starting value of the 192 chip, we can pulse a high signal to PL, and the chip will read pins P0 – P3 as a binary input for the starting value. Connect pins Q0 – Q3 to pins A – D respectively a 7447 IC, which is a 4-bit to 7-segment decoder chip. Then connect the a – g pins on the 7447 chip to the corresponding input on a 7-segment display chip. The diagram shows only one resistor, but make sure to use a resistor for each connection to prevent blowing out any of the display LED’s. I used common anode 7-segment displays, so I had to send 5V through each of the A pins of the displays. This 7-segment display will be the ones place of the Countdown Timer. The first 192 chip has two sets of logic gates. One is an AND gate that looks for an output of 1 from Q0 and Q3, which is the binary equivalent of 1xx1. The 192 will never output a value higher than 1001, so looking for this signal tells us that the 192 has counted from 0 to 9, and we need to countdown the tens place of our timer. Therefore, when this AND gate goes positive, we send its signal to the CPD pin of the second 192 chip. Connected the second 192 chip to the same series of 7447 then 7-segment display as the first chip so it has the same functionality. Connect each output to a NOR gate as shown in the diagram. When the output of each pin is 0, the NOR gates will have a positive output, which we combine through three AND gates. The function of these logic gates is to tell the lamp that the timer has reached 00, so the light needs to turn off.

Building the Motion Sensor circuit. Build the circuit in Figure 3. The top portion of the circuit is a 3-bit counter built using 74107 JK flip-flops. The clock signal for each of these flip-flops should come from the 555 Timer. The Pyroelectric InfraRed (PIR) motion sensor detects infrared light and sends an output signal if the infrared signal changes over time. This output signal is enough to be read as HIGH by digital logic circuits, but the sensor sends no signal if it detects no motion. During testing, I found that no signal is not read as a LOW signal by digital ICs, so we connect the PIR output to the inverting input of a LF356 op amp with a high rail at +5V and a low rail at ground. We use this op amp in particular because its internal characteristics allow its output to approach ground close enough for its signal to be read as LOW by digital chips. The voltage divider sends +2.5V through the non-inverting input of the op amp, which causes the op amp to act as a comparator. Make sure to test the output voltage of the PIR sensor. Depending on what you observe, you may need to adjust the resistance values of the voltage divider. The output of the op amp is connected to the CLR input pins of the JK flip-flops. When no motion is detected, the op amp output is high, which allows the flip-flops to toggle when they receive a clock signal. When motion is detected, the op amp output is low and the input to the CLR inputs is low, this resets the Q output of each flip-flop to 0. The way the circuit is drawn, if no motion is detected over seven clock pulses, then a high output will be sent from the Q output of each flip-flop and a high signal will be sent to the light, signifying that no motion has been detected, so the light should turn off.

Building the automatically dimming LED. Build the LED circuit in figure 4. When light shines on the Light Dependent Resistor (LDR), its resistance decreases. The LDR is held at the same voltage as the LED by Kirchoff’s Loop Rule, so this resistance decrease means the LDR draws more current, dimming the LED. The opposite occurs when the LDR receives no light, brightening the LED. Use an LF411 op amp as a comparator to detect a HIGH signal from either the Countdown Timer or the Motion Sensor. This sends the output of the comparator to LOW, turning off the light. Finally, we control the operation of the circuit by using a switch to control the voltage of the inverting input of the op amp. Depending on the LDR used and the characteristics of your op amp, you may need to change the resistance of the 3 kΩ resistor to ensure the behavior of the LDR is such that the LED is visibly dimmed and brightened as expected. If the resistor is too low, the LED will always have enough current, and will not dim, and vice versa if the resistance is too high.