You are on page 1of 26

Automatic Evening Lamp

Presented here is a solution for switching off outdoor lamps even when you
are not at home. The lamp turns on in the evening and turns off in the
morning so that there is no need for manually switching it on/off. The circuit
is directly powered from AC mains and can be enclosed in a plug-in type
adaptor box. It can drive a bulb, CFL, tubelight, LED lamp, etc up to 200W.
Authors prototype is shown in Fig. 1.
Circuit and working
The circuit uses a transformer-less power supply to generate low-volt DC.
As capacitors C1 and C2 are connected in AC lines, these should be Xrated capacitors. This minimises space and makes the unit light-weight.
Unlike an ordinary capacitive power supply, a more efficient power supply
design is used for spike-free operation. Phase (L) and neutral (N) lines
have identical circuits so reversal in
polarity while plugging will not affect the
circuit. 105K (1F) 400V AC capacitors
are used that can drop 230V AC to lowlevel AC. Resistors R1 and R2 protect the
power supply from instant inrush current.
Fig. 1: Authors prototype
Bleeder resistors R3 and R4, parallel to
C1 and C2, remove the stored current from the capacitors at power off to
prevent shock from stored energy in the capacitors.
A full-wave rectifier bridge comprising D1 through D4 (1N4007) rectifies
low-volt AC to DC and smoothing capacitor C3 gives ripple-free DC for the
circuit. The output voltage from the power supply is sufficient to operate the
circuit including the relay. Green LED1 indicates power-on status. Resistor
R5 limits LED current.

Fig. 2: Circuit diagram of an automatic evening lamp


The circuit is a simple bi-stable arrangement using popular timer IC 555
(IC1). Linking its threshold (pin 6) and trigger (pin 2) controls its flip-flop
operation. When the threshold input is high, it resets the flip-flop and keeps
the output low. When the trigger input is low, flip-flop triggers and output
turns high. So the combined action of threshold and trigger inputs gives the
bi-stable switching action to control relay driver transistor T1. The bi-stable
action of IC1 is controlled by LDR1 and resistor R6 (470k). The value of
5mm LDR can be up to 1 mega-ohm, depending on the ambient light
conditions. A 1M variable resistor in place of R6 can make the sensitivity
adjustment easy.
During day time, LDR1 has low resistance, which makes threshold pin 6 of
IC1 high. This resets the timer and the output of IC1 remains low. It takes
transistor T1 to cut-off state. The relay is de-energised, so the lamp
remains off during day time.
Transistors

Function

Transistors amplify current, for example they can be used to amplify the
small output current from a logic IC so that it can operate a lamp, relay or
other high current device. In many circuits a resistor is used to convert the
changing current to a changing voltage, so the transistor is being used to
amplify voltage.
A transistor may be used as a switch (either fully on with
maximum current, or fully off with no current) and as an
amplifier (always partly on).
The amount of current amplifiTypes of transistor

Transistor circuit symbols


There are two types of standard transistors, NPN and PNP, with different
circuit symbols. The letters refer to the layers of semiconductor material
used to make the transistor. Most transistors used today are NPN because
this is the easiest type to make from silicon. If you are new to electronics it
is best to start by learning how to use NPN transistors.
The leads are labelled base (B), collector (C) and emitter (E).
These terms refer to the internal operation of a transistor but they are not
much help in understanding how a transistor is used, so just treat them as
labels!
cation is called the current gain, symbol hFE.

Light Emitting Diodes (LEDs)


Colours | Sizes and shapes | Resistor value | LEDs in series | LED data |
Flashing | Displays

Example:

Circuit symbol:

Function
LEDs emit light when an electric current passes through them.
Connecting and soldering
LEDs must be connected the correct way round, the diagram may be
labelled a or + for anode and k or - for cathode (yes, it really is k, not c, for
cathode!). The cathode is the short lead and there may be a slight flat on
the body of round LEDs. If you can see inside the LED the
cathode is the larger electrode (but this is not an official
identification method).
LEDs can be damaged by heat when soldering, but the risk
is small unless you are very slow. No special precautions are needed for
soldering most LEDs.
Testing an LED
Never connect an LED directly to a battery or power
supply!
It will be destroyed almost instantly because too much
current will pass through and burn it out.
LEDs must have a resistor in series to limit the current to
a safe value, for quick testing purposes a 1k resistor is suitable for most
LEDs if your supply voltage is 12V or less. Remember to connect the
LED the correct way round!
For an accurate value please see Calculating an LED resistor value below.

Colours of LEDs

LEDs are available in red, orange, amber, yellow, green, blue and white.
Blue and white LEDs are much more
expensive than the other colours.
The colour of an LED is determined by
the semiconductor material, not by the
colouring of the 'package' (the plastic
body). LEDs of all colours are
available in uncoloured packages which may be diffused (milky) or clear
(often described as 'water clear'). The coloured packages are also available
as diffused (the standard type) or transparent.
Tri-colour LEDs
The most popular type of tri-colour LED has a red and a green LED
combined in one package with three leads. They are called tri-colour
because mixed red and green light appears to be yellow and this is
produced when both the red and green LEDs are on.
The diagram shows the construction of a tri-colour LED. Note
the different lengths of the three leads. The centre lead (k) is the
common cathode for both LEDs, the outer leads (a1 and a2) are
the anodes to the LEDs allowing each one to be lit separately, or
both together to give the third colour.
Resistors

Example:

Circuit symbol:

Function
Resistors restrict the flow of electric current, for example a resistor is
placed in series with a light-emitting diode (LED) to limit the current passing
through the LED.
Connecting and soldering

The Resistor
Colour Code
Colour

Number

Black

Brown

Red

Orange

Yellow

Green

Blue

Violet

Grey

White

Resistors may be connected either way round. They are not damaged by
heat when soldering.

Resistor values - the resistor colour code


Resistance is measured in ohms, the symbol for ohm is an omega .
1 is quite small so resistor values are often given in k and M .
1 k = 1000
1 M = 1000000 .
Resistor values are normally shown using coloured bands.
Each colour represents a number as shown in the table.
Most resistors have 4 bands:
The first band gives the first digit.
The second band gives the second digit.
The third band indicates the number of zeros.

The fourth band is used to shows the tolerance (precision) of the


resistor, this may be ignored for almost all circuits but further details
are given below.

This resistor has red (2), violet (7), yellow (4 zeros) and gold bands.
So its value is 270000 = 270 k .
On circuit diagrams the is usually omitted and the value is written 270K.
Find out how to make your own Resistor Colour Code Calculator
Small value resistors (less than 10 ohm)
The standard colour code cannot show values of less than 10 . To show
these small values two special colours are used for the third band: gold
which means 0.1 and silver which means 0.01. The first and second
bands represent the digits as normal.
For example:
red, violet, gold bands represent 27 0.1 = 2.7
green, blue, silver bands represent 56 0.01 = 0.56
Tolerance of resistors (fourth band of colour code)
The tolerance of a resistor is shown by the fourth band of the colour code.
Tolerance is the precision of the resistor and it is given as a percentage.
For example a 390 resistor with a tolerance of 10% will have a value
within 10% of 390 , between 390 - 39 = 351 and 390 + 39 = 429 (39 is
10% of 390).
A special colour code is used for the fourth band tolerance:
silver 10%, gold 5%, red 2%, brown 1%.
If no fourth band is shown the tolerance is 20%.

Standard Variable Resistor


Photograph Rapid Electronics
Variable Resistors
Construction | LIN & LOG | Rheostat | Potentiometer | Presets
Construction
Variable resistors consist of a resistance track with connections at both
ends and a wiper which moves along the track as you turn the spindle. The
track may be made from carbon, cermet (ceramic and metal mixture) or a
coil of wire (for low resistances). The track is usually rotary but straight
track versions, usually called sliders, are also available.
Variable resistors may be used as a rheostat with two connections (the
wiper and just one end of the track) or as a potentiometer with all three
connections in use. Miniature versions called presets are made for setting
up circuits which will not require further adjustment.
Variable resistors are often called potentiometers in books and
catalogues. They are specified by their maximum resistance, linear or

logarithmic track, and their physical size. The standard spindle diameter is
6mm.
The resistance and type of track are marked on the body:
4K7 LIN means 4.7 k linear track.
1M LOG means 1 M logarithmic track.
Some variable resistors are designed to be mounted directly on the circuit
board, but most are for mounting through a hole drilled in the case
containing the circuit with stranded wire connecting their terminals to the
circuit board.
Light Dependent Resistor (LDR)

An LDR is an input transducer (sensor) which converts brightness (light)


to resistance. It is made from cadmium sulphide (CdS) and the resistance
decreases as the brightness of light falling on the LDR increases.
A multimeter can be used to find the resistance in darkness and bright light,
these are the typical results for a standard LDR:
Darkness: maximum resistance, about 1M .
Very bright light: minimum resistance, about 100 .
For many years the standard LDR has been the ORP12, now the
NORPS12, which is about 13mm diameter. Miniature LDRs are also
available and their diameter is about 5mm.
An LDR may be connected either way round and no special precautions
are required when soldering.

555 and 556 Timer Circuits


Inputs | Output | Astable | Duty Cycle | Monostable | Edge-trigger | Bistable
| Buffer
Next Page: Counting Circuits
Also See: ICs (chips) | Capacitance | AC, DC and Electrical Signals
Introduction

Example circuit symbol (above)


Actual pin arrangements (below)

There is more information about


555 timers and their circuits on the
Electronics in Meccano website.

The 8-pin 555 timer must be one of the most useful ICs ever made and it is
used in many projects. With just a few external components it can be used
to build many circuits, not all of them involve timing!
A popular version is the NE555 and this is suitable in most cases where a
'555 timer' is specified. The 556 is a dual version of the 555 housed in a 14pin package, the two timers (A and B) share the same power supply pins.
The circuit diagrams on this page show a 555, but they could all be
adapted to use one half of a 556.
Low power versions of the 555 are made, such as the ICM7555, but these
should only be used when specified (to increase battery life) because their
maximum output current of about 20mA (with a 9V supply) is too low for
many standard 555 circuits. The ICM7555 has the same pin arrangement
as a standard 555.
The circuit symbol for a 555 (and 556) is a box with the pins arranged to
suit the circuit diagram: for example 555 pin 8 at the top for the +Vs supply,
555 pin 3 output on the right. Usually just the pin numbers are used and
they are not labelled with their function.
The 555 and 556 can be used with a supply voltage (Vs) in the range 4.5 to
15V (18V absolute maximum).
Standard 555 and 556 ICs create a significant 'glitch' on the supply when
their output changes state. This is rarely a problem in simple circuits with
no other ICs, but in more complex circuits a smoothing capacitor (eg
100F) should be connected across the +Vs and 0V supply near the 555 or
556.
The input and output pin functions are described briefly below and there
are fuller explanations covering the various circuits:
Astable - producing a square wave
Monostable - producing a single pulse when triggered

Bistable - a simple memory which can be set and reset


Buffer - an inverting buffer (Schmitt trigger)
Inputs of 555/556
Trigger input: when < 1/3 Vs ('active low') this makes the output high (+Vs).
It monitors the discharging of the timing
capacitor in an astable circuit. It has a high
input impedance > 2M .
Threshold input: when > 2/3 Vs ('active high')
this makes the output low (0V)*. It monitors the
charging of the timing capacitor in astable and
monostable circuits. It has a high input
impedance > 10M .
* providing the trigger input is > 1/3 Vs, otherwise the trigger input will
override the threshold input and hold the output high (+Vs).
Reset input: when less than about 0.7V ('active low') this makes the output
low (0V), overriding other inputs. When not required it should be connected
to +Vs. It has an input impedance of about 10k .
Control input: this can be used to adjust the threshold voltage which is set
internally to be 2/3 Vs. Usually this function is not required and the control
input is connected to 0V with a 0.01F capacitor to eliminate electrical
noise. It can be left unconnected if noise is not a problem.
The discharge pin is not an input, but it is listed here for convenience. It is
connected to 0V when the timer output is low and is used to discharge the
timing capacitor in astable and monostable circuits.

Output 555/556 Astable

555 astable output, a square wave


(Tm and Ts may be different)

555 astable circuit


An astable circuit produces a 'square wave', this is a digital waveform with
sharp transitions between low (0V) and high (+Vs). Note that the durations
of the low and high states may be different. The circuit is called an astable
because it is not stable in any state: the output is continually changing
between 'low' and 'high'.
The time period (T) of the square wave is the time for one complete cycle,
but it is usually better to consider frequency (f) which is the number of
cycles per second.
T = 0.7 (R1 + 2R2) C1 and f =

T = time period in seconds (s)


f = frequency in hertz (Hz)
R1 = resistance in ohms ( )
R2 = resistance in ohms ( )
C1 = capacitance in farads (F)

1.4
(R1 + 2R2) C1

The time period can be split into two parts: T = Tm + Ts


Mark time (output high): Tm = 0.7 (R1 + R2) C1
Space time (output low): Ts = 0.7 R2 C1
Many circuits require Tm and Ts to be almost equal; this is achieved if R2 is
much larger than R1.
For a standard astable circuit Tm cannot be less than Ts, but this is not too
restricting because the output can both sink and source current. For
example an LED can be made to flash briefly with long gaps by connecting
555 astable frequencies
C1

R2 = 10k
R1 = 1k

R2 = 100k
R1 = 10k

R2 = 1M
R1 = 100k

0.001F

68kHz

6.8kHz

680Hz

0.01F

6.8kHz

680Hz

68Hz

0.1F

680Hz

68Hz

6.8Hz

1F

68Hz

6.8Hz

0.68Hz

10F

6.8Hz

0.68Hz
(41 per min.)

0.068Hz
(4 per min.)

it (with its resistor) between +Vs and the output. This way the LED is on
during Ts, so brief flashes are achieved with R1 larger than R2, making Ts
short and Tm long. If Tm must be less than Ts a diode can be added to the
circuit as explained under duty cycle below.
Choosing R1, R2 and C1
R1 and R2 should be in the range 1k to 1M . It is best to choose C1 first
because capacitors are available in just a few values.

Choose C1 to suit the frequency range you require (use the table as
a guide).
Choose R2 to give the frequency (f) you require. Assume that R1 is
much smaller than R2 (so that Tm and Ts are almost equal), then you
can use:
R2 =

0.7
f C1

Choose R1 to be about a tenth of R2 (1k min.) unless you want the


mark time Tm to be significantly longer than the space time Ts.
If you wish to use a variable resistor it is best to make it R2.
If R1 is variable it must have a fixed resistor of at least 1k in series
(this is not required for R2 if it is variable).

Astable operation
With the output high (+Vs) the capacitor C1 is charged by current flowing
through R1 and R2. The threshold and trigger inputs monitor the capacitor
voltage and when it
reaches 2/3Vs
(threshold voltage)
the output becomes
low and the
discharge pin is
connected to 0V.
The capacitor now
discharges with current flowing through R2 into the discharge pin. When
the voltage falls to 1/3Vs (trigger voltage) the output becomes high again
and the discharge pin is disconnected, allowing the capacitor to start
charging again.

This cycle repeats continuously unless the reset input is connected to 0V


which forces the output low while reset is 0V.
An astable can be used to provide the clock signal for circuits such as
counters.
A low frequency astable (< 10Hz) can be used to flash an LED on and off,
higher frequency flashes are too fast to be seen clearly. Driving a
loudspeaker or piezo transducer with a low frequency of less than 20Hz will
produce a series of 'clicks' (one for each low/high transition) and this can
be used to make a simple metronome.
An audio frequency astable (20Hz to 20kHz) can be used to produce a
sound from a loudspeaker or piezo transducer. The sound is suitable for
buzzes and beeps. The natural (resonant) frequency of most piezo
transducers is about 3kHz and this will make them produce a particularly
loud sound.

Duty cycle
The duty cycle of an astable circuit is the
proportion of the complete cycle for which the
output is high (the mark time). It is usually given
as a percentage.
For a standard 555/556 astable circuit the mark time (Tm) must be greater
than the space time (Ts), so the duty cycle must be at least 50%:
Duty cycle =

Tm
Tm + Ts

R1 + R2
R1 + 2R2

555 astable circuit with diode across R2


To achieve a duty cycle of less than 50% a diode can be added in
parallel with R2 as shown in the diagram. This bypasses R2 during the
charging (mark) part of the cycle so that Tm depends only on R1 and C1:
Tm = 0.7 R1 C1 (ignoring 0.7V across diode)
Ts = 0.7 R2 C1 (unchanged)
Duty cycle with diode =

Tm
Tm + Ts

Use a signal diode such as 1N4148.


555/556 Monostable

R1
R1 + R2

555 monostable output, a single pulse

555 monostable circuit with manual trigger


A monostable circuit produces a single output pulse when triggered. It is
called a monostable because it is stable in just one state: 'output low'. The
'output high' state is temporary.
The duration of the pulse is called the time period (T) and this is
determined by resistor R1 and capacitor C1:
time period, T = 1.1 R1 C1
T = time period in seconds (s)
R1 = resistance in ohms ( )
C1 = capacitance in farads (F)
The maximum reliable time period is about 10 minutes.
Why 1.1? The capacitor charges to 2/3 = 67% so it is a bit longer than the
time constant (R1 C1) which is the time taken to charge to 63%.
Choose C1 first (there are relatively few values available).
Choose R1 to give the time period you need. R1 should be in the
range 1k to 1M , so use a fixed resistor of at least 1k in series if
R1 is variable.

Beware that electrolytic capacitor values are not accurate, errors of


at least 20% are common.
Beware that electrolytic capacitors leak charge which substantially
increases the time period if you are using a high value resistor - use
the formula as only a very rough guide!
For example the Timer Project should have a maximum time period
of 266s (about 4 minutes), but many electrolytic capacitors extend
this to about 10 minutes!

Monostable operation
The timing period is triggered (started) when the trigger input (555 pin 2) is
less than 1/3 Vs, this makes the output high (+Vs) and the capacitor C1
starts to charge
through resistor
R1. Once the time
period has started
further trigger
pulses are
ignored.
The threshold
input (555 pin 6)
monitors the
voltage across C1
and when this reaches 2/3 Vs the time period is over and the output

becomes low. At the same time discharge (555 pin 7) is connected to 0V,
discharging the capacitor ready for the next trigger.
The reset input (555 pin 4) overrides all other inputs and the timing may be

Power-on reset or
trigger circuit
cancelled at any time by connecting reset to 0V, this instantly makes the
output low and discharges the capacitor. If the reset function is not required
the reset pin should be connected to +Vs.
Power-on reset or trigger
It may be useful to ensure that a monostable circuit is reset or triggered
automatically when the power supply is connected or switched on. This is
achieved by using a capacitor instead of (or in addition to) a push switch as
shown in the diagram.
The capacitor takes a short time to charge, briefly holding the input close to
0V when the circuit is switched on. A switch may be connected in parallel
with the capacitor if manual operation is also required.
This arrangement is used for the trigger in the Timer Project.

edge-triggering circuit
Edge-triggering
If the trigger input is still less than 1/3 Vs at the end of the time period the
output will remain high until the trigger is greater than 1/3 Vs. This situation
can occur if the input signal is from an on-off switch or sensor.
The monostable can be made edge triggered, responding only to
changes of an input signal, by connecting the trigger signal through a
capacitor to the trigger input. The capacitor passes sudden changes (AC)
but blocks a constant (DC) signal. For further information please see the
page on capacitance. The circuit is 'negative edge triggered' because it
responds to a sudden fall in the input signal.
The resistor between the trigger (555 pin 2) and +Vs ensures that the
trigger is normally high (+Vs).

Example projects using 555 monostable: Adjustable Timer |


Electronic 'Lock' | Light-sensitive Alarm

Top of page | Inputs | Output | Astable | Duty Cycle | Monostable | Edgetrigger | Bistable | Buffer

555/556 Bistable (flip-flop) - a memory circuit

555 bistable circuit


The circuit is called a bistable because it is stable in two states: output high
and output low. It is also known as a 'flip-flop'.
It has two inputs:
Trigger (555 pin 2) makes the output high.
Trigger is 'active low', it functions when < 1/3 Vs.
Reset (555 pin 4) makes the output low.
Reset is 'active low', it resets when < 0.7V.
The power-on reset, power-on trigger and edge-triggering circuits can all be
used as described above for the monostable.
Example projects using 555 bistable: Quiz | Model Railway Signal

Top of page | Inputs | Output | Astable | Duty Cycle | Monostable | Edgetrigger | Bistable | Buffer

555/556 Inverting Buffer (Schmitt trigger) or NOT gate

555 inverting buffer circuit


(a NOT gate)

NOT gate symbol


The buffer circuit's input has a very high impedance (about 1M ) so it
requires only a few A, but the output can sink or source up to 200mA. This
enables a high impedance signal source (such as an LDR) to switch a low
impedance output transducer (such as a lamp).
It is an inverting buffer or NOT gate because the output logic state
(low/high) is the inverse of the input state:
Input low (< 1/3 Vs) makes output high, +Vs
Input high (> 2/3 Vs) makes output low, 0V
When the input voltage is between 1/3 and 2/3 Vs the output remains in its
present state. This intermediate input region is a deadspace where there is
no response, a property called hysteresis, it is like backlash in a
mechanical linkage. This type of circuit is called a Schmitt trigger.
If high sensitivity is required the hysteresis is a problem, but in many
circuits it is a helpful property. It gives the input a high immunity to noise
because once the circuit output has switched high or low the input must
change back by at least 1/3 Vs to make the output switch back.

of 555/556
The output of a standard 555 or 556 can sink and source up to 200mA.
This is more than most ICs and it is sufficient to supply many output
transducers directly, including LEDs (with a resistor in series), low current
lamps, piezo transducers, loudspeakers (with a capacitor in series), relay
coils (with diode protection) and some motors (with diode protection). The
output voltage does not quite reach 0V and +Vs, especially if a large
current is flowing.
To switch larger currents you can connect a transistor.
The ability to both sink and source current means that two devices can be
connected to the output so that one is on when the output is low and the
other is on when the output is high. The top diagram shows two LEDs
connected in this way. This arrangement is used in the Level Crossing
project to make the red LEDs flash alternately.
Loudspeakers
A loudspeaker (minimum resistance 64 ) may be connected to the output
of a 555 or 556 astable circuit but a capacitor (about 100F) must be
connected in series. The output is equivalent to a steady DC of about Vs
combined with a square wave AC (audio) signal. The capacitor blocks the
DC, but allows the AC to pass as explained in capacitor coupling.
Piezo transducers may be connected directly to the output and do not
require a capacitor in series.
Relay coils and other inductive loads
Like all ICs, the 555 and 556 must be protected from the brief high voltage
'spike' produced when an inductive load such as a relay coil is switched off.
The standard protection diode must be connected 'backwards' across the
the relay coil as shown in the diagram.

However, the 555 and 556 require an extra diode connected in series
with the coil to ensure that a small 'glitch' cannot be fed back into the IC.
Without this extra diode monostable circuits may re-trigger themselves as
the coil is switched off! The coil current passes through the extra diode so it
must be a 1N4001 or similar rectifier diode capable of passing the current,
a signal diode such as a 1N4148 is usually not suitable.