Large Scale Central

How to determine a car's direction of travel

Good day - at the ECLSTS a gentleman who attended my presentation asked if I could come up with a way to determine the direction of travel of a passenger car.

He had a USA Trains (I think!) observation car that had directional lighting. It worked properly when operated by standard track power but he was using constant track power with a radio control system so the lights never changed. The same issue would come up with DCC or battery operated trains.

He had installed with a mechanical solution but it created a great deal of drag on the wheels and was looking for a non-contact method of direction determination.

I was unable to come up with a circuit at that time but have given it a good bit of thought over the last few days and have a circuit that uses three magnets and a reed switch that does the trick!

While a rotary encoder would do the trick the 3 magnet / one reed switch solution seems simpler to me. It works with any Arduino and I plan on converting the code for the PICAXE.

I have documented how it works on my web page here:

http://www.trainelectronics.com/Articles/Wheel_CW-or-CCW/

I still have to do some additional testing and see if I can get it to work reliably with smaller scales (clear down to HO, perhaps). I thought it might be of interest to some of you who have similar issues with direction detection.

dave

Actually, this is very easy to do and can be done the same way that the Sierra Sound Systems initiates “coupler clank.”

The kadee is mounted with a bit of “slop” and I use a piece of brass glued to the “back” end. (Sierra used a micro-switch.) When pressure is applied to the Kadee (e.g., the car is being pushed) it closes the contacts and when being pulled, they open. The contacts can be used for any number of things including latching a relay.

Not a bad solution, Todd - As long as the car has enough drag on it to hold the coupler it would work.

thanks!

dave

Neat solution Dave, and I’m sorry to have missed your seminar. Any chance of it being on Youtube?

Cliff

Cliff - It is on YouTube now - have a look:

https://www.youtube.com/watch?v=u1K_C7T9Cfg
My PowerPoint sides and notes are here:

http://www.trainelectronics.com/ECLSTS2015/links.htm

dave

Todd, see, thats Dave. He always goes for the wiz bang solution.

Thats a neat trick Dave. I like it.

Would it interest you to know how I would have accomplished this same task using a regulator, a pair of 555 chips, a few small relays, a magnet on the wheel, three reed switches, and a few capacitors and resistors (and no PicAxe, Arduino, or programming)?

If so I can outline the procedure.

Todd Brody said:

Would it interest you to know how I would have accomplished this same task using a regulator, a pair of 555 chips, a few small relays, a magnet on the wheel, three reed switches, and a few capacitors and resistors (and no PicAxe, Arduino, or programming)?

If so I can outline the procedure.

Certainly, Todd - always interested in other ways to do things.

thanks

dave

I used a mule and two water wheels. (http://largescalecentral.com/externals/tinymce/plugins/emoticons/img/smiley-laughing.gif)(http://largescalecentral.com/externals/tinymce/plugins/emoticons/img/smiley-innocent.gif)(http://largescalecentral.com/externals/tinymce/plugins/emoticons/img/smiley-wink.gif)

A rubber tire hanging on a rope from a tree works for me …

OK, here you go. I guess I just have a simple mind and like to keep things simple.

Actually, if 24 volt relays were used, there is no need for a regulator beause the chips can operate at this voltage too.

Three reed switches are arranged along the axle line so that a wheel spinning a magnet will close the switches when the magnet passes. If three reeds can’s fit along one wheel they can be divided up between the two wheels on the common axle assuming they are fixed and always turn together (i.e., non-ball bearing) but this would require two magnets; one on either wheel.

For the sake of discussion, the “start” reed will be situated at 0 degrees along the wheel (straight up). The “forward” reed will be placed at 120 degrees and the “reverse” reed will be placed at 240 degrees. The actual placement is unimportant just so that when the car moves in a forward direction the wheel magnet first encounters the “forward” reed from the “start” reed, and vice versa in a rearward direction.

The “start” reed triggers a dpdt relay. There is a capacitor mounted in parallel with the relay coil such that when power is removed, the relay stays triggered for a moment (~1/2 second). If this capacitor presents too much “load” for the reed switch, a resistor can be used to limit the current through the reed.

The “forward” and “reverse” reeds serve as triggers for a pair of 555 (one 556) timing chips. The triggers are set in series with the contacts for the “start” relay such that if the “start” relay is active and a trigger relay is activated, its current can flow to the 555 chip. This triggers the chip and it throws its relay. If the “start” relay is not active, no current can flow to trigger the forward and reverse chips.

The “forward” and “reverse” chip relays are wired so that one armature and set of contacts are used to power the LED or whatever you desire. The other set of contacts are also in series with the trigger reed for the opposite direction. I.e., if the forward relay is active, the reverse reed switch becomes disconnected and vice versa. Additionally, the contacts allow the reed switch to close the circuit that is connected to the active chip. So if the forward relay is activated, it also lets the forward reed “communicate” with the forward chip when the magnet passes regardless of the state of the start relay.

The 555 chips are wired for “one shot” (monostable). There are two possible configurations. In one, the chip accepts a trigger pulse but will then ignore all further trigger pulses until it “times out.” In the other configuration, the chip will restart its timing cycle from the beginning when it receives a trigger pulse before it times out. This is the configuration we will use.

So, let’s run it through in a forward direction and say the magnet starts at 180 degrees or straight down between the “forward” and “reverse” reeds. The magnet begins to spin and first encounters the “reverse” reed. This pulses the reed, but the circuit is incomplete because it is broken by the “start” relay so nothing happens.

The magnet moves on and encounters the “start” reed. This closes the “start” relay and the magnet moves on. The capacitor in parallel with the “start” relay holds the relay open as the magnet triggers the “forward” reed switch. Current flows through the reed then through the “start” relay to the “forward” 555 chip. The chip activates its relay powering the LED, breaking the path between the reverse reed and its chip, and making a path between the forward reed and its chip. We’ll set the “forward” and “reverse” chips to time out at 2 seconds. If no activity detected within that time (e.g., its reed is not triggered) it will reset its relay to the open position. The capacitor on the start relay eventually runs out (e.g., ½ second later).

The magnet proceeds around and encounters the reverse reed. This closes the reed, but it cannot communicate with its chip because the series contacts on the “forward” relay is interrupting the path so is ignored. The magnet proceeds around and encounters the start reed and triggers it. But the forward chip is already active and its reed is already connected to its chip, so it’s a moot point.

Eventually the car stops and the chip times out (at two seconds) and whatever direction the car restarts will dictate its behavior until it stops again.

Todd - interesting but it will require a few more “reads” to begin to grasp exactly what you are describing. I work better with visuals & schematics…!

For what it is worth I think the software is easier to understand and implement, but different strokes for different folks!

Thanks for your description… if you ever build one up I would love to see it in action

dave

Gee, wouldn’t it be a lot simpler to put a slip coupling on the axle? When the axle turns one way, the coupling rotates until a tab on the coupling hits a stop, and a sensor there reads that tab. When the axle roatates the other way, the coupling rotates until the tab hits another stop, triping a different sensor. Done properly the dag would be minimal.

I am sorry, I am a hardware guy.

But, really, isnt it the conductor’s job to turn on and off the markers?

Good thought, David - there are many ways to skin this cat ----- so far we have at least 3 or 4!

dave

Thanks Dave, I look forward to watching it!

Todd, any chance of a schematic?

I was recently toying with a design for a metal wheel sensor, for block detection purposes. Which, if located one right behind the other, might be useful for directional indication (for off-board purposes, not on-board though). But I got lost on the electronics…

Cliff

Cliff Jennings said:

Todd, any chance of a schematic?

I was recently toying with a design for a metal wheel sensor, for block detection purposes. Which, if located one right behind the other, might be useful for directional indication (for off-board purposes, not on-board though). But I got lost on the electronics…

Cliff

If I did, it would be “generic” in that the parts would be shown, but not the values some of which would need to be worked out based timing and in some cases, the actual parts chosen. For example, the capacitor that holds the “start” relay would be dependant on the selected working voltage and the coil resistance of the chosen “start” relay. Also, it would not include the “noise/glitch reduction components” so often required when these electronics are used with motors in proximity.

But if you/someone are familiar with basic electronics and the workings of the 555 chip, you/they should be able to produce a working version from the schematic. If this is something that you want to persue, I will try to get a schematic together. But if it is just a passing thought, and no one else is interested, it’s really not worth the time and effort. I run simple track power so this is just not an issue for me.

I’m working on it Cliff.

OK, I’ve done up the schematic to show how to accomplish the feat using two LM555 chips, three dpdt relays, three reed switches, and a few components. The assumption here is that this is used at ~24 volts (i.e., DCC) and the relays and timing capacitors and resistors on the LEDs are “sized” accordingly. If this is to be done with battery power or a lower voltage through a regulator, the relay and timing capacitor voltages and LED resistors should be “resized” accordingly. Wiring would be a bit less complicated (no diodes necessary) if 4pdt relays were used, but they are harder to come by and more $$$ (especially in 24 volts). The 555 chips will operate at this voltage. Also, you would want to put “reverse bias diodes” on the two chip relay coils to reduce electrical “kick-back” to the chips, if they are not already included in the relay package, as some are.

I also made a few revisions so that the “start” relay no longer needs a capacitor or to time out and will stay triggered until the “forward” or “reverse” relay triggers.

All component values are shown except Rt and Ct. These represent the timing resistor and capacitor for the 555 chips and you want to size them to attain about a 2 second “time out”. The combintation of resistor value times and capacitor value times a “constant” determine the “time out” for the chips and can be sized for what’s at hand. If someone is intererested in building this, I can figure the values.

The schematic shows two LEDs, but these could be replaced with a common anode, bi-color LED.

As I said, I guess I have a simple mind and like to keep things “Old Skool.”

(http://largescalecentral.com/public/album_photo/6f/d8/01/1d598_e6f2.jpg?c=8a1e)

A really simple way for determining direction would be to have an axle drive a small motor (a DC motor will be a generator) and the output would change polarity with a direction change. A small motor may have less drag than the wheel brushes. Now to have a double ended motor that car wheels can be mounted to to eliminate gears/drive belts.

You can even drive a led or a logic circuit with this method and no computer chip or relays needed!!!

Dan, and at how slow of a speed would that work? I guess if the pulses (at slow speed) would tell the circuit the direction, and the circuit would hold that setting until it was told a different direction, it would work.

The generator could also feed power back to the train for Stacy’s perpetual motion train. (http://largescalecentral.com/externals/tinymce/plugins/emoticons/img/smiley-wink.gif)

Sorry, I just could’t help myself. (http://largescalecentral.com/externals/tinymce/plugins/emoticons/img/smiley-undecided.gif)