I have made up a simple system to switch on a 12/24 volt light if the power goes off and it is dark.

(If the project is completed but without the mains relay system it could be used for switching on a light automatically at night)


THIS PROJECT REQUIRES USE OF MAINS POWER, get a qualified person to do all the mains power work.


I am not an electrician and hold no responsibility for any issues you may experience (if you follow these instructions you do so at your own risk).

The system uses a relay that is connected to a power socket, I have a plug on the system so that it can be plugged in, the relay is used so that when there is no power to the relay it switches on the rest of the system.

Step 1: Equipment and Materials


  • Soldering iron (+solder)
  • Screw drivers
  • Wire strippers and cutters
  • Crimps (depending on your relay and battery)
  • Multi meter (can be useful if things go wrong)


  • LDR (Light Dependant Resistor)
  • Potentiometer
  • Resistors
  • Transistors (I used a BC108 and BFY51)
  • Strip board
  • Wires
  • 240v AC relay
  • Spades
  • Terminal block
  • Fuses
  • Mains Indicator light
  • Suitable Insulated case ( but if conductive e.g. metal, an appropriate ground connection will be needed)

Step 2: The Theory and Circuit Diagram

(R2 and the LDR are the wrong way round in the diagram)


The relay coil is connected to the mains power so that it will switch when the power is on, the rest of the circuit is then connected so that it gets power through the normally closed switch. (see diagram)

The light sensing is achieved by using a potential divider from the LDR and Potentiometer, the potentiometer allows for the brightness that trigger the circuit to be adjusted, this Potentiometer will need to be selected based on the LDR resistances.

There is then a current limiting resistor from the potential divider to the Darlington driver.

The BC108 has a high gain but only low current where as a BFY51 has a high current and low gain, so I used these to make a Darlington driver that can be used to switch on a light or control a second relay if more power is required (e.g. if the light requires more than the transistor can handle).

This system can be adapted according to needs, for instance the mains relay could be removed and then it would create an automatic light that will switch on at night. Or if the light level sensing isn't important then the relay could just be used to switch the light on/off.

Step 3: Power Supply

I have chosen to use 24 volts, this is due to having 2 * 12 volt batteries available, and I have some Bright LEDs that are designed to run directly on 8-48 Volts. This batteries are connected in series to create the 24v, (being careful of polarity). I have made some wires up with spades on so that they can be pushed onto the battery, this will make it easy to change the batteries if required.

Make sure the wires used to connect the batteries are suitable for the intended use/ power consumption of the lighting.

Step 4: Mains Switch

I made up a simple metal box which housed all the mains voltage systems, the box has a 1 AMP FUSE as a safety device, there is also a small red light as an aid to determining if the unit is powered. There is also a ground connection to the metal case, which is an electrical requirement.

The relay is mounted in a socket,which is mounted to the case. All the leads from the relay are then taken to terminal block also mounted within the case this allows for changes to be made in the future fairly easily.

There are 2 wires connected to the switching terminals on the relay which go to the light sensing circuit, the mains lead leaving the box has a suitably fused 13 A plug on it for mains supply.

Step 5: Make the Light Sensor

Make up the Circuit, this can be done on a breadboard to begin with as this makes changing resistor values much easier.

Once the circuit is working correctly then it should be transferred to a PCB or Strip board.

Use wires suitable for the amount of power you are going to draw.

I used relatively thin wires because I am only going to use small LED lights not traditional builds. The Red LED is only an indicator system to show the state of the system. I have since added the 8-48v LED in parallel, which is the main source of light.

If a larger power supply is needed then a relay should be added in place of the LED and a diode to prevent EMF.(see second diagram)

Step 6: Finally

Put the LDR in a suitable place, E.g. a window.

Adjust the Potentiometer to get the correct setting for darkness.


<p>Assume R2 has been adjusted correctly so that when main power is off, the LED will glow if the environment is dark. What will happen when the main power is off during daytime?</p><p>The resistance of the LDR is lower at daytime, so more current will flow through the base of Q2, and the LED will glow, and may glow even brighter than when the environment is dark.</p><p>Is there any problem with the design of the circuit?</p>
<p>I think you are right, R2 and the LDR could be the wrong way round meaning it would light up in the day not the night, it was a while after making the circuit when i wrote this up, so possible I have switched them over </p>
<p>So important! Thanks for sharing your genius!</p>

About This Instructable




More by daniel9876:Emergency Light /Automatic light  
Add instructable to: