Skip to main content

Ok follow along with me on this, as it is kinda confusing. 

I have the Lionel accessory "reading room".  It pretty much is an out house where when activated the door opens to see a guy on the hole reading a newspaper.  

I want to place it close to the track and as the train comes around it activates it and the door opens, as if the vibrations of the moving train opens the door.  

I do not want to activate it every time.  Maybe once every 20 passes of the train.  Is there any pre-made accessory that will do this?  Is there something that is easy to put together that will do this?

Thanks in advance.  

Original Post

Replies sorted oldest to newest

gunrunnerjohn posted:

I looked around and didn't see any "canned" solution to do the job.  I'd consider either an IR sensor or a short section of insulated track to do the triggering and one of the zillion eBay relay modules to perform the switching.  Any of the Arduino boards would do the job, it's a simple task.

John

Would you consider taking on the task?  put it together, program the Arduino, and sell it too me?

It depends on what you mean by "easy to put together." 

If the Arduino route is not in your comfort zone, are you able/willing to cobble together a circuit with a dozen or so components?  I'm imagining one of those eBay relay modules and/or a cycling timer module that turns ON 5% of the time.  For example, 1 second ON, 19 seconds OFF, 1 second ON, 19 seconds OFF, etc.  When the train initially hits the trigger point, a relay module looks at the cycling timer and if it is ON (1-in-20 chance) it lets the accessory activate for that pass of the train.  The other 95% of the time it ignores the trigger. 

Would need a DC supply to power the relay module(s)...but so would an Arduino.  I'm thinking less than $10 but would involve cobbling together some modules and a handful of components like capacitors, resistors, diodes...but NO writing software.

relay modules

Can you install an insulated-outer-rail section to serve as the trigger?  If not, there would be cost for an IR occupancy sensor or the like.

Attachments

Images (1)
  • relay modules
Last edited by stan2004
stan2004 posted:

It depends on what you mean by "easy to put together." 

 

Would need a DC supply to power the relay module(s)...but so would an Arduino.  I'm thinking less than $10 but would involve cobbling together some modules and a handful of components like capacitors, resistors, diodes...but NO writing software.

 

Can you install an insulated-outer-rail section to serve as the trigger?  If not, there would be cost for an IR occupancy sensor or the like.

Another no software option is a simple divide by N counter. This is just one of many types

Pete

Irrespective of how it's done, as is so often the case the what is the quagmire.

Do you really want 1 in 20 exactly like clockwork or do you want some randomness?  If you find 1 in 20 (or whatever) not to your liking, how do YOU change it?  For example, an Arduino could have provision to adjust the behavior...but you'd want to specify this up front.  A hardware-based approach might involve moving some wires around (if using a counter) or adjusting a trimmer control if using a timer.  Do you need an over-ride mode/switch to activate it every time or to manually activate it?  And so on.

As GRJ said, the best thing to use here is probably an Arduino or similar device.  The code is not very difficult, something like this:   (note that more than half of this "code" is comments describing how it works, the actual "program" that runs is only about the last 10 lines.)

int minimunLapsToTrigger = 10; // Set minimum number of laps before triggering.
int maximumLapsToTrigger = 25; // Set maximum number of laps before triggering.

int inputPin = 7; // Arduino pin connected to input circuit.
int outputPin = 8; // Arduino pin connected to output relay module.
int currentInputState = 0; // stores current state of input pin.
int lastInputState = 0; // stores last state of input pin.
int lapCounter = 0; // stores count of number of times train has passed.
int numberOfLapsBeforeTriggering = 0; // stores random number of laps before triggering.


void setup() {
// put your setup code here, to run once:
pinMode(inputPin, INPUT); // Set input pin as an input.
digitalWrite(inputPin, HIGH); // turn on internal pull-up resistor.
pinMode(outputPin, OUTPUT); // set output pin as an output
randomSeed(analogRead(A0)); // seed the random number generator with a floating value.


}

void loop() {
// put your main code here, to run repeatedly:
currentInputState = digitalRead(inputPin); // read input value into var.

// if train is there, and it was not on last loop:
if (currentInputState == 1 && currentInputState != lastInputState) {
lapCounter++; // increase lap counter by 1
}
lastInputState = currentInputState; // set last state to current one for next loop.

// if train is there and enough laps have passed:
if (lapCounter >= numberOfLapsBeforeTriggering && currentInputState == 1) {
digitalWrite(outputPin, LOW); // turn on relay, open outhouse door.
lapCounter = 0; // reset the lap counter.

// set a ner random number of laps for the next time.
numberOfLapsBeforeTriggering = random(minimunLapsToTrigger, maximumLapsToTrigger);
}
else { // if not enough laps:
digitalWrite(outputPin, HIGH); // turn relay off, outhouse door closed.
}
}

This code is untested, and needs a few tweaks in any case, like adding a de-bounce routine and such, but it shouldn't take much more than that.  A couple more lines could easily add options for a manual pushbutton trigger, or whatever other options you'd like.  I'd guess in a one off production all the parts to make a stand-alone, track powered, unit would cost less than $10 ordered from china, or $20 using US shipped parts.  I don't think the moderators here go much for folks peddling their services, but I'm sure you could find the email address in the profiles of folks that could throw such a thing together for a nominal fee.  

On the less computery end, you could use one of the timer relay modules in series with any other activator method, so that it would only allow the outhouse to be triggered every X number of minutes.  it's not as fancy, but it would get the job done.  

JGL

I like the JGL solution with the addition of a manual trigger input for a PB.  One of the dollar relay modules will do the switching, and you can use an insulated track signal trigger to do the inputs.  AAMOF, I'm currently finishing up building the first lot of these insulated rail signal drivers.   No debounce needed, that's all done for you with this insulated track module.

Attachments

Images (1)
  • mceclip0

Add Reply

Post

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

×
×
×
×
Link copied to your clipboard.
×
×