Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: cooldog on February 03, 2008, 07:49:21 PM

Title: LED turn on at night
Post by: cooldog on February 03, 2008, 07:49:21 PM
all in want is to wire a photocell and a led together with a circut and have it tun on when it is dark out

anyone kno of a simple cirut that will do this
Title: Re: LED turn on at night
Post by: airman00 on February 03, 2008, 07:58:28 PM
photocell with comparator
Title: Re: LED turn on at night
Post by: cooldog on February 03, 2008, 08:01:46 PM
whats a comparator ???

i found this but i still don't know what it is

http://www.facstaff.bucknell.edu/mastascu/elessonsHTML/Interfaces/ConvComp.html
Title: Re: LED turn on at night
Post by: airman00 on February 03, 2008, 08:04:19 PM
(http://www.facstaff.bucknell.edu/mastascu/elessonsHTML/Interfaces/ConvComp01.gif)

Ok you see in this picture V+ and V-

When there is more voltage in V+ then in V- the output of the triangle( comparator) is logic 1, or + 5 V
when the voltage in V- is greater , then the output is 0

so you have a photocell that changes value connected to V+ and a resistor connected to V-. When photocell has less resistance than resistor , output is +5V
Title: Re: LED turn on at night
Post by: cooldog on February 03, 2008, 08:24:24 PM
like this

(sorry it was quick)

http://s273.photobucket.com/albums/jj217/connornijsse/?action=view&current=led.jpg

any idea what resistor i should use

where can i get a comparator
Title: Re: LED turn on at night
Post by: Trumpkin on February 03, 2008, 08:41:04 PM
take apart an auto on nightlight.
Title: Re: LED turn on at night
Post by: cooldog on February 03, 2008, 08:43:01 PM
simple and genius

one problem most nightlights run from a wall plug not battery's
Title: Re: LED turn on at night
Post by: Trumpkin on February 03, 2008, 08:55:51 PM
Quote
simple and genius
thx  ;D. hmm good point about the wall plug.....I don't think there are led's that can take that voltage. I'm guessing that there is a circuit of some kind that steps down the voltage. maybe an easy hack. they aren't that expensive so you might want to try it.
Title: Re: LED turn on at night
Post by: cooldog on February 03, 2008, 08:59:23 PM
has anone ever seen a battery powered night light
Title: Re: LED turn on at night
Post by: airman00 on February 03, 2008, 09:19:47 PM
has anone ever seen a battery powered night light

nope


I attached the schematic

the resistor value you need to find out


when photoresistor gives out greater voltage than the resistor,  then the LED turned on, otherwise its not

EDIT: In my schematic the LED is connected to the positive , it should be connected to ground( negative)
Title: Re: LED turn on at night
Post by: cooldog on February 04, 2008, 06:46:25 AM
so the led should be between the 12 and the battery???


also how can i find out the resistor

you said that when the photocell gives off more power the led will turn on. but don't photocells gve off more power if there is more light.  i want it to turn on at night
Title: Re: LED turn on at night
Post by: HDL_CinC_Dragon on February 04, 2008, 11:14:56 AM
The more light, the less resistance there is through the photocell.

So, lets say you have a battery of 9v
You run 5v(depending on the threshold you choose for the amount of light) to the Positive(+) pole of the comparator. Then you would put the photocell in series between the battery and the Negative(-) pole of the comparator. During the day or lighted conditions, the photocell will have less resistance therefore letting more voltage through to the comparator. During lighted conditions, that of course depending on the threshold you choose, the photocell will let more than 5v through to the negative poll, therefore the output bit would be Zero(0). During darker conditions, the photocell will resist the voltage more and thus less than 5v will get to the comparators negative poll resulting in the output bit being One(1) which, if im not mistaken, should be 5volts output. I guess that would depend on the source voltage though. Then just run that 5v directly to the LED but through a resistor so that only about 1volt gets to the LED to extend its life time... or 2 volts if you want it to be much brighter but not last as long.

(http://img186.imageshack.us/img186/1502/lednightlightrp9.th.png) (http://img186.imageshack.us/my.php?image=lednightlightrp9.png)
Fixed the schematic :)
Title: Re: LED turn on at night
Post by: cooldog on February 04, 2008, 05:04:42 PM
thanks

that cleared a lot up

anyone have a pic od a comparator (i already checked google)

anyone know where to buy them
Title: Re: LED turn on at night
Post by: Trumpkin on February 04, 2008, 05:09:27 PM
here is one http://www.robotroom.com/Comparator.html
Title: Re: LED turn on at night
Post by: cooldog on February 04, 2008, 05:12:40 PM
anyone know where to buy them
Title: Re: LED turn on at night
Post by: airman00 on February 04, 2008, 06:10:33 PM
you buy a comparator in a chip


search for comparator chips ,

some comparator chips off the top of my head

LM324 - two comparators in a package
LM339 -  four comparators in a package


Within the IC is more than one comparator, just look in the datasheet of the chip to see which pins are connected to which comparator


Which distributor do you want?
Title: Re: LED turn on at night
Post by: cooldog on February 04, 2008, 06:53:19 PM
Which distributor do you want?

digikey

or any store located in canada

(i know digikey isn't loctaed in canada i just have experience with them) ($50 robot)
Title: Re: LED turn on at night
Post by: airman00 on February 04, 2008, 06:56:53 PM
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=LM339NNS-ND
 (http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=LM339NNS-ND)


I don't like digikey ,  I usually buy from allelectronics.com

they are much cheaper than digikey and have amazing service

buy this part from allelectronics
http://www.allelectronics.com/cgi-bin/item/LM339/search/QUAD_COMP_14_PIN_.html (http://www.allelectronics.com/cgi-bin/item/LM339/search/QUAD_COMP_14_PIN_.html)
Title: Re: LED turn on at night
Post by: bukowski on February 04, 2008, 07:08:48 PM
or you could do a voltage divider with the photoresistor in parallel with the led. The more light, the less voltage goes to the LED.
Title: Re: LED turn on at night
Post by: airman00 on February 04, 2008, 07:10:59 PM
or you could do a voltage divider with the photoresistor in parallel with the led. The more light, the less voltage goes to the LED.

but then the led would be on when its slightly dark


cooldog wants it either on when its very dark or off when its a little light outside
Title: Re: LED turn on at night
Post by: cooldog on February 05, 2008, 04:31:36 PM
any one know where i can sample a 2N4401 NPN Transistor, 100k ohms resistor, 470 ohms resistor

would something like this work
http://s273.photobucket.com/albums/jj217/connornijsse/?action=view&current=ledscimatic.jpg

also can anyone tell me the max voltage it can take
Title: Re: LED turn on at night
Post by: ed1380 on February 05, 2008, 06:13:38 PM
radio shack. just use the 5 fingered coupon
Title: Re: LED turn on at night
Post by: HDL_CinC_Dragon on February 05, 2008, 07:25:23 PM
radio shack. just use the 5 fingered coupon
Dont encourage stuff like that. That kind of thing pisses me off. If you dont have the money to go buy a few resistors, go around and look for some cans to turn in.
Title: Re: LED turn on at night
Post by: ed1380 on February 05, 2008, 08:22:11 PM
FYI i was being sarcastic.
Title: Re: LED turn on at night
Post by: cooldog on February 05, 2008, 09:00:52 PM
radio shack. just use the 5 fingered coupon

funny but slighty true... brings back memorys ::) just kidding ;D

also it'd the 5 finger discount not coupon

Which distributor do you want?

digikey

or any store located in canada

(i know digikey isn't loctaed in canada i just have experience with them) ($50 robot)

notice in canada. i was wondering about samples because they ship free. FYI radio shack doesn't ship to canada
Title: Re: LED turn on at night
Post by: javafiend on February 06, 2008, 08:00:07 AM
I found this on evilmadscientist.com. It's a dark-detecting LED circuit.

http://www.evilmadscientist.com/article.php/nightlight (http://www.evilmadscientist.com/article.php/nightlight)
Title: Re: LED turn on at night
Post by: paulstreats on February 06, 2008, 08:14:59 AM
You could also use an undervoltage monitor. Its a 3 pin package where +v goes in 1 end and gnd at the other. the third pin depends on what type you want so voltage will flow out of the 3rd if the input voltage is above or below a certain threshhold depending on the type you get. Most companies with samples programmes offer them
Title: Re: LED turn on at night
Post by: paulstreats on February 06, 2008, 08:16:52 AM
p.s. There could also be a market for well designed battery powered night lights since it is now recommended for parents of young children not to use the plug in variety since it encourages children to the plug sockets
Title: Re: LED turn on at night
Post by: Trumpkin on February 06, 2008, 09:33:49 AM
if you search on google i found a couple of night lights that were battery powered but none had a light sensor (photoresistor)