This Instructable will show how to repair a automatic daylight sensor for lighting, how it works and how to wire it up.

## Step 1: Finding the Fault

In this situation it was quite easy to find the problem with this appliance because the the problem was a visual one, some times you are not able to see the problem by eye and need to use a tester. As you can see in the picture the mains capacitor and resistor were blown (probably by a surge of voltage).

## Step 2: Desoldering the Blown Parts

Simply get a soldering iron and desolder the capacitor and resistor. It is easy if your put a bit of Solder on the end of the tip and then heat them, pull out the parts using a pair of pliers and/or tweezers. The mains capacitor was cracked and the resistor had broken in half.

## Step 3: Replacement Parts

The replacement parts were salvaged from another old board. The mains capacitor is a different color but does the same job and the resistor was 150ohms. Solder the components back into their places and if necessary bend the capacitors legs, the resistor had to be moved to the other side because the capacitor had short legs.

## Step 4: Theory on Capacitive Power Supply

A capacitive power supply is a type of power supply that uses the capacitive reactance of a capacitor to reduce the mains voltage to a lower voltage. There are two important limitations: First, the high withstanding voltage required of the capacitor, along with the high-capacitance required for a given output current, mean that this type of supply is generally used only in low-power applications. (Generally, a capacitor of a given size or budget can have a high voltage rating or high capacitance, but not both.) The second is that due to the absence of electrical isolation, the circuit must be encapsulated and isolated to avoid direct (galvanic) contact with the users.

By changing the value of the example in the diagram by a capacitor with a value of 330 nF, we can provide a current of 20 mA. This way you can power up to 48 white LEDs (for example, 3.1 V/20 mA/20000 mcd) - that is provided connected in series. The image, however, shows the open lamp LED 48 diodes party. At 50 Hz, the 1.2 μF capacitor has a reactance of 2.653 kohm. By ohm's law, the current is limited to 240v/2653ohm = 90 mA, assuming that voltage and frequency remain constant.

## Step 5: How It Works

The basic way it works is that there is a LDR (light dependent resistor) that gets more resistive when dark and less when it's light around it. There are some electronics that turn a relay on when it's dark(more resistants) and off when it's light(less resistance).

## Step 6: How to Wire the Sensor

Remember this is high voltage and can kill you! So be aware of the danger, it is very simple to wire it just follow the schematic and you should be fine. Assemble the sensor test it and you are done.
<p>Nice repair job. Being able to repair your own electronics is an infinitely useful skill that far too few people have.</p>