Thursday, January 29, 2015

darkness activated switch



           

                         DEDICATION
My humble gratitude goes directly to God Almighty who is my greatest source of inspiration and strength for seeing me through my academicals stress while pursuing this course.
I also want to specially dedicate this seminar to my parents MR. and MRS. AGBA, GOOD friends and well wisher.
Also to my honorable supervisor. MR.ONWUNEME






                    APPROVAL PAGE
This is to certify that this work was carried out by AGBA VIVIAN CHIOMA of the department of science laboratory Technology, school of industrial and applied science, Federal Polytechnic Nekede and has been read and approved as meeting the requirement for award of National diploma in science laboratory technology.
………………………….                             ……………………….                                                                    MR.ONWUNEME
(Seminar supervisor)                             Date
                                                                            
……………………………………                     ………………………..                                                                                                          MR OMENIKOLO
(Head of department physics. option)            Date

             ACKNOWLEDGEMENT
My profound gratitude goes to the Almighty GOD the one who made this work possible.
I also want to acknowledge my honorable H.O.D MR. OMENIKOLO and MY supervisor   MR.ONWUNEME
 FOR HIS time, patience, love and effort to make this work successful.
My immeasurable thanks go to my lovely, caring, and wonderful parents MR. and MRS. AGBA, friends and well wisher for their support and prayers .
Very big thanks to you, GOD BLESS YOU ALL.





                       ABSTRACT
This project is aimed at control of lighting or illumination of buildings or space using light - dependent resistor (LDR) which is able to turn ‘ON (at dusk) or OFF (at dawn) the light in the form of a switch. The approach was to design and implement darkness activated switch to control light operation in the public buildings or industrial plant where it is required to switch ON the light and switch it OFF at specific time of the day or night. The design of the device was implemented and tested and found to conform to desired objective of the project.








                    CHAPTER ONE
1.0 INTRODUCTION
This is a switch that will turn on a circuit or a device when it gets dark.  So when it is bright and there is a lot of light, the switch does not activated. However, once it gets dark, it activates and it turns on whatever device the circuit is wired to turn on.  For example, if we connect an LED to the dark-activated switch, once it gets dark, the switch will trigger and turn on the LED. We can make our circuit power on any load. However, usually it will be a light source, because that's the most useful thing to turn on when it gets dark.  This type of circuit has extreme use because when it gets dark, it will automatically turn on lights. This is extremely useful for people who may live in a house that have vision problems and need the lights to automatically turn on when it gets dark. It's also very useful for elderly people who live in a home who may have difficulty walking to turn on lights when it becomes dark.  In our circuit, we will turn on a LED as soon as the level of light reaches a certain level of darkness. Thus, the place where we place this circuit will always be illuminated, either by the natural light of the day or by the lamp of this circuit turning on when it becomes dark.

Components Needed

v  Photoresistor
v  100KΩ Resistor
v  330Ω Resistor
v  2N3904 NPN Transistor
v  LED
v  2 AA Batteries or DC Power Supply
One of the main components we will use for this circuit is a photoresistor. Photoresistors are also called light-dependent resistors (LDRs). This can be obtained at tayda electronics at the following link: Tayda Electronics- Photoresistor. If you don't have a photoresistor, just make sure to use one that has a dark resistance of 2MΩ or greater and a light resistance of about 20-30KΩ.
A photoresistor is a resistor whose resistance changes according to the amount of light that it is exposed to. When exposed to total darkness, the photoresistor's resistance is very high. This is called its rated dark resistance. For example, in our case we are using a 2MΩ photoresistor. This means that when exposed to total darkness, its resistance will be around 2MΩ. As the photoresistor is exposed to increasing amounts of light, its resistance begins to drop significantly. There is another rating on the datasheet labeled cell resistance @ illuminance. This is the resistance that the photoresistor will drop to when exposed to bright light, typically 10 lux. It is also called the light resistance (since it is the resistance the photoresistor will have when exposed to bright light). For our photoresistor, in particular the cell resistance @ illuminance is 20-30kΩ. This means the resistance of the photoresistor will drop to 20-30KΩ when exposed to 10 lux level of light So a photoresistor is basically a device that gives off very high resistance at dark light levels and low resistance at high light levels. Being that it does this, it can act as a sensor for light, or a photosensor. With the photoresistor acting as the light sensor, the other significant component is the 2N3904 transistor. The transistor in this circuit will act for a dual purpose, functioning as a switch and an amplifier. When sufficient current is driven into the base of the transistor, it acts a switch, turning the transistor on. With the transistor on, now current can flow across from the emitter of the transistor to its collector to power the load connected to the collector side of the transistor. This is how the transistor acts as a switch. It also acts as an amplifier because when a small current passes through the base, turning the transistor on, a much larger current goes from the emitter to the collector. In this way, it acts as an amplifier so that sufficient current can be produced to power on the load connected to the output of the transistor.
The power we will use for this circuit is 2 volts, which can be obtained from 2 AA batteries connected in series or from a DC power supply.


1.1    Dark-activated Switch Schematic
The schematic of the dark-activated switch circuit we will build is shown below:

Dark-activated switch circuit
So, for this circuit, 3 volts is powering the circuit. This 3 volts is in parallel to a 100KΩ resistor and the photoresistor. In the middle of these 2 components is connected the base of the NPN 2N3904 transistor.
This is how the circuit works: When exposed to bright light, the photoresistor's resistance is very low. It drops to around 20-30KΩ. Current travels through the 100KΩ resistor and then has 2 paths- it can either go through the base of the transistor or go through the photoresistor. The base of the resistor to the collector has a resistance of around 400KΩ. Current always takes the path of least resistance. When the photoresistor is exposed to bright light, its resistance is about 20-30KΩ, which is significantly less than the 400KΩ of resistance the base of the transistor has. Therefore, most of the current will go through the photoresistor and very little will go to the base of the transistor. So the base of the transistor is bypassed. Thus, the transistor does not receive enough current to turn on and power on the LED. Thus, the LED is off when there is a lot of light in the surroundings.
However, when it begins to get dark, the photoresistor's resistance becomes very high. Its resistance goes up to over 2MΩ of resistance. This creates a very high-resistance path. Being that 2MΩ is significantly greater than the 400KΩ of resistance that the base of the transistor offers, most of the current will go through the base of the transistor. This means that current does not go through the photoresistor when it is dark, due to this high resistance. Instead current goes through the 100KΩ resistor and through the base of the transistor. The transistor receives enough current to power on and turn on the LED connected to the collector terminal.
So this is how a dark-activated light circuit can work.
Again, as always, variations of this circuit can be done. Instead of using an LED, we can use any other type of lighting fixture. You may want to use a lamp. You may want to use multiple lights, so you can place different lights in parallel in one another. All you may have to do is adjust the power settings.
Just because lights seem like the most practical and useful component to place in a dark-activated switch doesn't mean you have to use any lighting component at all. Maybe you want a buzzer to go off when it gets dark or a fan to automatically go off when it gets dark or water sprinklers to go off when it gets dark. Use any component which you need to achieve the purpose of the circuit. It could be water sprinklers that go off at night time. It could be some type of sound.

1.2 How to Make a Light Activated Day Night Switch Circuit – Science Fair Project

The circuits explained here can all be used for controlling a load, normally a lamp, in response to the varying levels of the surrounding ambient light. The circuit can be used as a commercial automatic street light control system, as a domestic porch light or corridor light controller or simply can be used by any school kid for displaying the feature in his school fair exhibition.
The following content describes four simple ways of making a light activated switch using different methods. 
The first diagram shows how the circuit can be configured using transistors, the second and the third circuits demonstrate the principle by using CMOS ICs while the last circuit explains the same concept being implemented using the ubiquitous IC 555.
Let’s evaluate the circuits one by one with the following points:
The first figure shows the use of a couple of transistors in association with a few other components lke resistors for the construction of proposed design.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfd4_egkmvJlqGZUxF3ghuBOKiNSeUGrJWfCb2qEbO00jXZ3_3yU_QbTigJpdEWJN47gC1UZ0UrKzuwGnzowCeiTMG8c3aLrMfc1zq1OO8CpDoCUB-8bCZkcZKhRv62Fr0fgUgwh9KN8lf/s320/automatic%20street%20light%20system.png
The transistors are rigged as inverters, meaning when T1 switches, T2 is switched OFF and vice versa.
The transistors T1 is wired as a comparator and consists of an LDR across its base and the positive supply via a preset.
The LDR is used for sensing the ambient light conditions and is used for triggering T1 when the light level crosses a particular set threshold. This threshold is set by the preset P1.
The use of two transistors particularly helps to reduce the hysteresis of the circuit which would have otherwise affected the circuit if only a single transistor would have been incorporated.
When T1 conducts, T2 is switched OFF ans so is the relay and the connected load or the light.
The opposite happens when the light over the LDR falls or when darkness sets in.
The second and the third figure incorporates CMOS ICs for executing the above functions and the concept remains rather similar. The first circuit out of the two utilizes the IC 4093 which is quad two-input NAND gate IC.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_J6DC9WyCNBpPy7YXl7hRn0dKTfVzTbpVXInG-gW8JoXzFrAr0avN-2UrE1oVUvjY1LPj3VzSEzsuCVTIQbWqprx1CeTUdbMQpa2mTOYH1kOpQogbg5sJDTslAIL7MONByA2-Hpq1872g/s320/Light+Switch.png
Each of the gates are formed into inverters by shorting its both the inputs together, so that the input logic level of the gates now get effectively reversed at thie outputs.
Though a single NAND gate would be enough for implementing the actions, three gates have been engaged as buffers for getting better results and in a view of utilizing all of them as in any case three of them would be left idle.The gate which is responsible for the sensing can be seen accompanied with the light sensing device LDR wired across its input and the positive via a variable resistor. 
This variable resistor is used for setting the triggering point of the gate when the light falling over the LDR reaches the desired specified intensity.
As this happens, the gate input goes high, the output consequently becomes low making the outputs of the buffer gates high. The result is the triggering of the transistor and the relay assembly. The connected load over the relay now flips into the intended actions.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSMSxgB7hUQlJGwNF8Hthl1g5LCCXkThQj43VGt1VlTET_k5niVJVET1vJPpLvzeHUiBZpUCo2tV3PZw2cE3tSod8LgqyP7VixiDxwj1zxFRtDKYu_HtYaWGZ7eZv5BvIkTKLdplc4RUUk/s320/Light+Switch1.png
The above actions are exactly replicated using the IC 4049 which is also wired with similar configuration and is quite explanatory.
The last figure illustrates how the IC 555 may be configured for executing the above responses.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIxpa4vRQJWzInmnhDJqCrtlIOQTcD7WEgSNyWoLO77-XS1WW3Iais09cYkyhiOuEYan0CHN0RWJuiZquhGDyfPGoZKVZhGrwYbd7qfa2ZACqfLbyZQgOm31e7lPaGPA78sPawgbVZUpmb/s320/light+activated+switch+circuit.png
Parts List
R1 = 1M
R3 = 2m2
C1 = 0.1uF
Rl1 = 12V, SPDT,
D1 = 1N4007,
N1----N6 = IC 4049
N1----N4 = IC 4093
IC1 = 555.
A Light / Dark activated switch is a circuit that will somehow measure the light level and will turn on or off a relay accordingly. We will use an LDR (Light Depended Resistor) to measure the light level. Also, we will not demonstrate only one circuit but instead, three circuit will be put under the microscope. Each one will have different characteristics but the operation will be the same.
The first circuit - The blind man's sensor
http://www.pcbheaven.com/circuitpages/images/thumbs/darkswitch_1245003905.jpg
The circuit assembled on a breadboard
The circuit is is a simple transistor switch with the base of the transistor connected to a voltage divider. The voltage divider has two resistors. The first is the 100K potentiometer plus the protective 1K resistor. the second resistor is the LDR. This is the schematic of the circuit:
http://www.pcbheaven.com/circuitpages/images/darkswitch_1245000373.jpg
As light falls on the surface of the LDR, the LDR changes it's resistance. The more the light, the less the resistance of the LDR, the less the resistance, the less the voltage drop across it. The less the light, the more the resistance and thus the more the voltage drop across it.
As the voltage drop increases, so does the VB of the 2N2222 transistor and therefore the ICE increases accordingly, until the time that the current is enough to actuate the relay.
The amount of light needed to actuate the relay can be changed by changing the 100K potentiometer. Basically, any change to the potentiometer will have an effect to the voltage drop of the LDR, as they are both members of the voltage divider described above.
The 1N4001 diode is used to eliminate any back voltage when the relay is disarmed. It is very important to have this diode because without it, the transistor may be damaged.

The second circuit - Increased sensitivity
http://www.pcbheaven.com/circuitpages/images/thumbs/darkswitch_1245081180.jpg
This has a better sensitivity than the previous
The above circuit works fine as far as the activation is concerned. There will be no problem to detect dark or light and actuate the relay, but there will be a problem when the relay needs to be released back again. At this point, the circuit has a big hysteresis. therefore, we need to further amplify the signal before we apply it to the switching transistor.
We will use the BC517 NPN Darlington pair transistor. We will put it between the 2N2222 and the LDR, as the following circuit indicates:

http://www.pcbheaven.com/circuitpages/images/darkswitch_1245012151.jpg
With this addition, the sensitivity of the circuit is further increased. The hysteresis window is significantly decreased, although there is still a region that when the relay is activated, it will not be deactivated with the same amount of light that existed just before it's activation.

Selecting different parts
The above circuits may work with different voltage and/or parts. For example, you may change the voltage to 5 volts, but you should then consider changing the 1K resistor into 560 Ohms, the potentiometer into 10K and the relay of course must have the appropriate coil voltage.
You may use any kind of NPN transistor for switching the relay, as long as it is capable to work under your selected voltage and also be able to provide enough current (ICB) for the relay.

Adjusting the circuits
Only one adjustment needs to be made and that would be (of course) the potentiometer. Your goal is to make the circuit actuate the relay when you have equal or less light to the pre-defined value. The easiest way to do this is as follows:
Let the LDR be lighted with the amount of light you want. Keep the potentiometer into it's highest value. Then start slowly turning the potentiometer and reducing it's resistance. When you hear the 'click' of the relay, you have found your set point. From then on, every time the light is less or equal (or more if the circuit is configured as "light activated") to the light that you made this pre-setting, the relay shall be activated.

Convert into light detectors
The above circuits operate as dark detectors. This means that when the light level falls under a preselected value (read previous paragraph), the relay is actuated. In case you want a light detector that will actuate the relay when the light level is increased above the preselected value, just remove the protective 1K resistor and switch places between the LDR and the potentiometer, readjust and that's it.

The third circuit - Sensitivity to higher levels!!!
The next circuit has nothing to do with the above. It uses a 741 op-amp to achieve maximum sensitivity. This circuit can sense very slight light changes and can be really fine adjusted. Let's take a look at the circuit:
http://www.pcbheaven.com/circuitpages/images/darkswitch_1245080829.jpg
http://www.pcbheaven.com/circuitpages/images/thumbs/darkswitch_1245081187.jpg
This circuit has so much sensitivity and so low reaction time, that is sometimes improper to be used. As you may have notice, the 741 is connected as a voltage comparator. Two voltage dividers are easy to be found: The first one is the LDR and the 100K resistor. The second one is composed by the two 470 Ohms resistors and the potentiometer. Both the outputs of the dividers are connected as inputs to the voltage comparator.
The second voltage divider will settle the reference voltage. The first voltage comparator that contains the LDR, will change it's voltage according to the light level. When the voltage across the negative input of the comparator is less than the voltage to the positive input of the comparator, the output is held low. When the voltage on the negative input rises, there will be a time that it becomes greater than or equal to the positive (pre-selected) voltage, and then the output becomes high and the relay through the 2N2222 is actuated Selecting different values. As long as the transistor is concerned, any NPN switching transistor capable to drive your relay will do. As for the LDR, you need to make sure that it pairs with the 100K resistor. This means that the mid-value of the LDR is almost the same as this resistor. Any pair will work theoretically, but i have not test others than this pair. If you have problems please let me know. The circuit is designed to work with 12V, but it can operate in lower voltages as well, as long as you make sure you select the right relay for the occasion.
Convert into light detector
This circuit, just like the previous two circuit, operate as dark activated switch. If you want to change the functionality of this circuit, simply exchange places between the 100K resistor and the LDR.This section could also be named "advantages and disadvantages". But i chose this name as my goal is to help you find the proper circuit for each occasion. Also, it would be unfair for a circuit to name advantages or disadvantages in it's name, as there are actually none! Instead, there is proper and improper use and/or application for each one of them.
http://www.pcbheaven.com/circuitpages/images/thumbs/darkswitch_1245082853.jpg
Starting with circuit #1. This is a very easy and cheap circuit. Excluding the relay, it would cost about a Euro or less. This circuit is proper for detecting large light changes. I would use it for example if i wanted to detect the light in my room or in a hall if it works or not. Small changes like shadows and staff does not affect this circuit and thus it gives a straight answer to the question: - Is the light turned on? Is my car's rear stop light working?
The second circuit on the other hand is much more sensitive to changes. The Darlington pair transistor will significantly increase the slight current changes from the LDR. Still there is a big window between activation and deactivation of the relay. This makes it ideal for outdoor uses to detect if there is ambient light. It could be perfect for example to control your automatic lights. It will not be affected by shadows from a bird flying against the sun or a cat is passing near by the sensor trying to catch this bird. Or even the human with larger shadow area, that tries to save the bird from the cat. Nevertheless, it will be accurate as far as the light level detection is concerned. The automatic lights shall indeed be turned off when the sun start shining the day.
The third and last circuit is the most accurate and the most sensitive. If for example a shadow falls and covers the 2/5 of the LDR it may not actuate the relay, but if the shadow covers the 3/5 it may actuate it. Small light changes may result into relay state change. This makes it completely inappropriate for the pre-mentioned applications. It would be very good in human detection from light level changes. For other applications, you should consider adding a delay circuit at the output of the 741. If the light level is very close to the preselected value, the relay will flicker due to the almost zero light level window that with this circuit is accomplished. It would also work very well as light signal receiver.
1.4 SPECIFICATION AND THEORY

 12 Volt 10 Amp Dark Activated Switch

A kit with the circuit board and parts for this circuit is available from CirKits.
DAS1 Schematic

DAS1 - 12 Volt 10 Amp Dark Activated Switch

(C) 2007, G. Forrest Cook, The DAS1 is a combination manual switch and automatic dark-activated switch. It is designed to control up to 10 amps of 12V lights. A pair of high-intensity white LEDs are included in the circuit for built-in lighting. The circuit includes a low voltage disconnect circuit that prevents excessive battery discharge on battery operated systems. The DAS1 is ideal for solar powered lighting systems, it can also be used for line powered and automotive/marine applications. External 12V lights consisting of white LEDs, incandescent lamps and/or fluorescent lamps can be driven by the DAS1. The design goals of this circuit were efficiency, simplicity, reliability and the use of field replaceable parts. The DAS1 circuit is designed to work in conjunction with the SCC3 Solar Charge Controller, which is also available in Kit form.
When using a solar-charged battery with the DAS1 circuit, the battery's amp-hour rating should be matched to the photovoltaic panel's charging capacity and the desired lamp load's discharging capacity.
Specifications
Supply voltage: 12V (nominal).
Maximum lamp control current: 10A at 12V.
Day/Night battery current drain (off): < 10 microamps
Day battery current drain (auto): 5mA @ 12.8V
Night battery current drain (on or auto, no external load): 27mA @ 12.8V
See the full DAS1 kit specifications for more details.
Here are the DAS1 kit alignment instructions.
My FC's LED Circuits page has a number of 12V lamps that will work nicely with the DAS1.

Theory

12VDC power is supplied to the DAS1 circuit via connector CN1. Diode D1 protects the circuit from reverse supply voltage, if the supply is reversed, fuse F1 blows. Power is routed to the control circuitry through switch S1 and schottky diodes D2 or D3. With the switch in the Auto position, power is sent to the CdS cell via the level changing circuitry consisting of transistors Q4 and Q3. When the switch is in the On position, Q4 and Q3 are off, simulating a dark condition on the CdS cell.
Regulator VR1 lowers the supply voltage to a constant 8V for powering the control circuitry. Op-Amp IC1a is wired as a voltage comparator circuit, it functions as the Low Voltage Disconnect. When the supply voltage is above the LVD setpoint, the sense line on IC1a pin 2 is above the reference voltage on IC1a pin 3 and the output of IC1a is low. When the supply voltage drops below the LVD setpoint, the output of IC1a goes high, disabling the light sensor circuit and shutting off power to the load. Resistor R11 provides hysteresis action on the LVD circuit, preventing oscillation when the supply voltage is near the LVD setpoint. Variable resistor RV1 adjusts the low voltage disconnect setpoint.
Op-amp IC1b is wired as another voltage comparator circuit, it measures the light level on pin 6. Bright light on the CdS cell cause the voltage on pin 6 to rise above the reference voltage on IC1b pin 5, this in turn causes the IC1b output on pin 7 to go low. Low light on the CdS sensor causes the voltage on IC1b pin 6 to go below the pin 5 reference voltage and the IC1b output will go high. Resistor R6 provides hysteresis to the light sensor circuit, preventing light flicker at dusk and dawn. Variable resistor RV2 adjusts the dark turn-on point.
The IC1b output signal is sent to transistor Q1, which pulls the gate of power MOSFET Q1 down (on) or up (off). Q1 controls the flow of current from the supply to the external load pins on CN1. The two white LEDs are connected across the external load pins through current limiting resistor R1.

1.5 USE DASI BATTERY TERMINALS

Connect the battery to the DAS1 battery terminals. Connect the external lamps to the DAS1 load terminals. The light sensitive CDS cell can either be screwed directly to the two CDS screw terminals on the DAS1 circuit board, or remotely mounted. The CDS cell should be placed in a location that is not affected by the onboard LEDs or any external lamps. If the CDS cell is to be remotely mounted more than 5 feet from the DAS1 circuit board, two conductor shielded cable should be used. The remote CDS sensor should connect to the DAS1 via the two internal wires and the shield conductor should be connected to the DAS1 load - screw, the shield should be left floating on the CDS sensor end.
When the DAS1 switch is put in the ON position, the two onboard white LEDs and the external lamp(s) will light up. When the DAS1 switch is put in the AUTO position, the two onboard LEDs and the external lamp(s) will light up if the CDS sensor is in the dark.
The DAS1 can also be used as an automatic 10 amp low voltage disconnect (LVD) switch by simply placing the circuit in ON mode.
If the DAS1 is operated from battery power, the onboard and external lamps will turn off as soon as the battery voltage drops below the LVD setpoint. The low voltage disconnect function works for both ON and AUTO settings.
      





                 CHAPTER TWO
2.0 LITERATURE REVIEW on darkness activated switch
A Light / Dark activated switch is a circuit that will somehow measure the light level and will turn on or off a relay accordingly. We will use an LDR (Light Depended Resistor) to measure the light level. Also, we will not demonstrate only one circuit but instead, three circuit will be put under the microscope. Each one will have different characteristics but the operation will be the same.

The first circuit - The blind man's sensor
http://www.pcbheaven.com/circuitpages/images/thumbs/darkswitch_1245003905.jpg
The circuit assembled on a breadboard
John mindell (2005),during his project research said that The circuit is is a simple transistor switch with the base of the transistor connected to a voltage divider. The voltage divider has two resistors. The first is the 100K potentiometer plus the protective 1K resistor. the second resistor is the LDR. This is the schematic of the circuit:

http://www.pcbheaven.com/circuitpages/images/darkswitch_1245000373.jpg
He further said As the light falls on the surface of the LDR, the LDR changes it's resistance. The more the light, the less the resistance of the LDR, the less the resistance, the less the voltage drop across it. The less the light, the more the resistance and thus the more the voltage drop across it.
As the voltage drop increases, so does the VB of the 2N2222 transistor and therefore the ICE increases accordingly, until the time that the current is enough to actuate the relay.
The amount of light needed to actuate the relay can be changed by changing the 100K potentiometer. Basically, any change to the potentiometer will have an effect to the voltage drop of the LDR, as they are both members of the voltage divider described above.
The 1N4001 diode is used to eliminate any back voltage when the relay is disarmed. It is very important to have this diode because without it, the transistor may be damaged.
The second circuit - Increased sensitivity
http://www.pcbheaven.com/circuitpages/images/thumbs/darkswitch_1245081180.jpg
This has a better sensitivity than the previous
 The second circuit which has an an increased sensitivity during the experiment done by Gaymer martin(2006),he observed that the  above circuit works fine as far as the activation is concerned,that There will be no problem to detect dark or light and actuate the relay, but there will be a problem when the relay needs to be released back again.He further said the circuit has a big hysteresis at a point therefore,he amplify the signal  before he apply it to the switching transistor.He used the BC517 NPN Darlington pair transistor and he put it between the 2N2222 and the LDR, as the following circuit indicates:

http://www.pcbheaven.com/circuitpages/images/darkswitch_1245012151.jpg
With this addition,he concluded in his experiment that the sensitivity of the circuit is further increased, The hysteresis window is significantly decreased, although   there is still a region that when the relay is activated, it will not be deactivated with the same amount of light that existed just before it's activation.The above circuits may work with different voltage and/or parts. For example, you may change the voltage to 5 volts, but you should then consider changing the 1K resistor into 560 Ohms, the potentiometer into 10K and the relay of course must have the appropriate coil voltage.
Bryan Daniel(2006) added to the previous experiment that any kind of NPN transistor can be used for switching the relay, as long as it is capable to work under your selected voltage and also be able to provide enough current (ICB) for the relay.He observed that Only one adjustment needs to be made and that would be (of course) the potentiometer. His goal is to make the circuit actuate the relay when you have equal or less light to the pre-defined value. The easiest way to do this is as follows:
The LDR was lighted with the amount of light you want.    The potentiometer was kept into it's highest value and it was turned slowly to reduce its resistance. The click' of the relay was heard and the set point was found. From then on, every time the light is less or equal (or more if the circuit is configured as "light activated") to the light that you made this pre-setting, the relay shall be activated. He further converted it into the light detectors, the above circuits operate as dark detectors. This means that when the light level falls under a preselected value (read previous paragraph), the relay is actuated. In case you want a light detector that will actuate the relay when the light level is increased above the preselected value, just remove the protective 1K resistor and switch places between the LDR and the potentiometer, readjust and that was it. The third circuit which was sensitive to higher levels as Adam peece(2008),experimented using a 741 op-amp to achieve maximum sensitivity. This circuit can sense very slight light changes and can be really fine adjusted. as the circuit below shows:

http://www.pcbheaven.com/circuitpages/images/darkswitch_1245080829.jpg
http://www.pcbheaven.com/circuitpages/images/thumbs/darkswitch_1245081187.jpg
This circuit has so much sensitivity and so low reaction time, that is sometimes improper to be used. As you may have notice, the 741 is connected as a voltage comparator. Two voltage dividers are easy to be found: The first one is the LDR and the 100K resistor. The second one is composed by the two 470 Ohms resistors and the potentiometer. Both the outputs of the dividers are connected as inputs to the voltage comparator. Gbenga Adewale(2008),added to this research that the second voltage divider will settle the reference voltage. The first voltage comparator that contains the LDR, will change it's voltage according to the light level. When the voltage across the negative input of the comparator is less than the voltage to the positive input of the comparator, the output is held low. When the voltage on the negative input rises, there will be a time that it becomes greater than or equal to the positive (pre-selected) voltage, and then the output becomes high and the relay through the 2N2222 is actuated. He further selected different values as long as the transistor is concerned, any NPN switching transistor capable to drive your relay will do. As for the LDR, you need to make sure that it pairs with the 100K resistor. This means that the mid-value of the LDR is almost the same as this resistor. Any pair will work theoretically, but i have not test others than this pair. If you have. The circuit is designed to work with 12V, but it can operate in lower voltages as well, as long as you make sure you select the right relay for the occasion. He tried to convert it into light detectors as this circuits operate as dark activated switch. If you want to change the functionality of this circuit, simply exchange places between the 100K resistor and the LDR. This section could also be named "advantages and disadvantages". But i chose this name as my goal is to help you find the proper circuit for each occasion. Also, it would be unfair for a circuit to name advantages or disadvantages in it's name, as there are actually none! Instead, there is proper and improper use and/or application for each one of them. Starting with circuit #1. This is a very easy and cheap circuit. Excluding the relay, it would cost about a Euro or less. This circuit is proper for detecting large light changes. I would use it for example if i wanted to detect the light in my room or in a hall if it works or not. Small changes like shadows and staff does not affect this circuit and thus it gives a straight answer to the question: - Is the light turned on? Is my car's rear stop light working?
The second circuit on the other hand is much more sensitive to changes. The Darlington pair transistor will significantly increase the slight current changes from the LDR. Still there is a big window between activation and deactivation of the relay. This makes it ideal for outdoor uses to detect if there is ambient light. It could be perfect for example to control your automatic lights. It will not be affected by shadows from a bird flying against the sun or a cat is passing near by the sensor trying to catch this bird. Or even the human with larger shadow area, that tries to save the bird from the cat. Nevertheless, it will be accurate as far as the light level detection is concerned. The automatic lights shall indeed be turned off when the sun start shining the day.
The third and last circuit is the most accurate and the most sensitive. If for example a shadow falls and covers the 2/5 of the LDR it may not actuate the relay, but if the shadow covers the 3/5 it may actuate it. Small light changes may result into relay state change. This makes it completely inappropriate for the pre-mentioned applications. It would be very good in human detection from light level changes. For other applications, you should consider adding a delay circuit at the output of the 741. If the light level is very close to the preselected value, the relay will flicker due to the almost zero light level window that with this circuit is accomplished. It would also work very well as light signal receiver.

                  CHAPTER THREE

3.0 Dark-activated switch and its components

Assume that you have a device that receives its power from the main 120 or 220V-ac line and you need to add a switch between the ac line and the device so that the device works only when it is dark. Although you may think this task would be trivial, it is difficult to find a workable approach because most of the published schematics need 6 to 12V-dc power supplies and relays. Several off-the-shelf dark-activated switches, such as devices from Suns International, are available, but they’re expensive for a consumer product. After looking at products from dozens of Web sites, you may decide to make your own. The solution is simple and inexpensive.

3.1 Dark Activated Switch Circuit and Working Functionality

Light Activated SwitchThe controlling of street lights is usually maintained by an electrical department’s technician on several occasions. This is not only precarious but also sometimes results in wastage of power because of the negligence or unusual circumstances on part of the technician in operating the street lights on and off. Not only in case of street lights, even for controlling the home appliances like garden or outdoor lights, we can utilize the light activated switch for automatic switching of the lights based on daylight’s intensity by using a light sensor.

What is a Light Activated Switch?

Light Activated Switch is a simple electrical project circuit by which we can switch on and off the electrical load appliances like lights, fans, coolers, air conditioners, street lights, etc., automatically based on the day-light intensity instead of manually operating the switches.
By using this method, manpower can be reduced to a great extent. In case of the street lights erected on highways it is not an easy task to manually control them, but, if uncontrolled, the chances of power wastage would increase. To get rid of this situation, the implementation of automatic light switch by using a light sensor that switches lights automatically on and off is the best option.
Light Sensor
There are different types of light sensors available, but for better efficiency of the system, LDR (Light Dependent Resistor) is used as sensor light switch in this light activated switch kit. The LDR sensor has some special features as it changes its resistance with the change in the daylight intensity. LDR is rugged in nature, hence can be used even in dirty and rough external environments like outdoor lighting of homes and in automatic street lights as well.

LDR Resistance Variation With Light
Light Dependent Resistor or photoresistor or photocell is a variable resistor controlled by light intensity. It is made of high resistance semiconductor material like Cadmium Sulphide that exhibits photoconductivity.
Light Intensity Vs LDR Resistance
Light Intensity Vs LDR Resistance
In dark, the LDR has very high resistance of around a few MΩ (Mega Ohms) and in the light, its resistance decreases to around a few 100Ω (hundred Ohms). Hence, its resistance is inversely proportional to the light intensity.
As shown in the above figure, the LDR consists of a wave-shaped design on the top surface of it with two terminals similar to a general resistor, and the graph represents the inverse proportionality of the LDR with the light intensity.
The major drawback of the LDR is that, it is sensitive to even artificial light.
Darlington Pair
Instead of a single transistor, a back-to-back connection of two transistors is used in a circuit which is termed as Darlington pair; this can also be considered as a single transistor with a very high current gained compared to general transistor. The input to the load given through a Darlington pair can be derived as a product of the input current and gain of the transistor. We know that, for switching on a transistor, the base voltage must be greater than 0.7v – but, for a Darlington pair, this base voltage must be 1.4v as there are two transistors need to be switched on.
Relay
A relay plays a vital role in the main circuit for activating the load or connecting the load (which is intended to be controlled by using LDR) to the main circuit as well as to the AC mains. The relay consists of a coil which gets energized if it gets enough supply depending on the rating of the relay.

3.2 Light Activated Switch’s Working Functionality

A light activated switch kit is an electronic kit consisting of LDR, Darlington pair and Relay as connected in the main circuit, as shown below. A supply of 230v AC is fed to the load (in this case, a lamp).
The circuit shown below requires a DC voltage, which can be supplied from a battery or by using a bridge rectifier instead of the battery. This bridge rectifier converts the 230v AC supply into a 6v DC. The bridge rectifier uses a step-down transformer to step-down the 230v into 12v. The diodes connected in the form of a bridge convert the 12v AC into 12v DC, and the IC7806 voltage regulator converts the 12v DC into 6v DC, and then, this is supplied to the circuit. A continuous 230v AC supply is maintained for both the load and the bridge rectifier.
Light Activated Switch Circuit
Light Activated Switch Circuit
During the day time, the LDR has very-low resistance of around a few 100Ω, and then the entire supply is passed through the LDR and gets grounded through the resistor and variable resistor as shown in the circuit. This is due to the fact that the resistance offered by the LDR is less compared to the remaining path (Relay and Darlington pair) of the circuit. As we know that the principle current always chooses the low resistance path to flow. Hence, the relay coil does not get energized as it has not got enough supply. Thus, the load remains switched off during the daylight.
Similarly, during the night time (when the daylight intensity is very less), the LDR resistance becomes very high: around a few Mega ohms (approximately 20MΩ). Thus LDR offers a very-high resistance (almost an open circuit type), and hence, opposes the flow of current. Again, according to the principle of current, by choosing low-resistance path, no current flows through the LDR, and thus, the current chooses an alternate path to flow such that it causes the Darlington pair base voltage to increase more than 1.4v. Thus, the Darlington pair gets activated, and then the relay coil gets energized, and thus, turns the load to switch on.
Thus, if the intensity of the daylight falling on the LDR of the light-activated switch is high (during the day time/morning time), then the load will be turned off – and, if the intensity of day light is low (during the night time), the load will be turned on.

3.3 Applications of Light Activated Switch

v  Useful for automatic outdoor lighting or garden lighting at home.
v  Useful for automatic switching of street lights.
v  Useful for switching the hoardings on and off automatically.
v  Useful for self-switching operation of displaying title hoardings of companies.
v  Useful as a light detector circuit.
v  Useful as a dark activated switch.

Example: Project by using Light Activated Switch (LDR):

Electronic Eye Controlled Security System

The Electronic Eye Controlled Security System project is based on the electronic eye, which utilizes LDR sensor. The circuit shown below consists of supply circuit with step-down transformer, bridge rectifier, battery and regulator, CD4060 is a ripple carry binary counter connected with transistors and these are connected to relay and buzzer. AC supply is maintained at load which is connected to the relay.
Project by using Light Activated Switch (LDR) From Edgefx TechnologiesProject by using Light Activated Switch (LDR) From Edgefx Technologies
The 14 stage ripple binary counter is used to sense light intensity through the LDR. If light falls on LDR (light intensity is more) then its resistance will be very high as we studied in this article. Hence the transistors are not activated; no supply will be there for relay and buzzer.
If light intensity decreases or some darkness falls on LDR (when a person causes to fall dark shadow on LDR of this circuit) then, its resistance will decrease drastically and thus the ripple counter activates the transistors further these transistors activates buzzer and load (light) connected to relay indicating some theft.
This project can be implemented for security at cash boxes, lockers at banks, homes, etc where security is intended.
Finally, this article concludes with a brief discussion about the light activated switch along with the working of its circuit and its major blocks in brief and also listed a few applications of it too. One application of LDR as Electronic Eye Controlled Security System project is explained above. If you want more information, please post your queries by commenting below.
Photo Credits:
3.4 A Simple and Cheap Dark-Detecting LED Circuit
Components   Complete
Here’s a simple problem: “How do you make an LED turn on when it gets dark?” You might call it the “nightlight problem,” but the same sort of question comes up in a lot of familiar situations– emergency lights, street lights, silly computer keyboard backlights, and the list goes on.
Solutions? Windel (2007) said the time-honored tradition is to use a circuit with a CdS photoresistor, sometimes called a photocell or LDR, for “light-dependent resistor.” (Circuit Example 1, Example 2.) Photoresistors are reliable and cost about $1 each, but are going away because they contain cadmium, a toxic heavy metal whose use is increasingly regulated. There are many other solutions as well. Look here for some op-amp based photodetector circuits with LED output, and check out some of the tricks used in well-designed solar garden lights, which include gems like using the solar cell itself as the sensor. In this article we show how to build a very simple– perhaps even the simplest– darkness-activated LED circuit. To our LED and battery we add just three components, which cost less than thirty cents altogether (and much less if you buy in bulk). You can build it in less than five minutes or less (much less with practice). What can you do with such an inexpensive light-controlled LED circuit? Almost anything really. But, one fun application is to make LED throwies that turn themselves off in the daytime to save power. Throwies normally can last up to two weeks. Adding a light-level switch like this can significantly extend their lifetime.
Components
Here are our components: On top: a CR2032 lithium coin cell (3 V). On the bottom (L-R): the LED, an LTR-4206E phototransistor, a 2N3904 transistor, and a 1 k resistor.
This LED is red, blindingly bright at 60 candela, in a 10 mm package. It
casts a visible beam, visible for about twenty feet in a well-lit room. We got the LEDs and batteries on eBay, and the other parts are from Digi-Key, but Mouser has them as well. As we mentioned, the last three cost about $0.30 all together, and much less in bulk. The LTR-4206E is a phototransistor in a 3mm black package. The black package blocks visible light, so it is only sensitive to infrared light– it sees sunlight and incandescent lights, but not fluorescent or (most) discharge lamps– it really will come on at night. Our starting point is the simplest LED circuit: that of the LED throwie, which has an LED driven directly from a 3V lithium coin cell. From this, we add on the phototransistor, which senses the presence of light, and we use its output to control the transistor, which turns the LED on.
Diagram
The circuit diagram looks like this; when light falls on the phototransistor, it begins to conduct up to about 1.5 mA, which pulls down the voltage at the lower side of the resistor by 1.5 V, turning off the transistor, which turns off the LED. When it’s dark, the transistor is able to conduct about 15 mA through the LED. So, the circuit uses only about 1/10 as much current while the LED is off. One thing to note about this circuit: We’re using a red LED. That’s because the voltage drop across the transistor allows less than the full 3 V across the LED. The full three volts is really only marginal for driving blue LEDs anyway, so two-point-something really doesn’t cut it. And now, let’s build it. You can certainly put this together on a breadboard, but there’s something more satisfying about the compact and deployable build that we walk through here.

Transistor, resistor   1 k resistor
First get the transistor and the resistor. The pins of the 2N3904 are called (left-to-right) Emitter, Base, Collector, when viewing it from the front such that you can read the writing. We’re going to solder the resistor between the leads of the Base and Collector of the transistor. Unusual part: hold the resistor with its leads at 90 degrees to those of the transistor while you solder. After soldering, clip off the excess resistor lead that is attached to the transistor base (middle pin), as well as the excess length of the collector pin.
Phototransistor   Phototransistor added
Next, we add the phototransistor. Note that it has a flatted side, much like an LED does. This pin on that side is the collector of the phototransistor. Solder the collector (flatted side) to the middle pin (the base) of the transistor, again at 90 degrees. The other pin of the phototransistor, the emitter, is left unconnected for the moment. (Here is an alternate view of what that should look like when you’re done.)
Finally, we need to add the LED. To do so, we need to know which side is the “positive,” or anode side of the device.
Regrettably markings of LEDs are not consistent, so the best way to be sure is to test it with the lithium coin cell– put the LED across the terminals of the cell and, when it lights up, note which side is touching the (+) terminal. (Usually, it’s the one with the longer lead.) Solder the “positive” lead of the LED to the emitter pin of the transistor– it’s the one on the left, which doesn’t have anything soldered to it. Trim away the excess lead of the LED that goes past the solder joint. Solder the other pin of the LED (the “negative” pin, or cathode) to the emitter of the phototransistor, the pin on the non-flatted side, which does not have anything connected to it yet.
With LED, trimmed
By this point, there are only two pins sticking down below the components: One that goes to the resistor and collector (rightmost pin) of the transistor, and one that goes to the emitter of the phototransistor and to the cathode of the LED. To test the circuit, squeeze the coin cell between these two terminals, positive side goes to the lead touching the resistor. You can’t see the LED on here because these photos were taken with incandescent lighting– it wouldn’t turn on.                                         
lights off?
Bending the leads to contact the lithium cell a little more reliably, you can try it out a little more easily. In the photo on the right, I cupped my hand over the circuit– so the LED turned on.
throwie! 
To make this into an actual “throwie,” you still need to add some tape and a magnet, but that’s quite easily done. This one makes a pretty good nightlight attached to the top of a doorframe– when the room lights are off, it shines a bright, bright spot on the ceiling.
Where to go from here? While this little circuit can do something on its own, it would probably also be happy as part of a larger circuit. At a minimum, note that if you work with batteries that have lower internal resistance than the lithium coin cells, you should place an appropriate resistor in series with the battery before trying to operate this circuit– or else you may put too much current through the LED. Certainly, this is one of the easiest and least expensive ways to control an LED with a photosensor.





               CHAPTER FOUR
4.0 CONCLUSION AND RECOMMENDATION
4.1 CONCLUSION
The Dark-Detecting LED is a fun and simple circuit, but can easily be upgraded to the next level.

One obvious challenge is to ask yourself, "How to operate this circuit using a white or blue LED?" These typically have a higher forward voltage than red LEDs, and will require some different components to activate the circuit.
Try experimenting with connecting the circuit to a small solar panel and rechargeable power supply, so the batteries juice up during the day and the circuit automatically switches on and lights the LED at night!
What about combining the Dark-Detecting LED with a
joule thief circuit? Encase everything in a wristband or necklace pendant that only lights up - powered by "dead" batteries! - when the lights go down. check for loose soldering if the circuit is not working, when connecting the circuit as a switch for electrical appliances the risk of getting shock is high, always use precautions when doing so.
RECOMMENDATION
The circuit in Figure 1 employs an internally triggered triac, which Teccor Electronics originally developed. The primary purpose of any triac is bidirectional-ac switching. The Quadrac triac has a built-in triggering device with the threshold-voltage level of approximately 40V. To achieve this level, the circuit uses a voltage divider comprising a photocell and resistor R1. When you light the photocell, its voltage drop is lower than the triggering level of the threshold voltage, and Q1 is locked, so the load disconnects from the ac line. When it becomes dark, the peak voltage amplitude on the photocell increases to 40V, opening Q1 and making the load connect to the power line.
The choice of Q1 depends on the load current and ac-line voltage. This circuit uses the Q4004LT from Littelfuse with a maximum current of 4A rms and a voltage of 400V. You can use any photocell, but this circuit uses and off-the-shelf model and accordingly uses a value of 47 kΩ for R1 to achieve reliable switching. For an inductive load, add a 100Ω resistor in series with a 0.1-µF capacitor between pins 1 and 2 of Q1.




REFERENCES
1.         Ed Catherall. Exploring Light. Exploring Science Series. Wayland, East Sussex, England, 1989. 48 p. ISBN 1-85210-703-0.
2.         Neil Ardley. The Science Book of Light. Harcourt
    Brace Jovanovich, 1991.
     3. Osterlund, M.T., Hardtke, C.S., Wei, N., and
    Deng, X.W. (2000). Targeted destabilization
    of HY5 during light-regulated development of
    Arabidopsis. Nature405, 462–466.
4. Castillon, A., Shen, H., and Huq, E. (2007).
Phytochrome Interacting Factors: central
players in phytochrome-mediated light
signaling networks. Trends Plant Sci.12,514–521.
5. Khanna, R., Huq, E., Kikis, E.A., Al-Sady, B.,
Lanzatella, C., and Quail, P.H. (2004). A novel
molecular recognition motif necessary for
targeting photoactivated phytochrome
signaling to specific basic helix-loop-helix
transcription factors. Plant Cell16, 3033–3044.
6. Al-Sady, B., Ni, W., Kircher, S., Schafer, E., and Quail, P.H. (2006). Photoactivated phytochromeinduces rapid PIF3 phosphorylation prior to proteasome-mediated degradation. Mol. Cell 23, 439–446.6. Shen, Y., Khanna, R., Carle, C.M., and Quail, P.H. (2007). Phytochrome induces rapid PIF5 phosphorylation and degradation in response to red-light activation. Plant Phys.145, 1043–1051.
7. Shen, H., Zhu, L., Castillon, A., Majee, M.,
Downie, B., and Huq, E. (2008). Light-induced
phosphorylation and degradation of the
negative regulator PHYTOCHROME-
INTERACTING FACTOR1 from Arabidopsis
depend upon its direct physical interactions
with photoactivated phytochromes.
Plant Cell 20, 1586–1602.
8. Nozue, K., Covington, M.F., Duek, P.D.,
Lorrain, S., Fankhauser, C., Harmer, S.L., and
Maloof, J.N. (2007). Rhythmic growth explained
by coincidence between internal and external
cues. Nature 448, 358–361.
9. Al-Sady, B., Kikis, E.A., Monte, E., and
Quail, P.H. (2008). Mechanistic duality of
transcription factor function in phytochrome
signaling. Proc. Natl. Acad. Sci. USA
105,2232–2237.
10. Leivar, P., Monte, E., Al-Sady, B., Carle, C.,
      Storer, A., Alonso, J.M., Ecker, J.R., and
     Quail, P.H. (2008). The Arabidopsis
     phytochrome-interacting factor PIF7, together
    PIF3 and PIF4, regulates responses to
     prolonged red light by modulating phyB levels.
   Plant Cell20, 337–352.
11. Monte, E., Al-Sady, B., Leivar, P., and
     Quail, P.H. (2007). Out of the dark: how the PIFs
     are unmasking a dual temporal mechanism of
    phytochrome signalling.J.Exp.Bot.58,3125–   3133.