Skip to main content

Reply to "How to activate an accessory by track but only every 20th time the train goes by."

Dave45681 posted:

Has the time required for activating the full sequence been brought up?

At the moment, mine is packed away, but I seem to recall the trigger requires a good holding of the circuit closure (it's a DC motor that I'm pretty sure slowly opens the door, pauses maybe for a moment and then closes it, and repeats if you keep the circuit closed).

I tried reviewing the manual on-line, but the only nugget I could glean from the manual is that the switch is shown as slide action for on/off rather than a "press to activate" type of scenario.  (It also refers to using AUX2 vs AUX1 if using TMCC, which matches this observation).

It would seem the length and speed of the train could affect operation, more so than say a classic Gateman that is an instantaneous motion driven by a solenoid that just remains activated until the circuit is again opened when the train leaves the area. 

I know nothing about Arduinos, so sorry if this is a trivial concern, but it seemed relevant to the operation I saw in JGL's video.

If it's OK for the door to partially open and stay that way (for a potentially long period if we are waiting for 20 train passes to activate again), or stop in whatever part of the cycle it's in when the train leaves, then everything will be fine.

-Dave

The 'simple' fix here is that if the accessory always takes the same amount of time to complete one cycle, that can easily be added to the arduino's code.  You can say "when triggered turn on for however many seconds, then turn off.  Or you could say run until the train is past, then keep running until a full cycle is complete.  If the accessory does not run at a constant speed, it would get a little more complex to insure the door is closed except when triggered, but shouldn't be too hard to modify the accessory with some sort of sensor or microswitch to detect the position of the door.  

For the requests, I'll try to put together a proper schematic sometime later tonight or tomorrow morning, I'm traveling for work today and won't have any time till then.  This will likely sound like gibberish to some folks, but the electronics folks hopefully will follow along:  The basic set-up is fairly simple.  Connection from insulated-rail (blue button) goes through a diode and current limiting resistor(1.5k) then through the LED of an optocoupler.  track 'hot' connects to the other end of the optocoupler's led. Emitter of the opto to ground, collector goes to a digital input on the ProMini. A capacitor is then connected from the collector to Vcc to filter out the pulses caused by the 60Hz track cycle, providing a steady LOW signal to the digital input whenever a train is present.  I'm using the internal pull-up resistors on the ProMini, so that completed the RC circuit on the filter.  I arbitrarily chose 47uF for this cap, and it seems to work just fine.  I don't think precise timing is required here, so even if the thing stays 'active' for a couple hundred milliseconds after the train is gone shouldn't be a problem.  As it turns out it seems to respond pretty quick.  

On the code end, the random number is generated similarly to the code I posted above.  the total program is about 3 times as long now, but could probably be condensed by someone that actually knows what they are doing.  Anyway, the basic format is, a random number between X and Y is chosen.  I used between 15 and 25.  each time the input is triggered it adds 1 to a counter.  then when it reaches the random number the relay is turned on.  the program then waits for the input to turn off again (for the train to pass), then it sets the counter back to zero and chooses a new random number to start over with.  

Short answer, yes, it will be random even if you wait days between presses.  

JGL

OGR Publishing, Inc., 1310 Eastside Centre Ct, Suite 6, Mountain Home, AR 72653
800-980-OGRR (6477)
www.ogaugerr.com

×
×
×
×
×