Go Down

### Topic: Analog Night Light Circuit (Read 3514 times)previous topic - next topic

#### Jiggy-Ninja

#15
##### Oct 28, 2016, 03:40 am
The schematic is spot on, thanks.
Haven't heard of the node thing before but I'm guessing it's just the groups of leads that are connected on a trace area.
Node (circuits): In electrical engineering, node, refers to any point on a circuit where two or more circuit elements meet. Without any further knowledge, it is easy to establish how to find a node by using Ohm's Law: V=IR. When looking at circuit schematics, ideal wires have a resistance of zero. Since it can be assumed that there is no change in the potential across any part of the wire, all of the wire in between any components in a circuit is considered part of the same node.

Each different color in circuit above is a different node

I did my first ever Wikipedia edit just now, removing a sentence from that paragraph that wasn't true.
620nf cap, voltage dropper
That's just my handwriting, it's actually 820 nF. Check the Zener's label to compare it to how I actually write 6's.

#### Smajdalf

#16
##### Oct 28, 2016, 09:03 am
The zener normally will only conduct in the reverse direction but will clamp the voltage to a
safe level if the LED blows open.
Are you sure? If I understand your explanation right the Zener is "only" for protection. So the circuit would work without it as long as everything is OK. But I think the Zener will be conducting in forward mode while Mains 2 has higher voltage than Mains 1 - there must be a way to discharge the 820 nF cap faster than 500k resistor. Or am I wrong? AC is a bit difficult to understand for me.
How to insert images: https://forum.arduino.cc/index.php?topic=519037.0

#### MarkT

#17
##### Oct 28, 2016, 03:35 pm
Without the zener it won't work - capacitors block DC, the zener provides the return current flow for the
other half-cycle of mains - otherwise the capacitor would just charge up till no current need flow at all.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### INTP

#18
##### Oct 28, 2016, 03:55 pm
Still trying to get a deep understanding of the LDR function.
When there is no light, the LDR shuts off basically all current, so it has nowhere left to go except to the LED. I get that much.

But when there is light, is the LDR's goal to be a path of lower resistance than the LED? Then what is the point of the transistor? Is it simply to ensure a path for all current to go through the LDR and transistor instead of the LED? Transistor current when on 'sucks' all the current away from going past the LED?
What is the point of the 10K pulldown? If that were removed from the circuit so the LDR was just running into the transistor, isn't the x amount of resistance in the M Ohm range of the LDR enough to shut off the base?

#### MrAl

#19
##### Oct 28, 2016, 05:24 pmLast Edit: Oct 28, 2016, 05:34 pm by MrAl
Are you sure? If I understand your explanation right the Zener is "only" for protection. So the circuit would work without it as long as everything is OK. But I think the Zener will be conducting in forward mode while Mains 2 has higher voltage than Mains 1 - there must be a way to discharge the 820 nF cap faster than 500k resistor. Or am I wrong? AC is a bit difficult to understand for me.
Hi,

Maybe i stated that wrongly because zeners are usually referred to as conducing in reverse when their voltage threshold is reached (ie 5.6v) and in the forward direction they usually conduct with a very low voltage like 0.7v or something.
The way i was referring to is that when the zener clamps to 5.6v that is the forward direction, and when it clamps in 'reverse' it clamps to -0.7v or thereabouts.

So yes of course the zener provides protection as well as reverse conduction so the cap can work normally in an AC circuit.  Without that other mode of conduction the cap would charge up and stay charged and would not function as an AC voltage dropping device.  So the zener has a double function here.

Yeah LDR's conduct more once light hits them.  Basically the light energy gives electrons in the device more energy and thus more freedom to move which of course makes conduction better and thus lowers the apparent external resistance.

The transistor is there to shunt current away from the LED rather than to allow current to conduct to the LED.  It's another way of doing it, but this way the impedance across the LED stays low which allows the AC part of the circuit to function normally even when the LED is turned off (transistor conducts),  Without that action if the LED is turned off, there would have to be some other mechanism to keep the low voltage section at a low voltage so it doesnt blow up the electrolytic cap, which is of a lower voltage variety like 10v or 12v or something like that.   If the cap charged up to the full line voltage peak, it would have to be rated at 200v (most parts of the US) and that would make it a big capacitor which would not fit inside a small night light package.  Alternately, another zener would be required to keep the voltage down to 5 to 10  volts or so.

So this is an attempt at a low parts count design, but they did overlook the fact that electrolytic caps and high voltage 0.62uf caps are more expensive than rectifier diodes, and both of those caps could have been lowered to 1/2 their values if they used full wave rectification instead of half wave.  So three more cheap diodes could have made the design cheaper by some amount of cash.  Maybe they figured the assembly would cost more for three more diodes so i will have to give them the benefit of the doubt.

#### Jiggy-Ninja

#20
##### Oct 28, 2016, 07:04 pm
I'm pretty sure the cap does charge to almost full line voltage. 820 nF is 3.2kohm of reactance at 60 Hz, which easily overwhelms the impedance of the Zener and 100 ohm resistor. It's probably got 100V RMS on it. I'm pretty sure it was rated for 400V.

And we don't necessarily know what production factors went into the design. 3 extra 1N4007s would take up quite a bit of space, and there's already not much in there. The box is literally just as big as it needs to be to to hold the board and cap. On Digikey I only saw a few cents difference in the unit price between the 820 nF and 470 nF version, but Digikey only goes up to 2,500 quantity. Components for cheap things like these are probably bought by the 100,000s, and I have no experience with production quantity component sourcing.

#### MrAl

#21
##### Oct 29, 2016, 02:45 amLast Edit: Oct 29, 2016, 02:45 am by MrAl
I'm pretty sure the cap does charge to almost full line voltage. 820 nF is 3.2kohm of reactance at 60 Hz, which easily overwhelms the impedance of the Zener and 100 ohm resistor. It's probably got 100V RMS on it. I'm pretty sure it was rated for 400V.

And we don't necessarily know what production factors went into the design. 3 extra 1N4007s would take up quite a bit of space, and there's already not much in there. The box is literally just as big as it needs to be to to hold the board and cap. On Digikey I only saw a few cents difference in the unit price between the 820 nF and 470 nF version, but Digikey only goes up to 2,500 quantity. Components for cheap things like these are probably bought by the 100,000s, and I have no experience with production quantity component sourcing.
Hi,

When it came to the charging issue, i was talking about the electrolytic.  Try reading my last post over again.  I also stated that the smaller cap had to have a high voltage rating so i dont see how you could have confused these two.

I had worked in the industry for quite a few years in several places so i had to deal with production issues on many levels so when i see designs i have a good idea what the basic thoughts were that went into the design.  That's also how i know that caps are generally more expensive than diodes.
But then again we dont have to just talk about diodes either. They make full wave bridge rectifiers smaller than a single 1N4007 diode, and even the 8 pin dip package isnt that large really and can easily fit on a small board inside a night light package.
There are a lot of variations though too, and sometimes they start out with one design and then start to improve it over time.  There is a chance that future night lights from the very same company will have a bridge rectifier in them.  It just depends on if they feel they need to improve it a little or not.
For my designs in this area, i've always used a full wave bridge because of the two cap sizing issue, but i also used NO cap and only two diodes and high value resistor for a low power indicator lamp that had to fit in a VERY small space only as large as a regular 120vac plug on the end of an extension.
I also include a fuse for protection in case the small cap shorts out internally.

But hey we could look at other designs too if you like.  I had one up on my website before the dang company killed that part of their services.  Many i'll have to start another one of these days :-)

#### INTP

#22
##### Oct 29, 2016, 02:54 am
I would highly doubt the 'next' design will have a bridge rectifier, as it just so happens that the 'previous' design that was using a 5mm bulb type LED had one. So in essence, they've unimproved to trim component count if you think a bridge rectifier is an improvement.

#### MrAl

#23
##### Oct 29, 2016, 04:35 am
I would highly doubt the 'next' design will have a bridge rectifier, as it just so happens that the 'previous' design that was using a 5mm bulb type LED had one. So in essence, they've unimproved to trim component count if you think a bridge rectifier is an improvement.
Hello,

If they really did that, which i highly doubt, then they may realize that it would be better to go back to the bridge rectifier design, so you cant know that either.
It also depends who is doing the design...a seasoned engineer or a fresh out of school student would be designer.

If you think that is the only product that went backwards in time, think again.  There are so many products out there these days that i am almost surprised that anything works these days.  Often when 'they' improve something in one way they make it worse in another way too.  It's only when you've worked with the best engineers on the planet that you begin to see how deficient much modern engineering really is.  Time to production is now the main issue because salaries went so high over the years.  Quality almost comes last.  Dont agree? Look at some of the new designs out there, like the Samsung Note where the company lost billions because they did not follow the most important part of design with lithium ion batteries: dont design it so they blow up :-)

But it's always up to the engineer that is sitting there doing the work and their experience.  From what i have seen in modern engineering they may very well put in 10 diodes one day :-)

#### Jiggy-Ninja

#24
##### Oct 29, 2016, 07:30 pm
Hi,

When it came to the charging issue, i was talking about the electrolytic.  Try reading my last post over again.  I also stated that the smaller cap had to have a high voltage rating so i dont see how you could have confused these two.
You're right, I must have got mixed up. There was a lot to read in that post, which is just the way I like it.

Quote
But hey we could look at other designs too if you like.  I had one up on my website before the dang company killed that part of their services.  Many i'll have to start another one of these days :-)

I believe there was a Youtube video posted on the last page of someone disassembling a different night light, and the schematic he drew had a full wave bridge rectifier in it. I didn't watch the video in detail so I don't know if it was a single component or 4 discrete diodes.

#### Jiggy-Ninja

#25
##### Oct 29, 2016, 09:04 pmLast Edit: Oct 29, 2016, 09:07 pm by Jiggy-Ninja
Quote
...modify one to add a button to shut it off in the dark, but still turn back on automatically after a light-dark cycle.
If you permit me to hijack this thread a bit, I've come up with an idea for this. It is an additional clamping circuit put in parallel with the LED and transistor and is inspired by the seal-in circuits that were used in ladder logic for relays and PLCs:

The LED and output transistor of an optocoupler are placed in series with each other, and a tact button in parallel with the transistor. The series resistor limits current so the 100u cap isn't immediately discharged through.

The theory of operation of the original circuit is that due to the high impedance and high voltage of the mains connection, it is easier to consider the LED section as being driven by a non-ideal current source instead of a voltage source. When it is light, the transistor increases conduction and robs the LED of current until has none left, and the voltage is clamped below the forward voltage of the LED. During dark periods, the transistor barely conducts anything, so all the current goes to the LED.

The modification adds an additional clamping circuit in parallel. Normally, the optocoupler is off so no current flows through this additional branch whether it is light or dark. When it is dark and the switch is pressed, current flows through the LED and closes the optocoupler output so that it stays flowing when the switch is released.

When it becomes light again, the tranistor will steal current from this circuit and end up turning it off. Then when it goes dark again, the LED will light until the button is pressed, exactly the behavior I want.

Simulation with LTSpice is promising. I had to fib the LEDs with regular and Zener diodes, but it looks like it'll work. I'll test it sometime next week.

Green trace is current through the resistor
Dark blue trace is the LED voltage.

#### Smajdalf

#26
##### Nov 21, 2016, 09:44 pm
Hi,
I thought about building similar circuit and I want do it "the right way" so I tried to imagine what may go wrong. When you connect this circuit to 120 VAC and the capacitor is discharged there is a good chance for at least 50V through the circuit and only diodes and 100R stands in it's way before cap is charged. In theory that means over 0.5 Amp peak current. Worst-case scenario is cap charged to -150V removed from mains and then replugged when mains are at +150V leading to 300V difference and so 3A of peak current! In this particular circuit the current should go through the LED (because voltage drop of LED + drop of diode ~ 4V << 5.6V of Zener) killing it. Apparently this doesn't happen at first power-up. Does it mean it is OK to make such circuit because of parasite inductance, resistance and I don't know what will reduce the peek current and it is so short that there is not enough energy dissipated to damage the parts anyway? Or are parts stressed everytime it is connected to mains at wrong part of cycle and it is only matter of time when something (possibly the LED) fails?

Another concern is about the voltage dropping cap - is it possible to use any cap rated for AC voltage large enough? I.e. this cap is X2 class and is rated for 310VAC. But datasheet states clearly "Not for use in "series with mains" type applications." Why? What cap needs to have to be used in this application?

Another concern is safety. When you unplug it from mains at wrong part of cycle it may be charged to 300V (here in Europe). When you touch it you will get shocked. If I calculate it right there is stored about 0.1 J in the cap. Is it enough to do some harm?
How to insert images: https://forum.arduino.cc/index.php?topic=519037.0

Go Up