Skip to main content

Thanks everyone involved in making the pcb board and components list. Here I thought I found a good solution to eliminate the need of a IR sensor in an outdoor environment, never would I thought this could be a viable solution to substitute the IR153, and the use of this circuit without needing an Arduino is awesome for the average railroad modeler. Hats off to all. 👏👍🚂

Well guys, let's not count them chickens before they hatch!   I'm thinking it would be useful to get prototypes in the hands of some interested parties who would be willing to actually mess with it on their layout.   Like those late-night TV ads for some medical device, I believe it would have to be one of those "at little or no cost to you" deals though Medicare would not be required.

All the occupancy detection schemes have their plusses and minuses.  I think part of the fun with alternative technologies like ultrasonics is the adventure of finding new applications.  I think the precise distance discrimination/sensing capability might have as of yet undiscovered applications in running out trains!   

I remain baffled as to how the HC-SR04 module on eBay is 78 cents (free shipping from Asia) and includes a tracking number.

@stan2004 posted:
I remain baffled as to how the HC-SR04 module on eBay is 78 cents (free shipping from Asia) and includes a tracking number.

Stan, it amazes me at the costs of some of the stuff from China, small wonder they're eating our lunch!  I'm just afraid when they finish our lunch, the gravy train will pull into the station and stuff will get VERY expensive!

Here's the "first look" at an assembled PCB for this unit.  I have to say, works pretty well!  It's closest range appears to be 3-4 inches and the longest range was around 3 feet.  This was strictly preliminary testing saving a boxcar around.  Plug-n-play, it ran right out of the box.

I used Stan's choice for the relay, it's a 3A model.  You'll note the blank space for a 10A relay, you can mount either one.  I'm using a 5V 500ma switching module that I use on a number of products, but you can also use the LM7805T regulator in that spot as well.

I give a big hand to Stan, it worked as advertised just copying his schematic and plopping it onto a PCB.

HC-SR04 Ultrasonic Train Detector 1st PCB

Attachments

Images (1)
  • HC-SR04 Ultrasonic Train Detector 1st PCB
Last edited by gunrunnerjohn

As expected, there is interference when two of these can see each other.

I started out with the obvious configuration below.

I set the range to sense about 6-8" and fired the two up.  About every 15 seconds at a somewhat random time, one or both would trigger.

Next I pointed them at a 45 degree angle at the parts cabinets you see at the top of the shot, and it was pretty much the same, slightly less often I'd say.  Finally, I moved them about 4 feet apart and pointed at the cabinets or straight on they still triggered in a similar manner.

The last test was point them out where there was about 7-8 feet to the first obstruction, they didn't trigger at that point, at least for around 10 minutes.

An obstruction placed in front of one but out of the sensing range did seem to block the signal and the other unit stopped randomly triggering.

Obviously, the use of these would have to meet some guidelines on positioning.

OTOH, they seem dead reliable triggering on a lot of different surfaces.

Attachments

Images (1)
  • mceclip0

John, those turned out very nice!  Too bad they interfere with each other.  Wonder if some type of a trackside enclosure would help the interference, maybe narrow the sensing area or something. Still quite useable for many things though.

If you are planning to sell any of those PCBs, I would be interested in at least two of them. I have some of the HC-SR04s I got a couple years ago for something else and never used. And thanks for creating and testing!

Any obstruction that blocks the path appears to knock down the interference, and once I turned them to where there wasn't anything to reflect the beam for a few feet, they no longer had a conflict.  I was impressed on how well they ranged, if you had the sensing distance at about 6", anything at 9" didn't trip them at all.

I think what is behind what you aim them at is a primary factor in their interference.

I did order complete sets of parts and found some terminal blocks for the connections.  I'll have to wait for the Far East, getting the chips from my common sources was not possible, all the major houses were out of them.  eBay wanted a King's Ransom for the 'HC123 chips.

A better mousetrap has always been the bane of DIY invention!

I am just about done with my "phantom" occupancy detector.  That is, any self-respecting modeler built the phantom/transparent P-51 when it came out 50 years ago or so!

phantom ultrasonic detector

My idea is like the traveling O-gauge boxcar from a few years back.  My thought is I will send this to a fellow OGR member who would try it on their layout and give us feedback.  I will pay the $5 shipping.  Then, the next guy does his thing and writes up comments/observations on OGR and sends it to the next guy paying the $5 shipping.  And so on.  At some point I guess it comes back to me.  What I see is a DIY collaboration to experiment with a "new" occupancy-detection technology without the nuisance of ordering components, soldering boards, and so on.  Masks not required.   Anyone interested???

Separately, I commented earlier that packaging is a practical issue.  The ultrasonic module is kind of unusual and may be difficult to embed in a trackside utility cabinet or whatever.

ultrasonic split

So what if the HC-SR04 module can be placed in a simpler housing that sits trackside...and there are 4-wires that go to the electronics board that sits below the layout.  I realize I'm stumbling over my own words but I don't think it's practical to fabricate an odd-shaped trackside cabinet that is realistic...even with a 3-D printer.  The Lionel 153IR occupancy detector is quite an unusual shape; and IMO it doesn't even look like a realistic layout accessory.

I'm thinking it would be much easier to fabricate an above-ground cabinet for JUST the HC-SR04 module....and then run 4-wires to the electronics which can be the circuit board without an enclosure as it would sit below ground (under the layout).  Again, feedback???

Attachments

Images (2)
  • phantom ultrasonic detector
  • ultrasonic split
Last edited by stan2004

Sorry I haven't commented lately, Life has made me take a break from anything to do with trains.

Stan, I like your idea, and I would be interested if it was all just plug and play. I would even be willing to try and build a cabinet for it that might look more realistic.

I do have one question though, how do you think this would work with 3 or 4 tracks within the same range?

@mike g. posted:

...

Stan, I like your idea, and I would be interested if it was all just plug and play. I would even be willing to try and build a cabinet for it that might look more realistic.

I do have one question though, how do you think this would work with 3 or 4 tracks within the same range?

Well we have at least one brave soul!   Yes, it will be plug-and-play.  You apply accessory AC to the 2-terminal connector...and then attach 2 or 3 wires (depending on your accessory) to the 3-terminal connector.  No soldering required.

The unusual thing about this ultrasonic detector is the sensitivity is very precise in terms of distance to target.   So if you have 4 parallel tracks, you should be able to set the detector to trigger on the closest track ONLY (ignore 3 distant tracks)...or the 2 closest tracks ONLY (ignore 2 distant tracks)...or the 3 closest track ONLY (ignore most distant track).

Obviously, those guys that are able to wire the parallel tracks using the insulated-rail method can effect similar precision on which track(s) trigger an accessory.  This method has the sometimes useful benefit that in can be done after-the-fact so you don't have to rip-up carefully ballasted track.  It also applies to 2-rail or situations where you might not be able to use the insulated-rail method.

As GRJ alluded to earlier, it's not clear how much interest there is in this "new" technique.  I'm particularly interested in guys that might discover some specific applications where the ultrasonic method is particularly well suited.  Sort of like the topic of this thread in the first place...where the ultrasonic method turned out to be particularly suited for an outdoor layout.

John; I would be interested in a few boards if you still have stock; say 4 or maybe 6. Can you let me know pricing etc please.

Many thanks to the OP for tuning us into this neat idea, and Stan for developing the circuit to put it into motion, and to you for laying out the circuit board and BOM! Neat project. I only just got tuned into this thread thanks to rtr12!

Thanks, Rod

John I presume your parts kit will be less the actual HC-SR04 detectors, and likely the relays, since there are two options there. Did I get that right? Is everything else on the BOM included?

Also I am not clear on how two of these are interconnected (or if they are) so that the signal goes red on block entry and green on exit? How does that work?

Stan I love that transparent P-51 Mustang model. Sure wish I had known about that back in the day. I am a big fan of warbirds and in particular the  Mustang; the perfect marriage of American airframe design and the ubiquitous British RR Merlin V-12 water cooled engine. Always would have loved a flight in one, but alas the remaining airworthy examples are all in the hands of rich warbird collectors I guess. Very neat to see (and hear) them at airshows though. Sigh..... Sorry for digressing.

Rod

I anticipate having all the parts in any kit.

I have a bunch of each relay, so I'll just use them up.  I also have a number of the HC-SR04 modules.  The Chinese, in a rare fit of generosity, sent me a duplicate order for six of them out of the blue, so I have more than I anticipated having.  I also put in an order for eight more from AliExpress so I had enough for all the remaining boards.  The other components that were not readily available or too expensive are also coming from AliExpress.

The relays are simply a set of FORM-C contacts that are totally isolated from any circuitry on the sensor board or it's power.  You can obviously wire it just like any other ITAD type sensor for common signals.  For the ones I make and keep, I'll probably use the 10A relays to give me maximum flexibility in their deployment.  The 3A relays have lower coil currents, so for signals they are probably a slightly better choice.

I'm building a layout now and I want block occupancy detection for signals, visual confirmation of occupancy and future automation.  I am an old model railroader and very familiar with insulated rail.   On a longer mainline block away from yards, one must put in several insulated rails to pick up occupancy.  I wonder if this sensor could have an advantage over insulated rail in these circumstances.  Might need several just like insulated rails?  They sound a little fussy for use in dense yard areas?  Wondering?

Bill

@Rod Stewart posted:

...

Also I am not clear on how two of these are interconnected (or if they are) so that the signal goes red on block entry and green on exit? How does that work?



...

The two detector configuration, for example one on each side of a crossing, has been a wiring challenge for 3-wire signals where you must explicitly drive the Red wire to turn the signal Red, or the Green wire to turn the signal Green.  The 3rd wire is common.  There are crossing gates that have this same requirement - explicitly drive one wire for gates down and drive another wire for gates up.

In such a situation, two Lionel 153IRs or MTH ITADs require an external relay to arbitrate the possibilities that one or both of the detectors might be triggered.  That's because these detectors have its relay outputs (to the signal) hard-wired internally to AC power.

two spdt relays in OR configuration

As designed and as GRJ mentioned above, the relay COM (common) is isolated from anything else and is not internally connected to Accessory AC.  This allows you to take the COM of relay 2 and connect it to NC of relay 1 (shown above as "the key").  In doing so you can then have the two relays working together so that if either or both detectors are triggered, the signal will receive the correct command.

This situation has been described in earlier OGR threads.  I'd have to dig around to find it, but there was one thread where some time was spent discussing how to modify a 153IR to isolate the relay contacts thereby allowing this type of "daisy-chain" like wiring thereby not requiring an external relay.  I believe the conclusion was it would be quite a bother to do so considering an external relay would be maybe $10 or so.

The issue though, which is unresolved, is how closely you can place two of these ultrasonic detectors without interfering each other.  After all each detector is sending an acoustic pulse that bounces around and might make its way to the other detector.  GRJ discusses some placement/interference experiments in a previous post. 

As a "new" technology, this is exactly what we're trying to find out.  What are the limitations, guidelines, or whatever to applying this?

But speaking of "interference" haven't you come to a crossing with the gates down and there's no train in sight?!  The gates go up after a while and life goes on.  This "false positive" might actually make a layout more interesting!

Attachments

Images (1)
  • two spdt relays in OR configuration

John, glad to hear that your kits will be complete with detectors and relays. Good news!

Stan I recall the previous thread and the daisy chaining of two or more detector relays as you show above. I was wondering if that is how it might be done. Thanks for sharing.

I also recall the lengthy thread about 2 years ago regarding use of 153IR's and Itad's for driving interconnected crossing gates, signals and such. I agree that modding a 153IR to isolate the relay common is a bit of a chore considering adding an external relay to the circuit is pretty simple. I wound up creating a small pcb to accommodate a small 2 amp relay for these stuations, and it works quite well. I have also previously used DZ-1008 relays in a couple of similar setups on the layout to drive crossing gate pairs, but they do seem like overkill for driving signals. But hey, they work.

Overall this is a pretty neat project and I hope it continues to generate interest! Looking forward to the kits John.

Rod

@Rod Stewart posted:

...

Stan I recall the previous thread and the daisy chaining of two or more detector relays as you show above. I was wondering if that is how it might be done. Thanks for sharing.

I also recall the lengthy thread about 2 years ago regarding use of 153IR's and Itad's for driving interconnected crossing gates, signals and such. I agree that modding a 153IR to isolate the relay common is a bit of a chore considering adding an external relay to the circuit is pretty simple.

...

Right, the daisy-chaining is exactly how it might be done.  It's all about isolating the common of the SPDT relays.  In addition to the nuisance of performing surgery on the 153IR circuit board, that thread also revealed how different versions of the 153IR (all with the same SKU #) had different instructions of which wires/traces to cut, jumper, etc..

Of course the more recent releases of signals and crossing gates have gone to a single trigger wire (rather than two).  In such cases you can parallel the NO outputs of multiple 153IR or detector relays such that if any of the relays is active then the signal or gate is triggered.

Last edited by stan2004

In thinking about this some more I like Stan’s idea about mounting only the HC-SR04 heads at track level, maybe in a small 3D printed trackside cabinet, and having the board mounted under table so it’s out of the way. I am looking forward to getting the kits and playing around just to see what we can do with them.

I have no real complaints with the way my current signals, gates, etc operate using mostly Z-Stuff sensors and 153IR’s. But from what is being described in this thread these detectors should be more reliable, not prone to differences in lighting or different paint color problems, triggered by any kind of surface, and easily adjusted to small or wide ranges of sensing. The real test will be tank cars, which IR sensors just mostly do not detect in my experience.

Rod

Add Reply

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