BBV wrote: > > We at BBV in England are looking for a Twilight switch IC > similar to the obsolete "Allegro" ULN3390T for use in a PIC > based 16C74A project. > > This had connections for power and ground and an open collector > output, which went low in darkness and O/C in light, all pretrimmed ready > to use, Any suggestions ??? > > Alan Forster BBV > engineering@bbvcctv.demon.co.uk An ordinary photodiode connected port input pin to cathode and anode to ground along with a 2M2 resistor pull-up will work reasonably well if you are willing to do some software debounce in situations involving purely fluorescent light. Actually, depending on the photodiode, lensing, desired switching threshold, and so on, the value of the resistor will vary. You can start out by using a 2Megohm pot. If you need some hysteresis with this scheme, particularly if the PIC turns on a lamp. You can use another port pin to pull the photodiode port input in the appropriate direction. For 20% hysteresis, use approximately 5 times the pullup resistance mentioned above. For example, if your pullup is 1Meg, connect a 4M7 resistor from the photodiode input Px to another port pin, say Py. Initially tristate Py. Then, whenever you sense Px low (light condition), set Py lo. When you subsequently sense Px hi (dark condition), set Py hi. There are lots of variations on this theme. BTW, you can use phototransistors with lower impedances if you like, but expect them to vary more from unit to unit (although their temperature stability is generally good). The BC junction of a phototransistor (if the B lead is brought of the package) makes a decent photodiode. -- Paul Mathews, consulting engineer AEngineering Co. optoeng@whidbey.com non-contact sensing and optoelectronics specialists