i replaced the room light with an incandescent bulb and the paired-detectors and algorithm seems to properly detect a train entering a block when the train starts crossing the detectors and clears the block being left once the end of the train passes the detectors.
this seems to confirm what I said earlier about the spectrum of a incandescent and LED (and CFL) bulb. It also convinces me that block detection can be done fairly reliably (not bullet-proof) inexpensively with a pair of IR photo-transistors, resistors and software.
the software uses a state machine to determine when a block is being entered and existed. A table entry identifies the pair of detectors, tracks the paired-detector state and the two adjacent blocks.
a separate table identifies the signals affected by a block being occupied. No logic is changed to add additional paired detectors and blocks.
i'm still interested in using an IR emitter embeded in the track and recognizing a car when the detector senses the IR reflection off the bottom of a car (instead of light being blocked). I'll replace the incandescent room lamp to minimize interference.
And still thinking about Randy's suggestion for auto-adjusting the detection threshold (using analog inputs).
greg - Philadelphia & Reading / Reading
7j43k I am using MSS for signaling. It uses a straightforward and simple method of block detection. It works in either direction. It uses IR optical detectors at each block boundary and a current sensor for each block. There are no latching relays, or the like. At least, I surely don't see any. And I'm using it. Resistors on wheelsets are not needed. Assuming an empty block: When a train enters a block, the train will trigger an optical sensor. As long as the train covers the sensor, it will say "occupied". As soon as a locomotive enters the block (right away, in the current description), the current sensor will say "occupied". This is especially useful if you are running a short train, like a gas-electric. Or even a light loco. When the train leaves the block, the train will trigger an optical sensor. As long as the train covers the sensor, it will say "occupied". Thus any part of a train is always sensed when in a block. And when no part of a train is in the block, it is clear. Ed
I am using MSS for signaling.
It uses a straightforward and simple method of block detection. It works in either direction.
It uses IR optical detectors at each block boundary and a current sensor for each block. There are no latching relays, or the like. At least, I surely don't see any. And I'm using it.
Resistors on wheelsets are not needed.
Assuming an empty block:
When a train enters a block, the train will trigger an optical sensor. As long as the train covers the sensor, it will say "occupied".
As soon as a locomotive enters the block (right away, in the current description), the current sensor will say "occupied". This is especially useful if you are running a short train, like a gas-electric. Or even a light loco.
When the train leaves the block, the train will trigger an optical sensor. As long as the train covers the sensor, it will say "occupied".
Thus any part of a train is always sensed when in a block. And when no part of a train is in the block, it is clear.
Ed
Digi-Key 754-1600-ND EMITTER IR 940NM 50MA RADIAL $3.12 per 10
DC Forward Current 50 mA Peak Forward Current 1.2 A Electrostatic Discharge (1/100 Duty Cycle, 10μs Pulse Width.)
Now I use a ½ Sine wave of 100 ma, 4 ms on and 12 ms off. (Now shine this 940NM beam on a 1/16 inch dia. hole above the face of a PHOTOTRAN 160-1030-ND, that is 3 to 6 feet away! ) Sensitivity 56K, then amps = 1 v / 56000 = .000 018 amps to the resistor, is an approximate turn on point.
My reflective target is a round black tank car in HO scale. The red led appears to be on, (60 pulses per second), when this car is present.
Want more try: 200 ma Pulses , 1 ms on and 15 ms off. Keep going to 38KHZ Pulses and use a 100 ma on and no more problem?
Digi-Key Part Number TSOP4138-ND $6.40 per 5
Manufacturer Part Number TSOP4138
Description PH.MODULE 38KHZ S.VIEW
Bob Frey
Website: http://bobfrey.auclair.com
I have installed this as my between-the-rails optical detector:
http://www.iascaled.com/store/ModelRailroad/CKT-IRSENSE
It has been 100% reliable in several Free-mo setups. I know of others who have experienced the same results.
Brunton I used IRDots (infra-red optical detectors) for my hidden staging yards on my old layout. I don't remember the specific brand, but I got them from MicroMark (they don't carry them anymore, it seems). They were easy to install, and pretty foolproof in that, once adjusted properly, they were very reliable. You might give them some consideration. They were a bit pricey, though - as I recall, about $22 each back in 2005.
I used IRDots (infra-red optical detectors) for my hidden staging yards on my old layout. I don't remember the specific brand, but I got them from MicroMark (they don't carry them anymore, it seems).
They were easy to install, and pretty foolproof in that, once adjusted properly, they were very reliable. You might give them some consideration. They were a bit pricey, though - as I recall, about $22 each back in 2005.
I'd stick with the LED lights for the room and fix the problem by using some IR emitters. At the bare minimum, modulate the emitters and detect that same modulation - the driver can be a simple 555 circuit, or a PWM output fromt he same micro that is doing the detecting. That helps out with blocking interference as interference would be either unmodulated or at 60hz if coming from a light fixture, so long as your IR modulation frequency is not harmonic of 60Hz.
I still like the addition of auto calibration. I need to fool around with code for doing that.
--Randy
Modeling the Reading Railroad in the 1950's
Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.
They were designed to mount under the table, with the source and sensor side by side, sticking up through a slotted hole between the ties. When rolling stock passes over the detector, the IR beam is reflected back to the sensor, triggering the indicator. There was a small, adjustable delay in the reset (half a second or so works great) so that the indicator wouldn't flicker between cars.
The only issue I had was a false occupied indication after I put the first sheet of foam down for scenery above the staging yards. The foam was about six inches above the tracks, and it reflected enough of the beam back that the sensor could see it! Easy fix - I glued a small square of sandpaper to the bottom of the foam above each detector. The sand scattered the beam so there was no reflection back to the sensor. Never had any other problem.
I'd provide manufacturer info and such, but the detectors are 650 miles away for the next few months.
Mark P.
Website: http://www.thecbandqinwyoming.comVideos: https://www.youtube.com/user/mabrunton
while i've been successful developing Arduino SW to determine which block a train is leaving and which is entered, i've found that my infrared detectors don't work very well and I have to illuminate them with a desk lamp.
i'm considering adding a track mounted infrared emitter, idealy only one between the pair of detectors, but don't think the angles would work very well. Obviously, pairing each photo transistor with an emitter should (?) work (albeit with Robert's comments)(maybe some self-calibrating since I'm using analog inputs).
however, since i use an LED ceiling light in my train room and i wonder if the 980 nm detectors would work better if I put back the incandescent bulb. The graphic below illustrates that incandescent bulb output much more infrared than visible light and I don't believe white light LEDs emit much infrared at all.
using white light LEDs in train rooms would also minimize interference with pair infrared emitter/detectors that Robert uses.
btw, i found Ed's mention of the MSS system very interesting
Hi Greg,
Yes, I have problems with room light with the incondesdent lights or day light. ( They also work in the 940 IR range.)
The EMITTER IR 940NM 50MA RADIAL is rated for 50 ma. Max. I now push it to 100 ma, using ½ a sine wave of 6.3 volts ac rated transformer, and using a RES 75 OHM 1/2W This produces very strong 940 IR pulses. The senility resistors on the TRANS NPN DARL is greatly reduced, which really helps eliminate this problem. The covering and a small 1/16” dia hole near the PHOTOTRAN face, also helps. Your IR beam must reflect at the proper angle, to enter the 1/16” dia. hole.
My file; IR for G gage
https://1drv.ms/b/s!AojWr5mOt5h3sC1ktJEAXEW8R5UF
gregc RR_Mel Optical occupancy detection isn’t an easy task! It requires a lot of patience for perfect operation. Design and installation is time consuming but once installed it works flawlessly. What makes it difficult?
RR_Mel Optical occupancy detection isn’t an easy task! It requires a lot of patience for perfect operation. Design and installation is time consuming but once installed it works flawlessly.
What makes it difficult?
RR_MelOptical occupancy detection isn’t an easy task! It requires a lot of patience for perfect operation. Design and installation is time consuming but once installed it works flawlessly.
I bought some photo transistors and was disappointed that they didn't source enough current to work with an Aduino input with a (~10k) pullup. I eventually realized that the photo transistor i bought were most sensitive to IR at 980 nm. The range of visible light is 400-700 nm. The photo transistors were about 75% sensitive at 700 nm and 50% at 600. Not a huge difference.
I found that a 470k pull-up seemed to work ok. But because of Randy's suggestion for auto-cal of the detectors (eager to hear more) I used the analog inputs and found a threshold of 600 to work ok.
I also found the thread discussing Robert Frey's detector circuit from MR october 2009 (http://cs.trains.com/mrr/f/744/t/160848.aspx). I also tried adding a transistor to the photo detector but feel the larger value pullup is all you need.
while current sense and resistor wheels may be the most reliable, it seems to require more effort and more expensive circuits. While I've built current sense detectors, I think multiple photo detectors and the right software may be simpler. And keeping things simple is important to me.
still interested in comments re: pitfalls
thanks
Route of LION has working block detectors. Him uses reed switches in the gauge and magnets on the train, but whatever.
Relays of LION are in the RELAY ROOM:
You can see that the relays are in pears. : )
Trip relay 1 and it is latched by the little realy on No. 2.
Trip Relay 2 and little relay 2 unlatches relay 1. Little relay 3 holds relay 2.
Simple so far, yes?
Signal 1 shows a RED indication when relay 1 is tripped.
Signal 1 shows a YELLOW indication because relay one is open but relay 2 is tripped.
Signal 1 shows a GREEN indication when both blocks 1 and 2 are clear.
So you can see why I put all of these relays in one place.
There is of course a third realy for each block, but that is located on the wayside. It controls power to the PREVIOUS BLOCK, shutting it down when Block 1 in this case is red.
There are five conductors to each block from the relay room.
1. TRIP signal from the reed switch
2. Display RED Signal
3. Display YELLOW signal
4. Display GREEN signal
5. Closes Track Relay 0 WHEN TIME CLOCK ALLOWS.
The time clock has six (6) ten second intervals, and one of these is assigned to each station. The signal must be NOT RED, and the time clock must inticate GO for a train to leave the station.
Railroad of LION can run ten subway trains at once with no living motorman on any train. Layout must have LIVE LION in the 242nd Street tower to keep running, otherwise trains will just run into red signals and the whole thing will come to a stop. Well almost, express trains are on a loop and never come into 242nd street, they will keep on running forever.
ROAR
The Route of the Broadway Lion The Largest Subway Layout in North Dakota.
Here there be cats. LIONS with CAMERAS
rrinkerAs long as you are using an emitter/detector pair, between a properly modulated source (and detecting that modulation, not just the level of light falling on the sensor), you can have the thing self-calibrate on each power up
can you explain this more? I'm assuming a photo-transistor/diode pulling down a voltage on a digital input.
I recall we had this discussion a while back,. SOmeone came up with a circuit that does the latching check, I think it had 3 sensors - block entrance, middle of block, and block exit. That way it could handle a train starting to enter a block but then reversing back out instead of continuing through - which given the relatively short distances on a model railroad would be a very common occurence.
Frankly I still feel that if you want to know that there is a train or rolling stock SOMEWHERE in a block, current sense with resistor wheelsets is by far the simplest and nmost reliable option. If you want to know when a train is at a certain spot - like a grade crossing, or past the clearance point to automatically operate a reverse loop, then optical detection is the best option. Some of the downsides of optical detection can be overcome with some clever programming - like the changing light levels on the layout. As long as you are using an emitter/detector pair, between a properly modulated source (and detecting that modulation, not just the level of light falling on the sensor), you can have the thing self-calibrate on each power up (or periodically - so if you run a daytime into night time session, the sensors can adjust as needed) where the controller can adjust the detection threshold so that it should work for all but the most extreme case of someone beaming an IR emitter right into the sensor (replaces the old "drop a coin on th tracks back in the corner" prank). Since I'm planning on making my own grade crossing controllers along with all the other stuff, I plan to incorporate code like this in mine, to automatically calibrate.
I'm looking at optical occupancy detectors. The detectors would be in the track using room lighting and located near the ends of the blocks. Doing it this way means the detector is no longer active after the train crosses over it. A similar problem occurs with electrical detectors without cars that draw current.
one approach to handling this is to recognize that the block has been entered and latch it's state, occupied, until either detector is crossed again and clearing the block.
Knowing direction would disambiguate whether a train is entering or backing out of a block. Monitoring the timing as a train crosses a pair of detectors can determine direction. This may not require any extra detectors if there is one on each of the three legs of a turnout. Direction can similarly be determined using electrical detectors.
assume these issues aren't novel. Would appreciate comments