Light detector switch?

Candle Power Forums

Help Support Candle Power:

Ernie

Newly Enlightened
Joined
Jun 28, 2004
Messages
27
City & State/Province
Ventura CA
Anyone know how I could make an led come on when it gets dark automatically?I made a version with a relay and photoresistor that worked but then I was think won't that drain the battery to much?I'm trying to use this in conjunction with a circuit I got from here like the Brinkmann and it uses only 2 aa batteries.

I found some info on the web talking about using a transistor as an on and off switch but my only electronic experience is what I have learned from Mr.Als course.So it's still beyond my scope I think but soon I'll be able to do it on my own I hope.

By the way this is going to be a little night light for my kids room but I didn't want it to be plugged into a wall version.That's why I'm trying to come up with a battery operated one.

If you can give me some pointers to get me going that would be great.thanks

P.S. actually I believe the circuit I'm using to drive the LED's is the one Viren made.Thanks Viren that circuit is good for a 1st timer like me I think for starting out with.


Ernie
 
Sure.

How about a FET (very low loss transistor) and a photo resistor? You also need another fixed resistor.

I've been using 2N7000 transistors and CdS cells from Jameco, both are under a dollar total. Best buy some other stuff while yer there....

Anyway Source goes to B minus, Drain goes to LED driver minus, photo resistor from B plus to Gate, a few hundred thousand ohms from gate to B minus, Led driver plus to B plus.

You may have issues with voltages much under three volts, may call for a different transistor or selecting one from a pile. I have no troubles running on 3 NiMH cells, but my circuit drops out of regualtion when Vbat gets within .1 volt of Vf.

Doug Owen
 
I tried it using a generic Transistor I had laying around.I think it's a 2n2222.Anyway it switches on and off from light to dark but the output is really dim now.Compared to the same setup without the dark switch.I guess I'm not applying enough power to the base of the transistor?

Maybe I didn't follow your directions correctly.I'm not sure what some of the terms yo used mean hehe.B minus(battery?),drain(I don't know emitter?) and gate I don't know(is it the base?).Sorry I'm such a newb with this stuff
but I'm learning. /ubbthreads/images/graemlins/smile.gif

Ernie
 
No problems.

Yes, you probably need more base drive to turn a bipolar on harder. Look for Vsat (collector to emitter voltage when on) to be a few tenths. With a FET you can get far under that. By selecting the type and driving hard enough you can get under .1 Volt with bipolars.

Yes, B plus and minus are the battery. Gate, Drain and Source are the three leads on FETs (roughly similar to Base, Collector and Emitter respectively (although not necessarily in the same places, check the pin out on the device you use.

The advange to the FET is not only low voltage drop, but Gate drive currents (and therefore standby battery drain) is almost trivial.

Doug Owen
 
Ernie,

I presume you are using 2N2222A TO-92 package (plastic casing) not TO-18 metal can. The pins are CBE from the front view. 2N7000 Doug uses is also TO-92 and the pins are SGD from the front view (opposite order).

That means you can just replace your 2N2222A with 2N7000 by plugging it upside down and you maintain the rest of circuit.

You will provably find that the brightness control is a lot smoother than 2N2222. You will need to find out the best combination of the resistor value in combination of the CDs value you are using. I suggest to use 1M VR instead and adjust it to a reasonable sensitivity.

I would also suggest to use higher battery voltage as Doug and direct drive the led instead of using a switching driver if the size allows. The circuit would be a lot easier and cleaner to manage unless you want to try out the switching driver.

If you use yellow LED, the Vf is usually below 2V and it will go on till morning with even 2 NiCd cells. But I find that just having 1 5mm led is too dim for kids room night lamp. I use 2 8mm blue leds running about 50mA each from the wall plug, that is nice.

-- dj

8mm_night_light_3.jpg
 
I'm having trouble computing the resistor needed to control the amount going into the base on the light switch transistor.I have a 2.4v supply(2aa nimh) and then I'm driving 3 LED's in parallel using the same circuit as Viren.I think I read someplace it's the same as the Brinkmann but I'm not sure.

So I guess I need to know the amount of current the LED driver needs correct?From what I've been able to find so far and this might be wrong is that I divide the load current by the minimum Hfe?Then I take the voltage supply of 2.4v and subtract the .65v needed by the base and get
1.75v.Then dividing 1.75v by the amount I got from the Load current divided by the Hfe and that will give me the correct resistor amount?

The more I read the more confused I'm getting.I don't even know if what I wrote above makes sense.I think when I read one new thing it pushes an old thing out you know... lol

Ernie
 
As an Amazon Associate we earn from qualifying purchases. Product prices and availability are accurate as of the date/time indicated and are subject to change.
Hello there,

I think everyone can help you better if you measure the
'light' and the 'dark' resistance of your photo sensor.
Not all photo sensors have the same resistance.

To get the 'light' measurement simply measure the
resistance with the amount of ambient light you wish
to detect as 'off' for the LED and have the sensor
located in the same location that you intend to use it
with the final circuit.

Tell us these measurements and you'll get a circuit
pretty fast.

It may be required that in order to use the generic
NPN transistor you've been talking about instead of
one transistor you might have to use two -- one more
for extra amplification for the photo sensor if the
'light' resistance isnt low enough. This would be
typical with those tiny little ones (something like
0.125 inch diameter).
I'm guessing it's CdS?

Get those two measurements and report back...

Take care,
Al
 
Hi MrAl,

I did what you asked and measured the photoresistor.In the level of darkness I would want it to come on the resistance measured 32k.In the level of light I would want it off the resistance was harder to measure but I got around 1.2k.

I don't know if this is a CDS like you asked.I'm not sure what one looks like really.The item I am using is a 1/8" or so circle with a squiggly line down the middle.Maybe I have the wrong thing for the job?

Anyway I hope this is the correct information and thanks alot MrAl and everyone.

Ernie
 
Hi Ernie,

That's great. Those measurements will help define the
circuit needed.

Another test that will help...

Test #2

Hook up your circuit: tran emitter to ground,
collector to (-) of your LED circuit, base to resistor
1k ohms other end of resistor to positive 2.4v (i think
this is the way you had it anyway?) Positive of LED
driver circuit to plus supply. Turn power on.
Make sure your LED's turn on bright.

This test is to make sure your transistor can saturate
low enough to keep the LED driver circuit happy.
If the circuit isnt bright enough, then you'll have to
look for another transistor or else adjust the driver
circuit.
If you care to measure the current the driver circuit
takes that will help also.
While the circuit is running check the saturation voltage
of the transistor (collector to emitter) and record that
and report that value also. It should be low (typically
0.3 volts).

I'm assuming you have at least three (3) of these NPN
transistors laying around, and at least a 1k trim pot.
Do you have any PNP types too?

I guess you dont have any MOSFETs?

Take care,
Al
 
Yup, that's a CDS cell all right. It may end up being kinda low in value in the end if the goal is low current drain (long battery life).

To use such a cell, as MrAl suggests, we'll no doubt need an amplifier transistor as well as the switching one to turn the circuit on and off. It might be possible to directly shutdown the driver circuit you're using, can you provide the schematic?

OTOH, for the same application (automatic night light for a hazardous spot in the central house) I went with higher voltgage, a 334 based linear regulator, selected CDS cell (high dark resistance, low off current), and FET to switch. I run the LEDs at 2 mA (plenty of light really) and get two and a half months (more or less) from a charge on AA NiMH cells, performance I think it'll be hard to beat.

Doug Owen
 
c'mon guys, whats all this photoresistor nonsense ? /ubbthreads/images/graemlins/icon3.gif

Why not be adventurous and use an LED as your photosensitive device. /ubbthreads/images/graemlins/thumbsup.gif
Buffer it via the gate on a FET or input stage of an op-amp and make a true LED-aholic light level detector.

I have used this setup before for a light level detector, and it was sensitive enough to notice the difference in light level when moving my hand over the sense LED from a distance of about 4 foot away when outside on a cloudy day (No visible shaddows and lots of scattered light from all directions).
 
Hello,

I think he said he wanted to use 2N2222 transistors
because he already had them.

Take care,
Al
 
Hi everyone,

OK I wired it the way you said MrAl,putting the 1.2k resistor in there.The circuit seems a little bit less bright but not by much.On the measurement you asked me to get between the collector and emitter for some reason I could not get any reading on my DMM.Is it possibly to low
for my elcheapo DMM to measure?

Oh I forgot to mention this before but I do have some other transistors on hand.I have some 2n3904,2n3906 and also 5
Zetex(617 i think) but I'm kinda savin those for the day when I can make the Zetex300.

Anyway I'm going to pickup a new DMM today and I'll get back with the measurement you asked for MrAl and thanks again for the help.

Ernie
 
[ QUOTE ]
Ernie said:
I tried it using a generic Transistor I had laying around.I think it's a 2n2222.Anyway it switches on and off from light to dark but the output is really dim now.Compared to the same setup without the dark switch.I guess I'm not applying enough power to the base of the transistor?

[/ QUOTE ]

The dark detector seems working, but dim output..

I suspect that the voltage drop at the transistor is rather high and it doesn't provide sufficient current to the LED driver due to the low voltage.

Try to measure the voltage of the battery with the load, across the transistor and across the led driver. You may be surprised.

Some suggestions (recap from other gurus):

1) Use FET (with low Rdson) instead of a transistor.

2) Use higher battery voltage, 3 or 4 NiMH instead of 2.

3) A transistor amplifier may help.

-- dj
 
I still think we're going at this backwards. Driving the 3 LEDs with an inverter (with attendant inefficiencies) means that we need say five or six times the LED current from the supply. This is the current we must switch.

If, OTOH, we added a third NiMH cell we could use a linear regulator to drive a single LED to the few mA needed for a nightlight and only have to switch that much current. Consider the circuit I'm suggesting is working and gives over two months per charge.

That said, Al's on the right track. Start out with your circuit connected to the battery on the plus side. Minus to a NPN collector who's emitter goes to B minus. Try base resistors (to B plus) until you can get nearly full battery voltage across the load (your circuit), say .3 Volts at most 'left over' across the transistor. I suspect you'll need more current than 1.2 K will give you. You can check quickly to see how close you are by shorting the transistor out (collector to emitter) when it's already on, a big increase in light output tells you you'll need more base drive.

After we determine how much base drive is needed, we can figure out how to 'turn it off' with light (another transistor and a couple of resistors to go).

Like I said, 'been there, done that', but I found the approach I took used far less power and was simpler in the end.

Doug Owen
 
Well looks like my wife took matters into her own hands and bought a nightlight lol.

That's ok though because I'm not quitting until I finish
making one myself.Except now I'll use it for a outside light or something.

So after doing some reading and gaining a little more understanding I can see the way I was going about this
using bipolar transistors is not the best solution.

I also think I should take Doug Owens advise and use a FET
along with adding 1 battery for a total of 3 aa.

So here is a breakdown of what exactly I want to accomplish.I want to build an LED light with good brightness
that will switch on in the dark and off in light.I've got 3
blue LED's with wide angle that looks really good.They kind of have the floodlight effect and that's exactly how I would like to use the light.I have a couple solar panels in the garage that are around 5" square that I might be able to use for recharging the batteries I was thinking.

So what I understand is the FET would be a good choice because of it's lower power required to turn on?Will I need to rebuild the led driver for this project and use something more efficient than the Viren circuit?I do have a couple zetex300 chips but I don't think I can work with those small parts yet.

I will try and post a schematic of the driver I'm using later.

Thanks again
Ernie
 
Hi again Ernie,

I liked Doug Owen's idea about using 3.6v too. That
way you dont need a switching circuit to eat up some
of the efficiency, so i made this circuit to work
with either 3.6v or 2.4v ...

PhotoSensor-01.gif


Start without the extra resistor and diode (as noted on
the schematic) and see if you like it that way first.

If you find you would really want more hysteresis, another
circuit (which is a little more complex) would be needed.

BTW, as long as you are considering other circuit parts,
if you can get an LP339 ic chip you can tune
the circuit really easy to whatever light levels
you want to switch on and off at.

Take care,
Al
 
wow Amazing ....

I will try to build this kind of thing too... I already have a couple of 3904 & 3906's at my disposal.... and ofcourse the circuit itself...

I will first build up the Schematic in to a PCB... /ubbthreads/images/graemlins/smile.gif

Will post Soon ...

ViReN
 
Wow MrAl I can't wait to have a go at this.Once I get a place to store files I'll post a picture of my little light this is going to be used on.

Ernie
 
Here they are...

Pic 1: I Hope i have properly reproduced the Schematic
LDRSwitchSchema.gif


Pic 2: If the above schematic is right.. then this PCB /ubbthreads/images/graemlins/smile.gif
LDRSwitchPCB.gif


Pic 3: Just the Copper Portion (you can use Laser Transfer Method to produce PCB)
LDRSwitchPCBOnly.gif


Pic 4: The Silk Skin
LDRSwitchPCBSilk.gif


If anyone needs any clarifications / wants to make any corrections... please feel free to contact me through this post....

I will also make to the scale drawings (if required).... I am also thinking of making AutoCAD based Layout for this... but that will come later...

Thanks & Regards,
ViReN
 
Back
Top