Photoresistor circuit help
Martin39
Posts: 7
Hi, I wanted to know if it is possible to controll an LED with a photoresistor with just 'one' pin on the basic stamp. I want to incorporate the BS2 into my n-scale model railroad to control LED signs. I want to have as many stamp pins available. So if anyone here knows if it's possible and what the circuit should look like, let me know. All I am doind is laying out photoresistors along the track and when the train passes over it, have the LED come on, with same output pin.
Thanx in advance..
Thanx in advance..
Comments
Amaral
you can take a look at RCTIME command for reading the value of the photoresistor .. and HIGH or LOW for the LED !
if you have too many leds and places for reading if the "train" is over .. you may need to expand your outputs.
but go little by little ..
Hope to help
Amaral
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
one way of expanding your OUTPUTS is to use a Serial to Parallel converter like 74hc595, with that you can control your LEDs. the code gets a little bit loger but is no problem .. for reading the values of the photoresistors you may need a multiplexer ! I have not tryed this. but a CD4051 may work.. it has an article on nuts and volts that is about expanding outputs but I really don't remember witch is to point you.
hope to help
Amaral
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
I'm a Stamp fan, and I rarely suggest not to use a stamp. My suggestion was primarily aimed to say that if you only want a simple on/off, you can do it with individual, identical modules (easy to reproduce in quantity once you knew what worked for you) that would only require two wires each (power) that you might even multiplex and run off your track setup without any additional wires.
With a stamp, you'll probably run 3 wires (Vss or Vdd, photocell, and LED) to each station from the stamp.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
thanx
you could use the same 4 outputs to step through the 16 leds and use a 5th output as a data bit to set the selected led on or off. The LEDs would flash on and off on a 1/16 duty cycle 1 time for each program loop. This might cause an annoying flicker, but I believe overvoltage to the led and a smoothing capacitor might solve that problem.
It seems like it might just be easier to use 1 input for each photoresistor and one output for each LED.
So I know that one I/O pin can control two LEDs, correct me if I'm wrong
A LO/0 is Ground, not a negative voltage.
You could connect a bipolar/bicolor with a resistor in series between two outputs, with one HI and the other LO and toggle them and work it that way.
Post Edit -- see "What's a Microcontroller", pp. 61-65
Post Edited (PJ Allen) : 9/26/2008 2:22:04 AM GMT