# Night light, schematic and functioning

I recently bought an el-cheapo night light for \$1 just to see how they manage to get the costs so low. I expected to meet an el-cheapo voltage regulator at best or even a bridge rectifier but alas! None exist here. I just can't figure out how or why the circuit here works with mains (240V) voltage. It does get warm during operation but I wasn't going to use it anyways so it is just a learning prop for me. I have no idea what the SOT part labelled "J6" is and if it's a transistor, what kind. Please help me figure out how it works and what that "J6" could be.

edit: R2 is the LDR, the other resistors are SMD resistors and the capacitor is an electrolytic cap.

The board looks like this:

and I've drawn the schematic as is:

simulate this circuit – Schematic created using CircuitLab

• Where is the LDR in the schematic? – Brendan Simpson Oct 7 '16 at 15:20
• The LDR is R2. Sorry forgot to note that – the_architecht Oct 7 '16 at 15:20
• All the explanations below were satisfactory. I can't choose multiple correct ones so I just took the first one on the list. Thank you all! Now I can bring back the light and "dramatize" on how unsafe this thing is. – the_architecht Oct 7 '16 at 17:50
• That is actually the power supply for the defective Samsung Galaxy 7 "smart" phones. You heard it here. – Tim Spriggs Oct 11 '16 at 20:21

simulate this circuit – Schematic created using CircuitLab

Figure 1. Redraw of the OP's reverse engineering.

• If your circuit is correct then we can see three voltage dropping resistors, R3, 4 and 5, and a half-wave rectifier, D4. At 240 V the current through the resistors will be $I = \frac {240}{8k2 + 8k2+8k2} = 10~mA$ but with the rectifier it will average half that.
• It's not clear from your schematic but I suspect that R2 is the light sensor - an LDR. When light is sensed the resistance will drop and Q2 will turn on. This will "shunt" the DC on C1 to ground and turn the LEDs off. This will give comfort to the user giving the impression that the unit is not wasting power when, in fact, it is running constant power whether it's on or off. It would make no difference to power consumption if R1, 2 and Q2 were omitted!
• Power dissipated in each of the resistors will be $P = I^2R = (5m)^2 \cdot 8k2 = 205~mW$ which may be a bit on the high side for those SMD resistors.
• Actually, when the shunt operates, the voltage across the dropping resistors is slightly higher, so it actually dissipates more power when the LEDs are off. Slightly, I say. – WhatRoughBeast Oct 7 '16 at 16:54
• The smoke from the resistors will provide negative feedback to the LDR by obscuring it and turn the LEDs on again. – Transistor Oct 7 '16 at 16:56
• And depending on the time constants, the effect might produce an oscillator. Forming a convenient "Please unplug the unit if the light is blinking" feature. – WhatRoughBeast Oct 7 '16 at 16:58
• Judging by the size of the resistors versus the transistor, they look to me like they're 2010 or similar resistors, so more than adequate for the dissipation calculated. They certainly aren't smaller than 1206 resistors, which would make them a similar size to the transistor, and that is the smallest size rated for such a dissipation. – Periata Breatta Oct 8 '16 at 1:49

The reason for using a wasteful shunt to turn the LEDs off instead of cutting power is probably this: in both "on" and "off" states, the business end operates at low voltages, only R3,R4,R5,D4 need to be rated for high voltages.

This is slightly cunning : if you attempted to cut the current off during daylight, to save power, the transistor would have to be rated to the peak mains voltage (350V or more) adding some expense as well as (possibly) more safety concerns.

Searching for "J6 SOT23 transistor" yields the S9014 : a perfectly ordinary NPN transistor, rated at Vce <= 45V and Ic=100mA.

If any of the LEDs fail open circuit, the transistor will probably fail over-voltage next time it gets dark, unless the capacitor fails first.

I expect it has been tested and shown not to start a fire in that failure mode - actual functionality and repair aren't an issue given the price.

The LEDs and D4 create a simple half wave rectifier. The resistors R3, R4 and R5 provide the necessary current limiting. C1 provides very simple decoupling. When the LDR has light on it, it's resistance is very low and the base of transistor Q1 gets enough current to turn on, likely to saturation. This effectively shorts out the LEDs, so they turn off. When the ambient light goes out, the LDR is high resistance, and the base of Q1 receives almost no current, making it more like an open, so current flows through the LEDs.

It's interesting that when the LEDs are off, the resistors and D4 are still just wasting power. Cheap cheap cheap! I assume the designers used three different resistors in series instead of just one for power dissipation reasons, but it could also be a cost thing.

• 3 resistors in order to withstand the peak voltage, too. – Dave Tweed Oct 7 '16 at 15:33
• I think you have the LDR operation the wrong way around, they go high resistance when dark and low resistance when illuminated. The circuit having the positive at the bottom may be confusing things, but I make the logic right. Cheap, Cheap, Cheap and more then somewhat shonky. – Dan Mills Oct 7 '16 at 15:36
• @DanMills Good catch, I'll update accordingly. – Brendan Simpson Oct 7 '16 at 15:37

There will be greater peak currents to charge the Cap than than the average LED current. The peak LED current is defined by resistance total,series R in which we can neglect ESR and voltage drop of LEDs

The cap only reduces the flicker 15% from 100%, which we can determine from the LED ESR.

Neglecting the LDR/NPN disable circuit we have;

240Vrms half wave 50Hz input.

Load appears from photo to be 75mW rated white LEDs which have an ESR=1/Pd = 13.3 +/-? times 3 LEDs in series, = 40 Ohms

Thus peak current is 1.414*240V/(3*8k2)=14mA

• and conversion from half wave peak of RMS to DC equivalent is root2*rms/2
• thus avg LED current becomes Vrms/Rtotal or 10mA
• with the Vf changing only 10% over the brightness range of 10:1 and 100uF * 40 Ohms= 4ms or 25% of the line pulse current interval
• and using half power intensity instead of 10:1 we expect the LED flicker current to be closer to 15% duty cycle ON
• and the cap peak charge current 10x the average 10mA discharge.
• bigger cap would reduce flicker, but then raise cost due to RMS ripple current ratings for small cheap caps.

• we also expect the resistors to,flash over with > 1500 V peak voltages and burn up if there is any lightning nearby