AlmightyArjen

Automated vintage 7866 level crossing

Recommended Posts

Hi,

I'm busy with a big automation project (fully automated coal terminal) and I wanted to do something else in between. So I made a "quicky": I've automated the 7866 12V level crossing! Two sensors detect trains and the microcontroller (Arduino) lowers the bars. The bars go up again when the last wheel of the last wagon of the train has passed the sensor 2 seconds earlier. Pretty plain and simple! I've made a nice vid:

In the video you'll see also my BNSF coal train, which is one of the three coal trains that will run in the project that I'm currently working on.

Share this post


Link to post
Share on other sites

That's great- love the old-school look with new-school automation! :)

Looking forward to seeing the whole coal terminal!

Share this post


Link to post
Share on other sites

A while ago I made a level crossing using micro motors, which moved the bars very realistic. The problem with that was that it took 2 seconds to lower the bars. Result of that was that you had to place the sensor something like 2 meters before the crossing: this was not very pracital. In the current system, I just use the "motors" that came with the 7866 set, the advantage is that you only have to place the sensor one halve meter before the crossing...

Share this post


Link to post
Share on other sites

AlmightyArjen,

Can you possibly explain how you did the electrical components of this system. I have those very crossing arms and made a simple micro-motor driven mechanism ( rubber bands & pulleys ) inside a small structure, along with the old fashioned 1x4 light plate. One direction of current and both lights come on, when the voltage is hooked up in a reverse order you get alternating flashing lights, just like the real RR Crossing. :wink:

Currently I just use a reversing switch and operate this by hand, when I feel like it! :grin:

Forgot to add, I love your Coal Train............ :wub::thumbup: :thumbup:

Edited by ritztoys

Share this post


Link to post
Share on other sites

The motors are driven a L293D chip. Two bits from the microcontroller are used as inputs on this chip and as output there are two wires which you can connect to the motor/switch/whatever. For example 10 as input bits make the motor turn left, 01 make the motor turn right. 00 or 11 as input bits and the motor will not turn.

On the L293D are two channels like described above. I use one channel for the motors for the bars and the other channel for the lights. I just use the original pulse-block that comes with the 7866 set. So the only thing I have to do is turn the lights on and they flicker automatically.

Got it? :)

Share this post


Link to post
Share on other sites

Alrighty then! No not really, I'm a little computer/electronic challenged. I've heard of this stuff before, but I'm clueless. :wacko::blush:

Do you have any links on where I might learn about this idea in your train layout?

Any help is appreciated......... :wink:

Share this post


Link to post
Share on other sites

Ehm, difficult. It's not just basic electronics knowledge, you have to program too. I started my own website a few weeks back, www.almightyarjen.com , where I will explain in detail all of my creations. But it's still under construction so you'll have to wait a few months ;)

In the mean time, this is a good website for some electronics know-how:

http://www.electronics-tutorials.ws/

As a programming platform I use Arduino, which is really easy to learn. Search on that and you get a bunch of tutorials...

Share this post


Link to post
Share on other sites

Ehm, difficult. It's not just basic electronics knowledge, you have to program too. I started my own website a few weeks back, www.almightyarjen.com , where I will explain in detail all of my creations. But it's still under construction so you'll have to wait a few months ;)

In the mean time, this is a good website for some electronics know-how:

http://www.electronics-tutorials.ws/

As a programming platform I use Arduino, which is really easy to learn. Search on that and you get a bunch of tutorials...

Thanks for your reply, I'll look into the information and 'bookmark' your website............... :wink:

Share this post


Link to post
Share on other sites

Neat stuff, so what do you do for sensors? A break beam light sensor? Also, does it work with trains traveling either direction, or just one way right now?

Share this post


Link to post
Share on other sites

I've used IR sensors that detect a reflection. In the past year I've tried various sensors from DX.com and they were all very instable. Now I have these sensors and I like them a lot:

http://www.hobbytronics.co.uk/sensors/sharp-distance-sensor-5cm

The system in the video contains two sensors, one per track, and therefore not able to detect a train from the other direction. But one could easily upgrade it to a system with four sensors. It needs some minor reprogramming and that's it. I've chosen for two sensors since I almost never reverse the polarity on the rails to make a train go the other way...

Share this post


Link to post
Share on other sites

Thanks for the link and your information, this component appears pretty easy to set up. :sceptic:

Is the diode sensor used to trigger the PC board and therefore control the two circuits? ( forgive my ignorance, I'm not too good with electronics, unless they are explained to me real well :blush: )

Edited by ritztoys

Share this post


Link to post
Share on other sites

A while ago I made a level crossing using micro motors, which moved the bars very realistic. The problem with that was that it took 2 seconds to lower the bars. Result of that was that you had to place the sensor something like 2 meters before the crossing: this was not very pracital. In the current system, I just use the "motors" that came with the 7866 set, the advantage is that you only have to place the sensor one halve meter before the crossing...

Nice video. Moo... :laugh: Would slowing the train down near level crossings help?

Share this post


Link to post
Share on other sites

Beautiful build! and nice video :-)

Have you tried using "Reed Switch", it cost less and I think you have less false detection than IR detector

http://en.wikipedia.org/wiki/Reed_switch

I am building a reverse loop with these switches for 12V

It works well for me because I need to detect the locomotive. (the motor)

In your case, you must add a magnet in the last car to close the level crossing

Share this post


Link to post
Share on other sites

I've used IR sensors that detect a reflection. In the past year I've tried various sensors from DX.com and they were all very instable. Now I have these sensors and I like them a lot:

http://www.hobbytron...ance-sensor-5cm

If they report distance with sufficient precision and accuracy, you should be able to use the two sensors you have to monitor both directions of train movements. You could even work in some reasoning to figure out which direction the trains were moving, even with occlusion. ...

Doh! Just read the specs in greater detail. Only presence sensing out to 5 cm, so just enough to monitor one track and no range info. So never mind...

Still neat stuff you are doing.

Edited by zephyr1934

Share this post


Link to post
Share on other sites

Beautiful build! and nice video :-)

Have you tried using "Reed Switch", it cost less and I think you have less false detection than IR detector

http://en.wikipedia....iki/Reed_switch

I am building a reverse loop with these switches for 12V

It works well for me because I need to detect the locomotive. (the motor)

In your case, you must add a magnet in the last car to close the level crossing

Would the magnet in the coupling be sufficient to trigger the reed switch? I know on my old 12V If a car was parked on an adjacent line you could see the coupling magnet on it twitching as the couplings of an adjacent train went by, and that was 8 studs away at least!

Share this post


Link to post
Share on other sites
Thanks for the link and your information, this component appears pretty easy to set up. :sceptic: Is the diode sensor used to trigger the PC board and therefore control the two circuits? ( forgive my ignorance, I'm not too good with electronics, unless they are explained to me real well :blush: )

Yes, technically both sensors are connected to an interrupt pin of the microcontroller. This means that when a sensor is activated, the program immediately acts on it by opening (in case there's not another train on the crossing) or closing (in case they weren't already closed) the bars

Nice video. Moo... :laugh: Would slowing the train down near level crossings help?

Yes this would indeed be a solution. The only problem that occurs in my layouts are possible traffic jams, as I run multiple trains on one section...

Beautiful build! and nice video :-) Have you tried using "Reed Switch", it cost less and I think you have less false detection than IR detector http://en.wikipedia.org/wiki/Reed_switch I am building a reverse loop with these switches for 12V It works well for me because I need to detect the locomotive. (the motor) In your case, you must add a magnet in the last car to close the level crossing

Nice suggestion, not even thought of it! I don't know how close a magnet must be to the switch but in my experience it's always something of a few milimeters (or you have to use a bigger magnet). It could be done I think...

If they report distance with sufficient precision and accuracy, you should be able to use the two sensors you have to monitor both directions of train movements. You could even work in some reasoning to figure out which direction the trains were moving, even with occlusion. ... Doh! Just read the specs in greater detail. Only presence sensing out to 5 cm, so just enough to monitor one track and no range info. So never mind... Still neat stuff you are doing.

Your idea might work with another type of sensors, like infrared or ultrasonic distance sensors. By simply measuring the distance, one could easily detect which track is occupied by a train. I have thought of it but the downside is that you cannot connect that kind of sensors to a interrupt pin of the microcontroller. If the microcontroller has to do other things besides looking for a train on a track, it could be possible that the train isn't detected in time...

Would the magnet in the coupling be sufficient to trigger the reed switch? I know on my old 12V If a car was parked on an adjacent line you could see the coupling magnet on it twitching as the couplings of an adjacent train went by, and that was 8 studs away at least!

Good point indeed. Those magnets are pretty strong and a distance of 8 studs is more than enough. That might work I guess...

Thanks for all the questions and suggestions, I'm glad you like it!

Share this post


Link to post
Share on other sites

Would the magnet in the coupling be sufficient to trigger the reed switch? I know on my old 12V If a car was parked on an adjacent line you could see the coupling magnet on it twitching as the couplings of an adjacent train went by, and that was 8 studs away at least!

The reed Switch that I use can not detect the coupling magnet. (it need to be very close)

I put the switch under the 2x8 plate

The switch need to detect the polarity of the magnet but with the motor it's okay.

At full speed it work well, but actually I've only tested with a continuity detector (beeper)

My idea is to use only relay and not a micro controller like Arduino, So I don't have tested to detect with Arduino

The reed switch that I have buy:

http://shop.boxtec.c...ch-p-42011.html

Edited by freestorm

Share this post


Link to post
Share on other sites

With this magnet holder under the wagon it works, but the reed switch and the magnet holder need to not be in the middle of rail.

Because the metal of 12V rail will block the magnetism I think

2607.jpg

The magnet Holder is attached with his stud under the wagon

Sorry AlmightyArjen to hijack your post, I'll take time to create my own topic to explain my work in progress

Share this post


Link to post
Share on other sites

With this magnet holder under the wagon it works, but the reed switch and the magnet holder need to not be in the middle of rail.

Because the metal of 12V rail will block the magnetism I think

2607.jpg

The magnet Holder is attached with his stud under the wagon

Sorry AlmightyArjen to hijack your post, I'll take time to create my own topic to explain my work in progress

No offense taken! ;)

Share this post


Link to post
Share on other sites

Would the magnet in the coupling be sufficient to trigger the reed switch? I know on my old 12V If a car was parked on an adjacent line you could see the coupling magnet on it twitching as the couplings of an adjacent train went by, and that was 8 studs away at least!

A PF train motor has a fairly large magnet, I use that to detect trains using a reed sensor.

@freestorm, it could indeed be a case of shielding by the metal power rail, but you could mount the reed as far to the wheels as possible to make a decent detection.

Share this post


Link to post
Share on other sites

@freestorm, it could indeed be a case of shielding by the metal power rail, but you could mount the reed as far to the wheels as possible to make a decent detection.

Because the metal of 12V rail will block the magnetism I think"

Yep you are true JopieK, I would say the same, but my english is poor :-)

Edited by freestorm

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.