Skip to main content

@BOB WALKER posted:

Did you ever consider using the Sharp distance measuring sensor? I have used it with good results in several projects.

Bob, I did a search for Sharp distance measuring and got several hits. One is a flat module that appears to be IR based, so it would likely be no better than the 153IR or any ither IR device. Another offering was called Pololu and looks a lot like the HC-SR04, though it was not clear what the technology is. Both seem to be around 9 bucks, so they are way more costly than the HC-SR04. Sorry I am not seeing any advantage?

It would help if you could tell us which particular device you are referring to?

Rod

Last edited by Rod Stewart
@BOB WALKER posted:

The Sharp unit is a GP2YOA21YKOF proximity detector which outputs a voltage corresponding to the distance to an object. I used it in several projects described in train magazines. Here's one of them.

https://www.youtube.com/watch?v=P8NJNvCfCU

I'm at a loss as to how this is superior, and it's an optical sensor.

Sharp GP2YOA21YKOF Specification.pdf

So I have some real layout experience to relate with these sensors. Today I did my #2 build and mounted it on a scrap of 2 x 4 to do some layout testing. This puts the CL of the heads at about 2" above grade, which seems like a good height for use with O gauge tubular track on cork roadbed.

I set the range pot to max (about 7" with these components) and it worked really well. No false triggering or spurious responses. and there is a "rock" wall about 13" away which had me worried, but no issues. And it nicely covers the two tracks at this location. Set the delay to about 12 seconds which looks about right to me. It is very repeatable. The train I was running has a consist of about 6 tank cars plus a few box cars etc. It triggered when it should have, and not anytime else. My conclusion (based on an example of one!) is that as long as the range setting is reasonable, which it will be with the specified components, there should be no problem with reflections, false triggering, etc. Works great.

When you stop a train in front of it with the gap between cars lined up with the detector heads, it times out as expected. But stopping with any part of any car in the beam of the signal kept it triggered nicely. No dropouts at all. I may try lining the head height up with the couplers and see if that keeps it triggered between cars. But overall I am very happy with how they work just as is.

Attached is a short video clip of the test setup. This is hooked up where a 153IR controller normally sits; one I had some troubles with as reported recently in a separate topic.

In summary I think these guys work better at detecting trains than anything else I have tried on my layout. The next step is to whip up some sort of small trackside building or similar to mount it in. How about it you 3D print design guys??

Of course another option is remote mounting the board under the layout as discussed earlier in this thread, but I have not tried that yet. Anyone else who had tried grj's kits got any experiences to report?? I think he has some kits left, for anyone else who wants to get their feet wet. its pretty neat technology. And thanks again Stan 2004 for doing the circuit design, it works really well!!

Rod

Attachments

Videos (1)
Train Detector Test

Try them at an angle to the track and they may catch the train and ignore the gaps.

In the datasheet for the HC-SR04 they say that the "Measuring Angle" is 15 degrees. Not sure but I think that may mean you have to be within 15 degrees of perpendicular to the reflecting surface for it to read the reflection. If true, that might limit how far off these can be mounted, but a little more experimenting  will tell I guess.

Rod

They might be erring on the conservative side.  I got reliable readings at over 40 degrees when I rolled a tiny car in at that angle.  I think coming in at 20-25 degrees would solve the problem of the gaps between cars and still provide reliable triggering.



Good to know John. Overall I am quite happy with the way these things work. Just need to come up with a convincing small structure to put on the layout that will hide the sensor heads now.

I have been playing with some housing ideas for the sensor head that might work on the layout without looking too "clunky". Here are some pix of one idea. This is actually the large relay cabinet in the Lionel trackside accessory collection. I placed it on a convenient chunk of 1 x 2 just to get to the height needed for the sensor ports. To the right is a pic of the sensor head mounted in the cabinet with holes drilled in the back which would be aimed across the tracks. So the whole thing is pretty unobtrusive.

Housing 3Housing 5

Here is the finished cabinet with the sensor installed, ready for layout trials. Only trouble is I need to build up another train detector board first because the two I built so far have the sensor soldered into the board! Oh well.

Housing 6

Note that going this route would be a bit pricy as the Lionel trackside kit seems to sell for up to about $30. Kind of crazy for 4 or 5 simple little plastic doodads that don't do anything except sit on the layout, but hey. One idea I am exploring is getting a 3D printer file together for something similar to this. I have a sketch made up that will fit these sensor heads really well, and it is higher so you don't need the wooden block under it. That would allow one to print up half a dozen or however many you need pretty inexpensively.

Research continues.

Rod

Attachments

Images (3)
  • Housing 3
  • Housing 5
  • Housing 6
Last edited by Rod Stewart

So I tried the sensor on the layout today with great results. I put it in place of a 153IR which had been giving some problems. And it works great. It is 100% compatible with the other 153IR at the other end of two road crossings. Its range is good; it easily covers two adjacent tracks. No false triggering during my testing. And best of all it triggers reliably with tanks cars; something that most IR sensors have trouble with. I parked a couple of them in front of the sensor just to make sure it was solid. Worked really well. Here is a pic:

HC-SR04 In Housing on Layout.

Note this is just a test setup so the control board is plopped on the table right in front of the sensor cabinet, in the foreground. A permanent installation would have the control board sitting below the table with the sensor tethered to it. All good. Now I have to figure out something to use to house a few more of these guys.

Rod

Attachments

Images (1)
  • HC-SR04 In Housing on Layout.

I got a question I got a couple kits from John and finally got around to putting one together. And it didn’t seam to work very well then I noticed I had 7VDC coming out of the voltage regulator 😳

I need To go back through it and make sure I didn’t screw something else up but I’d bet that the sensor is dead now.

so to the point what voltage are you guy feeding these things? 14VAC? 8VAC? I wouldn’t had thought it to make much difference but just wanted to check

It appears there are 2 versions of the PCB out there.  I know there was some discussion about modifications to the initial PCB design IF another batch was ordered.   I guess they were ordered?

hc-sr04 versions

I see the 7805 voltage regulator (circled red) faces oppositely.  The left photo looks to be PCB Rev 1.0 (circled yellow); the right photo Rev 1.1?

If you're having a problem with the voltage regulator, can you confirm the 7805 orientation matches the version.

Attachments

Images (1)
  • hc-sr04 versions
@zhubl posted:

I got a question I got a couple kits from John and finally got around to putting one together. And it didn’t seam to work very well then I noticed I had 7VDC coming out of the voltage regulator 😳

I need To go back through it and make sure I didn’t screw something else up but I’d bet that the sensor is dead now.

so to the point what voltage are you guy feeding these things? 14VAC? 8VAC? I wouldn’t had thought it to make much difference but just wanted to check

Zachariah, the voltage on pin 3 of the 7805 should be pretty much 5 vdc, spot on. Your board should have the 7805 oriented as shown in Stan's pic above of 3/11, with the tab facing inwards and the inscription outwards. Grj revised this orientation on later boards to that shown in the 4/27 view. But I believe all original kits of grj's are as per 3/11. Grj will maybe confirm this.

Rod

@Rod Stewart posted:

Zachariah, the voltage on pin 3 of the 7805 should be pretty much 5 vdc, spot on. Your board should have the 7805 oriented as shown in Stan's pic above of 3/11, with the tab facing inwards and the inscription outwards. Grj revised this orientation on later boards to that shown in the 4/27 view. But I believe all original kits of grj's are as per 3/11. Grj will maybe confirm this.

Rod

Correct, the first spin of the boards were the top picture.  I did a second one that I didn't buy any boards from.

@zhubl posted:

I did confirm I have V1.0 and put the voltage regulator in backwards (that’ll show me to just slap a board together without tripping checking) anywho I still think I fried the HC-SR04 so I need to swap that out with the other one I got.

Sorry about that Zachariah, I really should have made that clearer, I was trying to accommodate both the switching power supply module and the regulator, and I did a poor job of documenting it.

Sorry about that Zachariah, I really should have made that clearer, I was trying to accommodate both the switching power supply module and the regulator, and I did a poor job of documenting it.

And to think you were a "professional"

No worries John I'm thinking that only the sensor module it's self was damaged but I'll find out soon enough



@Rod Stewart posted:

Ouch! Do you plan to flip the Vreg and see if bychance it works ok? You may have cooked the 5555 and the 74HC123 in the process, hard to say. But you have nothing to lose in trying it out.

Rod

I did do that but no cigar yet like I said above I'm betting then senor module is the only thing damaged as it's probably the only thing with a strict 5V rating. Not too worried about the 555 it should be fine the 74HC123 could be but we'll see I would imagine it should be fine but I'll double check the data sheet for the ratings.

More progress with HC-SR04 sensors to report. The pix below show my second installation on the layout. Working great.

Completed Instalation #2.0Completed Installation #2.1

With the help of formumite Gary Glozer we made a file to 3D print the upper cabinet, which houses the actual sensor. The sensor looks out the backside across the adjacent track.

I also made up a 3D print file for the base which houses the actual circuit board. This keeps all the wiring hookup above the bench for ease of access. The circuit board is made from a kit available from grj based on Stan2004's original circuit, as discussed earlier in this topic. The two sets of stairs were also printed up from .stl files found on the forum in the 3D printing repository category, and modified.

This sensor and it's mate replace two 153IR's which had been in use since about 2005 or so. One had become quite undependable.

Rod

Attachments

Images (2)
  • Completed Instalation #2.0
  • Completed Installation #2.1
@sjbuff posted:

Rod the sensor housing looks fantastic! You did a fine job. Glad the sensor is working to your expectations. I’ve recently used the HCSR04 as a gate crossing sensor. I’ll post some video once done editing video.

Thanks Ron; it's been a really gratifying project. The sensors work great and you deserve big kudos for bringing this technology to our attention. Sorry if I kind of hijacked the topic a little, but the project really developed a life of its own! Any future installs on my layout will be using these sensors as a standard, and I will be switching some older IR sensors over as time and initiative permits.

For anyone who wants to print their own cabinets and/or pcb bases like those pictured, I can make the .stl files available, just shoot me an email.

Rod

Since it seems that most practical applications of this unit would have the board at a remote location with a wire between the sensor and the board, it made sense to see if it could be smaller.  Here's a 1.5" x 2.0" version, it has the same components and functionality of the earlier 2" x 3" board, just in half the space.  This would likely facilitate putting it in trackside cabinets easier than the larger board.  I did sacrifice the high current relay and just used the 3 amp relay, more than sufficient for signals.

   

Attachments

Images (2)
  • mceclip1
  • mceclip2

I would like to get my hands on some on the HCSR04 3D cabinets, those are really cool. Like Gunner I don’t have a 3D printer either. I’d gladly pay a $$ for a few cabinets for future projects.
I’m glad this sensor grew legs of its own. I stumbled on this sensor our out of luck.
Having an outdoor layout, the go to sensors just did not perform satisfactory.
Kudos to all who taken this sensor to new endeavors. Hats off to all.

Last edited by sjbuff

OK, I hated to sacrifice the 10A relay, so I shuffled the parts and got it all to fit in the 1.5" x 2.0" board with the high current relay.   I did have to sacrifice the mounting holes, but since the backside has no components, double-sided foam tape works well.

1. Yeah, easy for me to say, but can you confirm (again) that you can't put the HK4100F 3A relay overlayed on the G5LE 10A relay in some fashion that you can install either on the same PCB rev?  I'm physically holding both parts and looking at the first PCB rev and it sure seems like something could be done to allow either part to be installed without changing the size of the PCB.

2. If you are rev'ing the PCB, any chance you could spin all ICs so that pin 1, the square-pad, is in the same corner?  Nit-picking to be sure.

3. Could you drop some holes/vias on the trimpots to allow insertion of the common/inexpensive 3362P style trimpot?

4. Separate to item 1, I thought part of the reason you went to the switcher 5V regulator was because the G5LE relay used double the coil power as the HK4100F.  In your last post with the 10A relay it appears the 7805 is still there?  I don't have the switcher part in hand but I suspect it might be physically larger than the 7805 and the regulator chip looks awfully close to the G5LE.

5. I realize there appears to be NO "pin 1" square-pad on the interconnect to the ultrasonic module, but any ideas on how to silkscreen something to reduce chance of hooking up backwards for the case where a 4-wire cable connects the PCB to the sensor module?  That is, if the PCB and sensor module are separate, the PCB might be mounted "upside down" under the layout and hence be backwards requiring additional attention to detail. The module seems to use silkscreen lettering (Vcc Trig Echo Gnd).  Alas, I have no constructive suggestions.

Last edited by stan2004

Add Reply

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