Skip to main content

Well then you've probably seen the QSI pendulum sensor method used to trigger sounds in livestock cars.

Untitled

What I thought clever was the conductive pendulum banged up against a (large) plated-thru hole on the circuit board!  One would have to mess with it, but it seems to me that the pendulum might swing left-to-right a bit when turning.  And by making multiple independent sectors of plating on the detection hole that you could get separate on/off outputs to distinguish straight front-back motion from turning left-right motion.  The pendulum at minimum solves the problem that when stopped on a curve it would not make contact.

QSI_Halloween2

Attachments

Images (2)
  • Untitled
  • QSI_Halloween2
Last edited by stan2004

That's the exact mechanism I was visualizing Stan.  I didn't know about this car, but I used to fix pinball machines when I was in high school at the local game company.  I like the idea of segments around the large plated -thru hole, simple and effective.  Of course, the issue of stopping on a curve is easily dealt with in software as well if using the accelerometer.  I do wonder about the sensitivity of the accelerometer, that's certainly a wild card.  However, the ones used in phones apparently have very good sensitivity.

stan2004 posted:

Your first link just takes me back to this thread.  But your 2nd link allowed me to preview the 1st four pages of the article - after that it solicited a subscription order.  But it did show enough.  So if you use a visible light photoresistor, then you can use the room's ambient lighting as the light source.   You place the detector in the track bed and when the train passes over it blocks the room light and the this triggers (turns "on") the detector(s).  So measuring the order of triggering and time interval between triggering you get direction and speed.

Of course it's the Arduino module that's doing the heavy lifting in this case...particularly in "doing the math" to convert time intervals into scale-speed and then to display it in "English" with a multi-line alphanumeric panel.

I fixed the link above, thanks for telling me. That was obviously my error.  I think I have a N&V cookie or something, because the N&V website just logs me on automatically, like the forum here. If you got the 4 pages there was only one more paragraph to the article, you didn't miss anything.

I followed the article for my first attempt, as you describe. That was un-reliable. I have fiddled with it since. Since I have 3 rail, I had to offset the photoresistor (slightly to the right of center rail) in the track and I think that may be one of my problems. I set up a monitor from the Arduino and I think light is getting to the photo resistor between the cars and fluctuating the readings. I am going to slightly angle the IR sensors for the next try.

Also I am not sure about the speed calculation used (I got a couple of different formulas from a Google search?). I am getting mixed results there as well, but it might be due to the photo resistors? I used a bit more space between the sensors too, not sure if that is a problem or not? Going to do some more fiddling here in a little while, have to change a few things.

gunrunnerjohn posted:

Of course, the issue of stopping on a curve is easily dealt with in software as well if using the accelerometer.  I do wonder about the sensitivity of the accelerometer, that's certainly a wild card.  However, the ones used in phones apparently have very good sensitivity.

Easily is often mixed up with imagining.    Anyway for a simple back-of-envelope, consider that 1 MPH is 1.47 ft/sec or only 0.031 O-scale ft/sec.  So a train going, say 20 sMPH is traveling about 0.6 ft/sec.  Let's say we're going around a tight curve that turns us a full 90 degrees.  And we make that full 90 degree turn in only 5 seconds (tight turn).   If we happened to be traveling in, say, the x-axis when entering the curve then the x accelerometer output will show deceleration while the y-axis will show acceleration.  It's transcendental but let's assume an algebraic linear change in velocity of 0,6 ft/sec in 5 sec or 0.12 ft/sec/sec.  1 g is 32 ft/sec/sec so the acceleration/deceleration magnitude would be about 0.004 g while in the turn.  If the accelerometer puts out 300 mV/g, that's a voltage change of about 1 mV.  Imagine that!  

Edit: upon reflection it's even worse than that.  I was imagining a gimbaled inertial sensor but of course the module would most likely be fastened to the chassis of the car so the forward axis never changes and you don't get the 2-degrees of freedom as with a pendulum.

Last edited by stan2004
rtr12 posted:
I followed the article for my first attempt, as you describe. That was un-reliable. I have fiddled with it since. Since I have 3 rail, I had to offset the photoresistor (slightly to the right of center rail) in the track and I think that may be one of my problems. I set up a monitor from the Arduino and I think light is getting to the photo resistor between the cars and fluctuating the readings. I am going to slightly angle the IR sensors for the next try.

Also I am not sure about the speed calculation used (I got a couple of different formulas from a Google search?). I am getting mixed results there as well, but it might be due to the photo resistors? I used a bit more space between the sensors too, not sure if that is a problem or not? Going to do some more fiddling here in a little while, have to change a few things.

As the article describes there is some fussing to select the trip point when the light source is from ambient.  But assuming that's solved it seems the trick is to implement timing logic where the system resets to an idle-and-ready-to-go state when the sensors have been idle for some number of seconds.  Then when 1 or 2 trips, you perform just ONE computation, display the result, then wait again for both sensors to go idle.  The idea here is the off-to-on transition varies in that car-to-car gap so just use the leading edge of the consist (i.e., the engine) as the only source of triggering. 

As for doing the math, I'd think a useful speedometer should resolve 1 sMPH up to a top speed of, say, 100 sMPH.   I'd also think to keep things simple you shouldn't space the 2 sensors more than the length of your shortest engine.  This way the car-to-car gap, steam engine-tender gap, etc. won't cause multiple/confusing tripping of the sensors.  Let's just make this 4 inches for example.  1 sMPH is 0.367 inches per sec...or ~11 sec to trip both sensors.  100 sMPH is 36.7 ips....or ~0.11 sec to trip both sensors.  Those numbers look good because as the article points out you get timing with millisecond resolution for "free" (without more intricate coding).  So you can resolve or differentiate between, say, 0.110 sec and 0.111 sec. (i.e., 110 milliseconds vs. 111 milliseconds).  Those time intervals correspond to speeds (distance/time) of: 4 inches / 0.079 sec / 0.367 ips/sMPH = 99 sMPH and 98 sMPH so you have your 1 sMPH resolution (arbitrary minimum standard).  I don't know if you were trying to simply replicate exactly what the author did or whether you were trying to modify it to your specific application.  But I'd say this simple back-of-the-envelope calculation suggests the fundamentals are indeed in place which I suppose goes without saying since the article was written in the first place...

There was an included calculation program for all the fussing with the photo resistor settings. I seemed to have gotten good results with that one? Just didn't work nearly as well when using an actual running train.

I need to further study your post, but I am suspecting I have allocated too much distance for my speed calculations. I was fiddling with long trains and was thinking a longer distance would be more accurate. Your suggestion of 4 inches has got me re-thinking this one, maybe shorter is better? Back when I started fiddling with this, I did notice the distance used in the article appeared to be much smaller than what I used.

As a side question, do the alternate photo transistors mentioned in the article work better than the photo resistors for something like this? I think I may have some, but have never tried using them for anything.

rtr12 posted:

As a side question, do the alternate photo transistors mentioned in the article work better than the photo resistors for something like this? I think I may have some, but have never tried using them for anything.

Well, I looked up the two suggested parts on the All Electronics site and they give scant technical information wrt what's needed if designing something for production.  They aren't even sure the photo transistor is what they say...calling it "possibly" a phototransistor.  Really?!    OK, this is a one-off hobby project and I'll cut them some slack.

Anyway, IMO you'd get by timing resolution with a phototransistor simply because it has a smaller aperture (window).  The photoresistor is 0.25" wide while the phototransistor is only 0.05" wide.  There are additional geeky comparisons if you get under-the-hood in that CdS photoresistors use a technology inherently slower than the semiconductor junction in a phototransistor.  For the kind of timing you're interested in it probably doesn't make a difference.  Personally I'd prefer the semiconductor solution but that's just me.  If going with a phototransistor you might not get good results with an IR (invisible) phototransistor as used in the ITAD sensor of this thread - unless you have a reasonably strong source of ambient IR spraying from your ceiling.

GRJ, I am going to shorten things up and see what happens. That my be part of the problem or the problem.  

Stan, I agree on the All Electronics stuff. I looked at that a few months ago, they have no data sheets or means to identify their components that I could find? If they don't know what it is, I don't either?

I also like the idea of the photo transistors. I was wondering if those might be a better choice and you have now confirmed that. I will look at some data sheets. I got my photo resistor setup dismantled today, ready for more fiddling and fussing.

No, it really was an honest question (I don't know enough about all this stuff to ask a trick question). I was just going with you an GRJ's 'imagining' things earlier (an attempt to carry on the humor). The Digi-Key links work ok here, just tried them? I am not sure what's wrong? The text of the links are valid D-K part numbers that I was looking up earlier today trying to find a suitable phototransistor. 

I wasn't sure about the photo transistors I have and I need to order a thing or two from D-K anyway, so I was going to get some new ones to try. The IR boards seem to work on the bench (breadboard), but these photo transistors are so much smaller.

I wonder if he meant CTT above? Don't remember reading about IR detectors there, but I will check? Memory ain't what it used to be.

1. IMO the easiest packaging type to work with for burying in 3-rail trackbed is the 3mm radial thru-hole style.  I don't know if it was happenstance or what but you chose 3 different package types.  The nice thing about 3mm style shown at left is you can simply drill a 3mm (or so) hole and press the LED thru it to get a snug fit..

SFH 310-2^3_sml

2. The article's method assumes an overhead lights source.  It doesn't work in the dark.  So you need a detector that responds to whatever light source you're using.  It gets a bit nerdy with how semiconductor junctions respond to different "colors" of light but let's just say the CdS photoresistor gets a leg up in that category wrt to responding to visible light.  In other words you need a phototransistor that was designed to respond to visible light energy rather than infrared (IR) energy.  That's where wavelength comes in.  So here we have the electro-magnetic spectrum:

24756049-The-spectrum-of-waves-includes-infrared-rays-visible-light-ultraviolet-rays-and-X-rays-Human-eyes-ar-Stock-Vector

One of your phototransistors was out at 940nm wavelength which is in the IR region.  Of course you could always spray your room with IR light using those IR LED illuminators used in surveillance cameras.  And, yes, incandescent, fluorescent, sunlight have varying levels of IR but then you start playing games though that could be part of the fun experimenting.  It appears DigiKey uses "ambient" to describe phototransistors sensitive to the visible light range.  Here's a 3mm version that peaks at 630nm which is well within the visible range around Orange.

http://www.digikey.com/product...1080-1019-ND/2675510

The ambient type seem a bit more expensive than IR phototransistors.

3. Re-visiting the concept of using "ambient" light to trip the 2 detectors.  I know there are several vendors selling such systems for triggering crossing gates and such using only ambient light (don't work in the dark).  OTOH, note the Lionel pedestrian walkover that displays speed uses (invisible) IR beams.  Obviously it requires above-ground placement of the emitters-detectors but considering that IR LEDs cost maybe 10 cents, I think it makes for a more robust design (works in the dark).  The Arduino code would be virtually identical...and you'd probably only need digital inputs (rather than analog A/D inputs) as the detectors could be made on-off with arguably less fussing with calibrating/adjusting trip-thresholds with changing room lighting.

6-14082_83

Attachments

Images (3)
  • SFH 310-2^3_sml
  • 24756049-The-spectrum-of-waves-includes-infrared-rays-visible-light-ultraviolet-rays-and-X-rays-Human-eyes-ar-Stock-Vector
  • 6-14082_83

I am stumped by the links? The one's in Stan's quote even work here? I used the 'Add/Edit Link from the Reply tool bar to enter the links and don't recall having this problem before? Just out of curiosity, does this one work any better?

http://www.digikey.com/scripts...q=635876060894155844

or how about this one?

475-1443-ND 

Thanks, Stan.

Yes, I did pick 3 different types (all wrong?) as I wasn't sure which would be best? The middle one looked kind of neat, but I would have probably broken off the pins trying to bend them to fit through the track and table top.

I do like the idea of the 3mm hole. That is how I installed the photo resistors, but I believe the hole was a bit larger. From your earlier post I was trying to stay away from the IR sensors as there is none in the ceiling here (that I know of anyway), all I have is 4' fluorescent lights (5000k) in the train room, lots of light. Until I got my eyes fixed last summer (cataracts), I needed every bit of that light just to find the layout.  

The information you provided explains a lot (just what I was 'imagining' ). I will add some of the items you linked to my D-K order. I also like the idea of digital inputs (as opposed to analog), as you say it takes away the fiddling and fussing.

I knew nothing about the specifics between the different types of light as in your chart above. I wasn't kidding about not being able to ask a trick question. The phototransistors I have may be IR sensors and I found some more similar to the item on the right in your picture, but they have 3 leads and I can't ID them (I think they were from a mystery parts bag I got one time, before I figured out you need data sheets on this stuff?).

Also, I have seen that Lionel pedestrian bridge, but had no idea they offered a speed calculating option with them. That's a neat option. I have not seen one in person, just catalogs and layout pictures posted here.

Last edited by rtr12

No, both of your latest links are converted to the following (*s inserted so as not to convert to a link) which then appears as a Page Not Found error on the digikey site.  Nowhere in this do I see the typical digikey xxx-yyyy-ND part number like in the link I provided earlier.

****/scripts/DkSearch/dksus.dll?Detail&itemSeq=186985525&uq=635876060894155844

It's probably some kind of browser or cookie thing or whatever which is a just a distraction. 

Think of a typical transistors as having input, output, and on/off signals - 3 total.  In a phototransistor impinging light acts as the on/off signal so you only need 2 electrical connections.   You occasionally find 3-pin phototransistors where they added an electrical on/off signal which can be used in conjunction with the photosensitive on/off signal; in simple terms it allows you to adjust the threshold or trip-point.  For what you're doing ignore it and don't hook it up if you're experimenting with what you have; of course you still need to know which pin to ignore if you're playing with a grab-bag mystery part.

Also, if you start experimenting you'll find a curious behavior with the CdS photoresistors vs. phototransistors if you hook up a meter.  The phototransistors will respond instantly jumping to the "new" voltage/resistance.  A photoresistor might take several updates of your meter to reach its final "new" reading.  In general a photoresistor takes longer to settle its new value when going from light to dark than dark to light.  This slow behavior as well as the asymmetrical response time can be problematic if using photoresistors to make "high" resolution timing measurements.  Note that photoresistors are most commonly associated with nite-lights to simply detect day or night and a response time of seconds or even minutes is no big deal and perhaps preferable.

Last edited by stan2004

GRJ, that is exactly how I entered the links, except my URL's are showing up differently in the browser? Your link displays a totally different URL than the ones I am getting when accessing DK directly? I have not had this problem before, not sure what is wrong now? I will do some checking.

Stan, thanks for the added information. I am going to take all this over to the bench for experimenting. I ordered some of the ones you linked and also some 5mm ones from the same line and specs. Gonna try the 3mm first, but I think the holes I have may be a little large for those. Maybe I will just patch them up? Either way I'm covered and extra parts are always good.

I found Bob Walker's articles (it was CTT) and he is using a Sharp Proximity sensor, but for slightly different projects. I remembered the articles after looking them up. That is also an interesting item, looks pretty neat too, but it's also pretty large and probably not something that will fit between the rails. Bob's projects were triggering things at different distances as a train approached

I will try another link, this time to Sparkfun: Infrared Proximity Sensor - Sharp GP2Y0A21YK

I think I may have just solved the broken D-K links. I was accessing those parts from my shopping cart. When I access the number separately from a search they give a different URL with the DK part number in it, as in what you and Stan posted.

I think the link you just posted above was done like mine as it doesn't work for me (and probably not Stan either), but I bet it works just fine for you.  I will take a look at those parts in your link too, using the part number search.

I just confirmed the D-K problem, accessing a part from your cart gives an invalid link for every one but the cart owner. Just added your item above to my next order (for experimental purposes, of course) and got these results.

Last edited by rtr12

I just learned something else, Digi-Key can't ship batteries using the USPS, not even the little button ones. I ordered some Eveready CR2032's (Really cheap there, like 30 some cents each). The called me and said they couldn't ship them USPS. I asked how they could be shipped, they said UPS or FedEx. I asked how much more it would be, $11.xx instead of $2.xx. I cancelled the 10 batteries ($3.01) and it is now coming via USPS once again. Sure glad they called, that was good service! 

Yes really they are top shelf, excellent service, FAST and very reasonable shipping...and I have you to thank for the tip to order from them.  

It was only about a $20 order. Had it been quite a bit more I may have gone with the extra shipping and gotten the batteries? I think shipping has really gone up in the last year or so, even though fuel prices are at extremely low levels now. I think gas was $1.69 a week or so ago when I last filled up my car.

OTOH, I recently got some stuff from another place and they had free FedEx 2 day shipping on any order over $49. Actually this place has had that same shipping policy for a few years now. Their pricing seems reasonable too, at least to me anyway?

 

Last edited by rtr12

Add Reply

Post

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

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