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.

Dark detector

Status
Not open for further replies.

b.james

Member
To suit my needs and my bits box I took the circuit below meant fo 6 V olts and used it in a 24 Volts system with a 24Volt relay and bumped the Variable resistor to 200K.
It works fine but of course the tranny gets pretty hot . Too hot to touch
I used a 2n2222A tranny
Can anyone suggest a modification to reduce the heat through the tranny as it will be on all night and I fear it will blow pretty quickly atm.?

Another issue with the design is it is a shadow detector rather than dark detector . It seems like it maybe needs a little more resistance , maybe a 500K pot I might try

Can anyone throw it in a simulation please I want it to just turn on at dark and stay on with minimum current use

dark-detecting-circuit.gif
 
Last edited:
The transistor gets hot because its not in saturation, the Base current is too small, you need a little positive feedback to provide hysteresis.
 
Thanks Eric - How would I do that ? Say a 10 K resistor from base to emitter?
Or " positive feedback" so a 10 k resistor from base to collector is perhaps what you mean.
 
The Relay has lots of hysteresis, but the transistor does not have enough gain to switch quickly.

Generally self biased BJTs need the base resistance 10~20x the load resistance. This will require a different sensor circuit as your photores., PR is too high. Consider a buffered photo detector from Panasonic in 5 mm case. Cheap and very accurate, avail. at D-K.

Otherwise a 2nd inverting BJT with 10x base R cascade with the pot to overcome inaccuracy . V+ must be stable!
 
Last edited:
Thanks Tony You are way over my head . care to sketch what you mean or alter my diagram?
 
Last edited:
Here's how you could add hysteresis, as Eric mentioned, and ensure the 2N2222 switches on fully:
DarkSensor.gif
Note the asymmetry of the blue curve, due to hysteresis.
R2 determines the amount: higher R = less hysteresis.
 

Attachments

  • DarkSensor.asc
    2.5 KB · Views: 309
The Relay has lots of hysteresis, but the transistor does not have enough gain to switch quickly.

Its not a matter of the transistor switching quickly, but either being switched hard On or Off.

Relays do not have any hysteresis that will help with circuit, in fact without any external positive feedback in the circuit the relay could 'chatter'.

Alec's option, ie: adding active hysteresis is the way to go.
 
Thanks Alect That adds about 2 extra transistors and 3 more resistors I see . I don't need it perfect just in the ballpark. Is there a less complex way? I have at least 5 of these to make as a day night control for my 24 Volt LED sensor spotlights .
LED https://secure.oatleyelectronics.com//product_info.php?cPath=73&products_id=1047
I bought about 10 lamp sets with a rather useless PIR sensor they supplied which they said was suitable for 24 V but turned out every one but 1 blew up . Don't recommend Oatley any more.

PIR **broken link removed** These appear very good value but no light sensor

My original design lasted the night with a spring type paper clip on the tranny
 
Last edited:
My original design lasted the night with a spring type paper clip on the tranny
In your original circuit.
Put a 3.3V zener with anode to base of transistor and cathode to sensor and pot. This will switch the the transistor at part of the curve of the sensor which give more resistance change to light change. This will make the switching more decisive.
 
Last edited by a moderator:
In your original circuit.
Put a 3.3V zener with anode to base of transistor and cathode to sensor and pot. This will switch the the transistor at part of the curve of the sensor which give more resistance change to light change. This will make the switching more decisive.

I liked you comparison of the moderators to Magistrates. They left the thread open as long as they get support for Nigel. It is lucky these moderators make decisions only about a forum and not about things that are important.
I'll give that a try thanks .


Keep on topic guy's
 
Alec_t - I decided to get the latest LTSpice and see if I could play with this myself .
Loading your file into the free version gives a components not found message for the Variable resistor, relay and photoresistor.

How do you fellows get around this ? . Is there a library I must download or do these only come with the paid version?
Mine seemed to come with only the very basic components .Any help appreciated
 
Hey Mirel that didn't work . Tried the diode round the other way too and its voltage drop altered things so that it did noot even switch on , So no go either way.

Downloaded a massive library for ltspice but shees what a mess . Took forever to extract and I have little help to install it . Overwrite the existing stuff it seems but then you loose the originals so , just a mess atm
 
Hey Mirel that didn't work . Tried the diode round the other way too and its voltage drop altered things so that it did noot even switch on , So no go either way.
Thank you for coming back to let me know, I dont have enough knowledge to explain what is wrong. I hope you get better help from others.
I don't know how to return the 'like' you gave me.
 
I don't know how to return the 'like' you gave me.
Look at this (or any post). Bottom right corner there are buttons. Like (thumb up) In some countries thumbs up does not equal like.
Dislike (thumb down), Informative, etc. Put your mouse over the little pictures and a message will pop up to explain each function. Click on one.

Try it on this message. I could use another LIKE or INFORMATIVE or THANKS. lol
 
Downloaded a massive library for ltspice but shees what a mess . Took forever to extract and I have little help to install it . Overwrite the existing stuff it seems but then you loose the originals
Once extracted, you only need to 'install' the bits you need. You can do this by copying relevant .asy files to any appropriates sub-directory in LTspice's ...\lib\sym directory, and copying their associated .sub (or .mod) files to the ...\lib\sub directory. Make sure you back-up any files in the ...lib\cmp directory before over-writing them!
The big zip library you downloaded should have the relay and potentiometer models in it. The LDR model I used is one I home-brewed. I've attached it here.
 

Attachments

  • Photocell.zip
    1.2 KB · Views: 276
... The LDR model I used is one I home-brewed. I've attached it here.
I unzipped it and tried it. Doesn't work for me.
 
Sorry, I uploaded an out-of-date Test file. The control voltage for the LDR model should be in the range 0 to 1 (not 1-100 representing lux).
Here's the latest version
 

Attachments

  • Photocell_Test.asc
    726 bytes · Views: 267
Here is my version of a photocell-activated 24V Schmitt Trigger circuit that drives a relay that exhibits snap-on, snap-off.

Note that I able to design and simulate this circuit in LTSpice without having a library of components for a photocell, pot, or relay.

First, this is a variant of a circuit posted here. I had to make an assumption about the resistance vs illumination curve of your photocell. Without any information from you, I arbitrarily model a photo-resistor that has a resistance of about 11KΩ when illuminated at the level where you want the relay to pull-in. If yours is radically different, you can play with R2 in my schematic to change the trip point.

Note how I simulate the varying resistance of the photo-resistor R1: I create an artificial voltage source V2 that varies linearly with time, creating a voltage that goes from 8V to 15V and back again. The resistance of R1 is the function 1000*V(Rt) which makes the simulated photo-resistor go from 8KΩ to 15KΩ and then back down again over 200 seconds (arbitrary time scale).

R1 is ratio-ed against R2 to create a voltage divider, where V(t) decreases with increasing illumination. Q1 turns on when V(t) is > V(ref) +0.65V.

I use R3 and D1 for two reasons. It is an indicator that the 24V is present and I use the voltage at its anode V(ref) as a reference voltage =~2V. This is dependent on the LED color, so you will have to resim the circuit and adjust resistor values if you change LED color.

R6 controls how much hysteresis there is between where the relay snaps on and snaps off. Again, if you want to experiment with different amounts of hysteresis, resim the circuit with different values.

Finally, you would use the sim to determine at what photo-cell resistance Q2 turns on and off. Look at the sim. I plot V(out) to show the voltage across the relay coil, and I also plot the expression V(t)/I(R1), which, when I learned Ohms Law, is equal to the resistance of R1. Note how I use the cursors to show the turn on and turn off resistances...

I attach the .asc file so you can play with. No additional library components needed.


photo.gif
 

Attachments

  • photo.asc
    2.6 KB · Views: 288
It would be many times easier to connect solar cells to a relay. Then sun comes up relay goes ON. When sun goes down relay goes OFF. Relay has 2 sets of contacts NO and NC. Make it simple, make it work.
 
alec-t . Sure you are trying to help but a little quizzical at your LTSpice diagram.
After much careful following of your posts and instruction to add the need ed libraries I get the following result and now am baffled . I'm not a quitter but I have spent hours trying to get LTSpice to work.
Counld not find an xphotocell anywhere
ErrorSpiceCapture.JPG
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top