Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

night light for glass etching

Status
Not open for further replies.

Thebighat99

New Member
Hi all,

I am trying to build a night light for a glass etching I did. The 4 LEDs will but up against the glass and illuminate the pain. The problem I am having is that the LEDs stay on weather its dark or light. I turn the potentiometer and led will get brighter but will not turn off. When the voltage is 9v instead of 18v it seems to work but with just two LEDs.

I used info from these pages for this circuit.

http://www.elxevilgenius.com/02ONLINE/Part_I/Lsn11/ANims/ec4eg.htm

**broken link removed**

Schematic
**broken link removed**
Using this formila to find R1.
R1 = Supply Voltage/(Maximum Current Required /Minimum HFE * (minimum base current+30%))

R1 = 18v/(.12/100*1.56)
R1 = 18v/(.0012*1.56)
R1 = 18v/.001872
R1 = 9615.384 Ohm or 10k for nearest standard value.

18v is supplied buy two 9v batteries

D1,D2,D3,D4 LEDS are blue 3.5 voltage forward, forward current 30mA

LDR Dark 500k ohm, light 15k ohm

Q1 is NPN 2N3904 transistor 100hfe Ic 200mA.

I been working on this for a while. I think it is because the current is over powering the transistor. When I tried a higher rated transistor Ic 600mA it had same affect. I been reading everything on the web that I can find about transistors but I am really not grasping how to apply the information to fix the problem. This is the first circuit that I have tryed to modify to suit my needs. Maybe I am doing it all rong. I am sure there is somthing I missing like a engineering degree. Please any help will be apretiated.


Thank you,
 
This will work.
 

Attachments

  • LED comparator.GIF
    LED comparator.GIF
    3.6 KB · Views: 233
A comparator makes a lot more sense though you won't be able to adjust the brightness with that circuit.

Your current limiting resistor (R2 470K) is way too high. you need to use ohms law to calculate that. Add up the voltage drops of the LEDs, subtract that from the supply voltage and use what's left to calculate the resistor value based of the current you want flowing through the LEDs. Example: 2V Vf on LEDs, 8V total. 18-8 = 10V. LED If is 20 mA. R = V/I = 10/.02 = 500 ohms. Use standard value - 470. Note that you will lose some voltage from the transistor or comparator so the "correct" value is likely to be pretty close to 470.

I wouldn't use a 9V battery - they have little capacity and won't last very long. I'd use 4 AA cells for significantly longer run time. You can run 2 parallel sets of LEDs - each with their own limiting resistor if you don't have enough voltage.

Finally, there are LED power ICs that will give you a lot more flexibility on your power source and will be more efficient than using limiting resistors. More complex to design with, though. Some of them support dimming as well.
 
A comparator makes a lot more sense though you won't be able to adjust the brightness with that circuit.
Yes you can, just alter the value of Rs.
 
That is true though you have to take a little care - its more than just using a potentiometer for Rs. There needs to be a separate series resistor in addition to the pot to prevent setting the current too high. I presume that he wanted to be able to adjust the brightness of the LEDs.
 
It's an emitter follower.
Don't you need the LEDs in the collector circuit?
 
philba,
That's true, although the LED will never turn fully off, perhaps a log pot with a switch would be a good idea if variable intensity is required.

Willbe,
It's an emitter follower for a good reason. The transistor buffers the voltage on the pot so the voltage across the LED tracks the voltage across the pot thus varying the brightness.

If it was a common collector circuit the brightness of the LED wouldn't vary as much.
 
Wow thanks for all your feed back. I really liked the idea about 2 parallel sets of LEDs. I would like to keep the light uniformed at the bottom of the glass. Thats why I was using 4 LEDs. I am not to sure about LED power ICs. I will try to look into that.

First off I been missing around with this circuit till it is driving me off the deep end. One would not think it would be so hard to change this circuit. But being a noobie one never knows :)

The potentiometer is not to control the brightness of the LED. I see why you would say that. Because it does in away. But its really to control at what level of darkness the LED will come on.

Yes I did try the LED on the collector side but it didn't work. I went as far as switching the potentiometer to ground and the LDR to Positive side to turn it into light detector and it worked. But I could not get it to be a dark detecter. With the LED on the collector side. I would of thought it would of been on the collector side myself. Wouldn't that limit the current flowing through the collector to the emitter?

Right now I am reading about comprators. Trying to get a better Idea of how they work. I have been a little confused about how to figure out Voltage deviders. It might be a while before I get the comprator circuit working.

Thanks All,
 
Right now I am reading about comprators.

Nah, c'mon, ya' can do this with one transistor. I think.

4x3.5 = 14v needed by the LEDs.
There is 1v drop in the emitter follower,
so if the LEDs want 30 mA then R2 = [(18-1)-14/.03] = 100Ω
Figure base current is 30/10 mA or less.
R1 = 0 ohms.
R4 = inf.

The LDR threshold is sqrt (15x500) = 87k at which point the LEDs must just see 14v.

14v + Vbe = ~15v = base voltage.

15/87k = only 0.2 mA in the base divider resistor network, and this is not the recommended 5x the base current, so you may need a Darlington for the transistor. Try it anyway, it may work.

Anyway, that leaves 3v across R3. 3v/0.2 = 15k =R3.

BTW, sqrt (15x500) is the geometric, not the arithmetic, average. I use it for widely varying values like this.

I can't guarantee what LED current you will get with only a 100Ω series resistor, but there is so much slop in this circuit it may work anyway.

Another way to look at this is that the circuit supplies no voltage gain and the output load needs 30 mA.
The input can supply 18(87k)/(87k +15k) = 15v with a source impedance of 87k||15k = 13k so the source can supply an input current of 15/13k = 1.2 mA.
The current gain of the circuit @ 30mA needs to be 30/1.2 = 25. One transistor might do this after all.

With 500k max resistance and 14v this is a current through the LDR of 28 uA. (18-14)/28 uA = 140k.
From your description the max value of R3 may need to be >140k.
 
Last edited:
Very nice Willbe it works. I have got like 25 bags of different resistors guess witch one I didn’t have the 15k one. I used a 12k for R1 instead low and behold it turn off in the light and on in the dark. There are few things I don’t understand. Well ok there are a lot of things I don’t understand:).

Figure base current is 30/10 mA or less.

Ok so the 30 is 30mA witch is the forward current of the LEDS?
But where is the 10mA or less coming from?

30/10 = 3mA?

Is not base current: 30mA LEDs foward current/100hfe(min) = .3mA

Could you please elaborate on how you come up with the base current.

14v + Vbe = ~15v = base voltage.

14v is the voltage need buy LEDS? + Vbe min base emitter saturation voltage = 15 base voltage

Vbe is the min base-emitter saturaton Voltage from the Data sheet of the transistor and you just rounded it up to 1 vote?


only 0.2 mA in the base divider resistor network

15v base voltage/87k LDR threshold = .2mA this is the current before reaching the base resistor?

so you divided the voltage of the base buy the resistance of witch the LEDs will just see 14v. I think i little lost at this point.

Anyway, that leaves 3v across R3. 3v/0.2 = 15k =R3.

Ok I am not the fastest thinker and I am a little slow. Where did you get the left over 3v?

voltage in - vbe base emitter saturaton Voltage = voltage across RB?

Well I would like to understand how you came up with 15k. I really would like to know so if I need to do this agin I can. I will keep reading about transistors and maybe more will soak in. Some of it makes more sence after looking at your calculations.

Thanks for your help.
 
it works.

I'm more than a little surprised. I'm also not sure how close to not working it is. Don't go into production quite yet!

Quote:
Could you please elaborate on how you come up with the base current.

If you define saturation as Vbe>Vce I assumed the transistor was near saturation and so beta ~ 10, and so Ib ~ 3 mA. It should really be β+1= 10 since the LEDs are in the emitter circuit, but the first time around we can approximate.
If R3 were zero the transistor would be on the verge of saturation.


Quote:
14v + Vbe = ~15v = base voltage.
14v is the voltage need buy LEDS? + Vbe min base emitter saturation voltage = 15 base voltage
Vbe is the min base-emitter saturaton Voltage from the Data sheet of the transistor and you just rounded it up to 1 vote?

Yes, 0.7v ~ 1v. We can always get more precise later, if we need to.
Now that we talk about it I should have used 0.5 for Vbe since we are just at the point of turn-on, but what's a volt or so when we have 18 to play with?


Quote:
only 0.2 mA in the base divider resistor network
15v base voltage/87k LDR threshold = .2mA this is the current before reaching the base resistor?

This is the current through the LDR. I'm assuming zero base current 'cause it makes the R3/LDR voltage divider calculation easier.

so you divided the voltage of the base buy the resistance of witch the LEDs will just see 14v. I think i little lost at this point.

Well, you usually want the base current resistor divider to pass at least 5x the Ib so the Ib doesn't have much effect on the divider resistor voltage calculation.
Since we can't change the LDR resistance we're kind of stuck with 0.2 mA. I'd have wanted it higher.


Quote:
Anyway, that leaves 3v across R3. 3v/0.2 = 15k =R3.
Where did you get the left over 3v?

There's 15v at the top of the LDR from the text above and the supply is 18v, so we have 18-15 = 3v and the current through this R3 is supposed to be 0.2 mA [I'm still ignoring the base current] so R3 comes out 15k.

In retrospect, the top-down system-level approach for this would be to assume a signal input of 15v with a source impedance of ~15k into a "black box", and only current gain is necessary. The voltage gain is about 1 so power gain is necessary.

Ideally the input resistance should be >>15k so as not to load the source. I think it is way lower than that.

The source can deliver 15v/15k = 1 mA and you know you need 30 mA so the amplifying device inside the box needs a minimum current gain of 30/1 = 30.

This would have told me that one transistor probably will work for this circuit.

The LEDs are current driven and the high resistance LDR and R3 resistor is kind of a current source, so a current-controlled current source [i.e., a transistor] is ideal for this app.
 
Last edited:
I Decided to try the comparator. I have had it working for about a week now with no problems. I can adjust the point win it comes on very nicely with
100k pot. I turned all the lights off and it will not come on till the tv is off. It has to be pretty dark witch is what I wanted. If you see anything that is not quite right or needs to be changed. Please let me know.

Schematic
**broken link removed**

D1,D2,D3,D4 LEDS are blue 3.5vf forward current 30mA
LDR Dark 500k ohm light 15k ohm
LM339 Quad Comparator just using one set of inputs. I also tryed 741 op amp with out the pullup resistor and it worked also.

Well thats the good news. The only thing is I know the hysteresis is not calculated properly for my circuit. The formula I am trying to used is from Practical Electronics for Inventors. by Paul Scherz pg239 old copy and pg557 new copy. Witch I was doing ok till I got to || sign. What does this || sign means? Please give example.

example:
**broken link removed**

Thanks for taking the time to look over my beginner madness :)
 
The LM339 doesn't output enough current to power the LEDs.

The LM741 might be able to do it.

If you used an LM339 with a 1k pull-up resistor the LEDs would be very dim anyway. The current through each LED would be only 810:mu:A.

For brighty LEDs:
  • Use an LM311.
  • Replace R1 with the LEDs R4 and R5.
  • Swap the inverting and non-inverting pin connections.
 
R1 in parallel with R2 (R1||R2) is 5k, so if the output swings 9v the hysteresis is 9v (5k/100k) = 0.45v.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top