I am designing a circut to control the crossing lights and motors for the gates. I have an ideal to use photo sensors on the double main line, but I do not know if the senors should in series or be independent. I am also looking for some help in writing the code.
Is it a single direction track? You may want to look at a simple button with a spring lever (I can think of the actual name) or an IR beam
mwilliams184:
I am designing a circut to control the crossing lights and motors for the gates. I have an ideal to use photo sensors on the double main line, but I do not know if the senors should in series or be independent. I am also looking for some help in writing the code.
You could use photo resistors under each track so when the train blocks the light hitting them the arduino can trigger the crossing lights. (With a delay in turning them off once the normal light level has returned) You could probably run them in series or independent and either would work. However, running them independent of each other will allow you to adjust them individually.
mwilliams184:
I am designing a circut to control the crossing lights and motors for the gates. I have an ideal to use photo sensors on the double main line, but I do not know if the senors should in series or be independent. I am also looking for some help in writing the code.
You'll probably also need sensors to tell when the whole train is clear of the crossing, as trains are of indeterminate length and speed. Also remember that two trains could be crossing at the (nearly) same time, so the gates will have to remain closed until both of them have cleared the crossing.
I would, therefore, use indepedent sensors, not connected in series.Your choice of sensor will somewhat depend on what gauge/scale you are modelling to. It's hard to hide a 1/2 dia. LDR on an N gauge layout