Skip to main content

Hi Stan,

Wow, I looked at my last post and I must have been asleep. Anyway, I played with the new relay module and the individual LEDs (not in the IR module). Again, my complete ignorance of LED sensors was displayed. I could get the new relay module to trigger on a high, but there is no way to get the LED sensor to switch between HI and LO without additional components. The new relay module however does work fine with the IR detector module in the circuit (HI & LO both available). But still, you are right. All this is nice to know, but I still need your circuit to provide the delay.

I didn't see a question so I assume you're still making progress.

 

Yes, the 25 cents or whatever of external components is an inexpensive way to provide what amounts to the logic inversion for break-the-beam activation...as well to implement time-delay.  Of course there are relay modules WITH time-delay capability but they run in the $4-5 range.  But where's the fun in that...

Hi Stan,

 

Well I finally got almost all of the components in the schematic of yours I have attached. Only thing different is the diode, which is a 1N4005. Also, I only connected a single pair emitter/sensor. I checked the emitter with my cell phone and it's on. I don't know how to check the sensor. Can I just have it disconnected, hit it with IR and measure the forward resistance to see if it drops?

 

The problem I have is that the relay is energized with or without the emitter shinning on the sensor (can't get the relay to go to the OFF state).

 

In addition, where you crossed out the PB switch, did you mean to have a connection across the terminals where the switch was (I did not do that)?

 

Individual LED IR Circuit

Attachments

Images (1)
  • Individual LED IR Circuit
Last edited by ken's trains

Stan,

I answered my question about testing the sensor. I powered the circuit with the sensor not connected and measured the forward sensor resistance, it was ~6M ohm. I then hit it with the emitter and the resistance dropped to ~ 5K ohm. I assume that means the IR emitter/sensor function is working. Plus, now that I see how much resistance there is with the sensor not conducting, I don't see how connecting them in series will work (for a 2-detector circuit). You would still have ~ 6M ohm to ground thru the non-conducting sensor instead of ~12M ohm if both were non-conducting. Shouldn't they be connected in parallel?

 

What am I missing?

Last edited by ken's trains

Refer to point "A" in the circuit.  When both phototransistor detector are "ON" (low-resistance), point A should go low - much less than 1 Volt relative to ground.

 

But if either detector beam is broken, one or both phototransistors will turn "OFF" (hi-resistance), point A then goes high - somewhere near 5V.

 

So to troubleshoot, measure the DC voltage at point A with both beams hitting their respective detectors, then with either or both beam broken.  The 10K resistor and the series-connected phototransistors forms a simple voltage divider.  Your phototransistor "ON" resistance measurement of 5K seems a bit high; obviously a 5K or 10K resistor between point A and ground does not pull down point A low enough to turn off the relay module.

 

With or without the phototransistor(s) connected you can always simply ground point A.  That should turn off the relay module (assuming it's configured active HI); if there's a capacitor connected the relay module will turn off after a time-delay proportional to the capacitance.

 

That's correct about the pushbutton switch; there is nothing connected.  And any 1N400x type diode is fine.

 

Last edited by stan2004

Stan,

 

I re-measured the sensor resistance. Off it is ~3M and On it is ~1.2K. When I turn on the circuit with the sensor disconnected (GRD removed), the relay turns ON. When I ground point A, nothing changes. Woops, I didn't wait long enough--ground point A turned off the relay. However, I measured point A to GRD with the emitter connected and not ON, it measured Vcc (4.94V). With the emitter ON, it measured 4V. So I am not getting a sufficient voltage drop with detection. Is the emitter ON resistance too high (at 1.2K ohm)? I'm lost again.

Last edited by ken's trains

If the relay is ON with point A grounded, the phototransistor is not the problem. I suspect a wiring/hookup error.  Are you set up to post a close-up photo of your circuit as wired?

 

Presumably you confirmed the powered module is off with nothing hooked up to the IN pin.  Then with just the transistor and the 10K on the base of the transistor, the relay should be still be OFF.

 

Then add the capacitor and the 1N400x diode.  Relay should still be OFF.  Then add the 10K resistor on the left, the relay should then turn off.  Then Ground point A and the voltage on the capacitor should slowly drop and eventually the relay should turn off.

 

We can get to the resistance measurements on the phototransistor later.  Different meters can give widely different results when measuring resistance of a transistor.  That is, the effective resistance of this type of transistor depends on how much current is flowing through it; different meters and different resistance ranges on the same meters use different "test currents" to inject into the measured device when measuring resistance.

 

Originally Posted by ken's trains:

Sorry Stan, I edited my last post. Please take a look.

Hmm.  Let's keep things simple.  Just hook up the "circuit" to the left of the diode.  In other words just the 10K resistor and phototransistor.  And measure point A with this voltage divider powered by +5V.  With the LED-emitter off, point A should measure near 5V as you apparently are getting.  With the LED-emitter on and pointing at the phototransistor, point A should drop to well below 1 V (presumably you're measuring 4V or so?).  

 

 

Ok, with no emitter the voltage across the sensor (to GRD) is ~5V. With the emitter it's ~4.1V. Maybe time to try a new sensor.

 

I just changed sensors and no change in results. Thought maybe I had a bad resistor, checked and it was 9.8K ohm. Don't know why the sensor resistance is not dropping to a proper level with emitter detection. I'll try a different emitter (although it's seems to be working).

I just changed emitters, verified the new one was working and tested for voltage drop. Again, with emitter ON, voltage from point A to GRD was ~4V, indicating (to me)insufficient resistance drop in sensor with detection.

Last edited by ken's trains

Stan,

Now I varied the resistance from 10K up to 46K. At 32K, the voltage across sensor was ~2V. At 46K it dropped to ~0.9V. Can I fix problem by substituting (2) 46K resistors for the (2) 10K in your circuit, or will that give me transistor problems?

Just answered my own question. Swapped 10Ks for 46Ks and it now works. But now if I have (2) sensors in the circuit, I may have another voltage drop problem--may have to go higher in resistance???

Last edited by ken's trains

What baffles me is why you're getting such a low photo-transistor "ON" current when it is illuminated by a strong IR signal.

 

So with a 10K resistor, point A drops to 4.1V with an illuminated photo-transistor.  That means the voltage drop across the 10K resistor is 0.9V.  That means the current thru the resistor and the current thru the photo-transistor is 0.9V / 10k ohms = 90 microamps = 0.09 milliamps.

 

Likewise, with your 46k resistor, point A is 0.9V so the voltage drop across the resistor is 4.1V (with an illuminated photo-transistor).  So the photo-transistor current is, again, 4.1V / 46k = 90 microamps.

 

With the 3mm eBay IR photo-transistors I have, it's easy to get AT LEAST 10 times that current when illuminated by a 3mm IR LED across the diagonal distance of an O-gauge track.  This is as shown in earlier videos and photos.

 

What you run into by increasing the 10k too high is it increases the charge time of the capacitor to turn on the relay.  The relevant calculation is the RC time-constant.  So with a 10k resistor and a 10uF capacitor, the time-constant is 10k x 10 uF = 0.1 seconds.  So the capacitor will charge up fairly quickly when the beam is broken...and the relay promptly turns on.  Increase the resistor 5x to 46k and the time-constant is now 1/2 a second which starts to make the turn-on sluggish.  I guess it will work, but I'm still baffled as to why you aren't getting only about 100 microamps of photo-transistor current when illuminated. 

 

Did you buy loose photo-transistors?  And you tried this with both those loose photo-transistors and the photo-transistor you removed from the module?  It's to the point where I'd just say to plug in the photo-transistor backwards to see what happens!

Stan, yes I did buy about 50 loose emitters and sensors from China. I am not using the IR detection module or the emitters/sensors from that module. I have tried a number of different sensors (and emitters) and no change in results. And based on sensor resistance measurements, I don't think backwards will work.

Do you have a better source for emitters & sensors?

By the way, the relay pull in is a little sluggish, but not intolerable for activating crossing accessories. But since I have a bunch of the IR detection modules, I'll look back at your posts to see how to configure them with a transistor as an driver/inverter.

Last edited by ken's trains

Ken, oh my, 50 loose emitters and sensors.  I think we need to get to the bottom of this! In no particular order, here's some comments to your points.

 

If you have "working" IR modules, you can hook up the module "OUT" to the time-delay circuit.  This was shown in my post of April 1, 2015 4:50 PM. 

 

Edit: This was put aside since it is much easier to "stack" loose photo-transistors to perform the "logic" functions AND/OR for multi-beam operation.  If we need to use the modules, there is another commonly used technique for combining modules of this type; but one step at a time.

 

If you have "working" IR modules, you should be able to get to the bottom of the photo-transistor sensitivity issue.  Again, I do not have the particular module you have but here's my suggestion.  Refer to the schematic of the eBay module:

 ogr ir point A

Note that all we're trying with the loose parts is what's shown in the pink box above.  The LED is powered by 5V via a 100 ohm resistor.  The photo-transistor is powered by 5V via a 10k ohm resistor.  From dark to illuminated does point A in the module only swing from 4.9V (dark) to 4.1V (illuminated)?  I realize you confirmed IR LED operation with your digital camera but any info on how bright you need to hit the photo-transistor to get it to drop down is useful.  Aim the photo-transistor right at an incandescent or halogen desk-lamp or flashlight for a known-good source of IR energy.

 

ogr ir module point A

Point "A" is indicated by the red X in above photo.  If you look at the module, you can see a printed-wire going from one side of the 10k resistor to pin #5 of the IC chip.  That's how I identified point "A" based on their schematic and looking up the datasheet of of the LM393 IC chip.

 

As shown in this picture, the FLAT SIDE of the LED is "-".  OTOH, the FLAT SIDE of the photo-transistor is "+".  Since you said you tried both the "loose" photo-transistors and ones removed from a working module, hopefully there was some way of keeping track of this polarity since it's different between devices...and unfortunately I've seen photo-transistors with the flat-side indicating the opposite polarity!

Attachments

Images (2)
  • ogr ir module point A
  • ogr ir point A
Last edited by stan2004

Stan, just got your message. Thank you. One point. When I said I used the LED & emitter from the IR module, all I meant was that I removed them and added extension wiring back to the module so I could place them across track.

With that cleared up, I will now try your suggestions, make some measurements, and get back to you.

By the way, if I were to use the IR modules in a 'stacked' mode for AND/OR operation, how do I deal with the (now) two IR module OUTs from the (2) LM393s?

I learned to check LEDs by viewing into it.

As stated, you cant trust the flat to be correct. Nor leg length.

I think it has to do with the intended mounting orientation specified by a big order for a production run. When off board, and in a products outer surface changing orientation could be an advantage for design/ production.

.....Or maybe, just built on early on a Monday.

 Inside you'll see two metal parts. The large side is cathode. You can hold a dark LED to light & be able to see it 99% of the time

 I've never had an issue with multi color LEDs leg I.D.

Originally Posted by ken's trains:

any further thoughts on how to stack the IR modules to use two in the same circuit?

With the mystery solved on the photo-transistors, why would you want to use the IR modules?  All you need are 2 photo-transistors and the 10k resistor to feed the single 1N400x diode.

 

But for the sake of discussion and world peace, here's how to use 2 modules with the time-delay capacitor circuit in a break-the-beam application:

 

 

Here's how it works.  It the normal situation (no trains), both beams reach their photo-transistors and both modules are "ON" which means their OUT pins are low.  So point "A1" and point "A2" are both low (near Ground).

 

ogr IR module 2x itad with delay hookup 5v

When either (or both) beams are broken by a train, the broken module output goes high.  This charges the capacitor via the 1N400x diode and the relay module turns on.  Note that the 1N400x diodes are needed to isolate each module output so that if only one module is "high", then the other module output which might be "low" does not stop the capacitor from charging.   When the both beams are restored, the capacitor slowly discharges thru the transistor buffer which effects the time-delay.

Attachments

Images (1)
  • ogr IR module 2x itad with delay hookup 5v

Stan, can't thank you enough. I have been pulling the last of my few hairs out getting the (2) detector circuit to work (that's why I was considering going with the IR Modules). When I set up your 2-detector circuit, the relay module indicated a trigger with beam break (relay module LED lit), but the relay would not pull in. After many sequential part removals, it came down to the new emitter/sensor pair. Turns out several of the sensors not only are mis-configured, but when turned ON, the resistance doesn't drop sufficiently (and yes I did connect them both ways). I thought maybe the extra components were somehow loading the transistor output. That was not the case. Problem was bad parts. JUST A WARNING FOR ANYONE BUYING BIG BAGS OF CHEAP ELECTRONICS FROM OVERSEAS--NEED TO CHECK THINGS THOROUGHLY BEFORE INSTALLING IN CIRCUIT.

Originally Posted by nvocc5:

I am new at this but would this circuit work better and  have none of the drama of the "IR Modals". Still new at this and learning quickly.

Drama. Who would have thunk!

 

"Work better" is subject to interpretation. The relay is "ON" during the normal case with no train is present.  This uses (wastes) about 1/2 Watt of power.  No, 1/2 Watt does not mean the end of the world.  And if you are using 2 beams, you can eliminate 1 external component by putting the 2 IR LED transmitters in series and using a single 68 ohm resistor (instead of 1 each 100 ohm resistor to the LEDs).

 

Independent of using the modules vs. loose components, some comments about this minimalist circuit.  I pointed these out above along the way, but this thread has gotten quite long so here's a summary.

 

-There is no "anti-chatter"** which means when the train first cuts one of the beams, there may be brief relay chatter if, for example, the railings or some other non-solid part of the train first breaks the beam.  Same issue if on exiting if, say, caboose railings are the last part of the train.  You can put a capacitor between IN and GRD to demote this effect if it's a problem.

 

-The circuit does not have time-delay to keep the flashers active if, for example, a short consist misses both beams in the middle of the crossing.  ITAD devices typically have an adjustable time-delay that can help insure the consist reaches the other ITAD which works in some cases.  You can add time-delay using a really big anti-chatter capacitor but there are issues there; hence with the addition of a transistor and a few components (25-50 cents total) you can achieve practical time-delays (5-10 seconds) using inexpensive and small capacitors.  Note that there are eBay relay modules that have time-delay capability but they cost $4-5 each and I have not tried them for compatibility with this type of IR photo-transistors.

 

**Footnote on "anti-chatter".  I may be mis-using this term but in AC O-gauge the traditional method of tripping a DC relay using isolated-rails uses a diode or bridge-rectifier to convert AC-to-DC to power a DC relay.  It is common practice to add a capacitor on the DC so the relay does not "buzz" from the converted AC signal.  The capacitor also keeps the relay from chattering from intermittent contact from dirty-wheels or outer rails.  In the case of IR-beams you don't have the pulsing AC problem since power is DC, but the intermittent beam interruptions have the same effect as, say, intermittent wheel-to-track contact in the isolated-rail method.

Stan, just wanted to show you what your non-stop wonderful help has produced. I took a couple pic's of the assembly I put together of your 2-detector circuit. I will make a few more of these and then move on to crossing flasher circuits. I may buy the AC LED light bulb replacements for the flashers and then go back to find the LED circuits you provided. Thanks again for all the help.

 

My IR Detector-1

My IR Detector-2

Attachments

Images (2)
  • My IR Detector-1
  • My IR Detector-2
Last edited by ken's trains

Hi Ken, thanks for sharing.  I like the way you organized it all using a project-perf board.

 

Hopefully those bad eBay parts hasn't discouraged you from attempting more DIY electronics projects.  I don't know if it's worth your time but I've had 100% success on eBay in getting a refund from Asia eBay sellers when parts didn't work - and never had to send anything back.

 

Waiting to hear about your animation project ideas!  With all those extra infrared components (those that work of course!), I'm thinking you can put them to work to detect end-of-travel or end-of-motion to make for a more interesting animation.  Simple continuous, constant-speed motor animations are fine, but the fun comes in with changing the speed or direction of the motor based on some kind of event or trigger.  Let the games begin!

Thanks Stan. I'll keep you posted and hopefully you will be there when I get stuck. I am currently back to layout issues. Have to cut large hole in plywood to mount turntable and then do same for Homasote top layer. Until I have a more complete idea of my layout, I will be working RR crossing applications for the detection circuits. I have many, many Lionel operating accessories and will find more applications for the circuits.

Hi Kris,

 

Great to see you're hanging in there with this DIY stuff!  Definitely not everyone's cup-of-tea but a fun part of the hobby for me anyway.  OK, the sound player I showed earlier was hooked up as follows.

 

ogr sound module using mp3 cube

 It's critical to carefully think through what's going on here.  Specifically, when the crossing circuit turns on you now have 5V DC available.  You want a sound module that starts playing when 5V DC is applied to it...and stops playing when 5V DC is removed.  The "problem" with this cube player is it has an internal rechargeable battery.  So while you could mechanically toggle the on/off switch to play/stop the sound, that's not what's available from the crossing circuit!

 

So what I did was remove the battery and place the on/off switch in the ON position.  5V DC is applied through the mini-USB connector.  A cable is supplied but I just soldered in a red and black wire as shown.  Since there's no battery, the module now turns on and off when 5V DC is applied.

 

Be absolutely sure that you don't apply more than 5V DC to the circuit!

 

OK, having said that.  Here's my next audio project though I barely started. I found MP3 players for about $1 on eBay.  No internal speaker, no FM radio, no fancy digital display, but it's an absolutely insane price and the thing actually works!  Again, the MP3 file(s) are from a micro-SD card.

 

(Edit: ebay link changed):

 

http://www.ebay.com/itm/331414...414418636%26_rdc%3D1

 

 

ogr stereo sound hack

It's incredibly small and has a rechargeable battery inside it charged via a mini-USB connector.  So I'm planning to do something similar as before where I want to simply apply 5V DC and it starts playing the MP3 file(s).  So far I've found it will instantly start playing vs. the cube player which seems to "boot up" trying to decide what mode it's in before playing the MP3 file(s).

 

Of course this is meant to drive stereo headphones so I found a stereo amplifier 5V module for less than $1.

 

http://www.ebay.com/itm/390877...e=STRK%3AMEBIDX%3AIT

 

This is allegedly 3 Watts per channel which is plenty of power for a layout accessory sound.  What I'm looking forward to is the STEREO.  Not so much for a crossing gate, but for a station platform with the speakers separated you can have the sounds from both ends of a platform creating illusions of motion such as baggage carts going back and forth, or PA announcements from different directions, or the sounds of passing trains going from left-to-right or right-to-left, etc.  All this for about $5...

 

Attachments

Images (2)
  • ogr sound module using mp3 cube
  • ogr stereo sound hack
Last edited by stan2004

We get alot of teasing over the third rail, take advantage of it.

 

A long time ago I was using a 24-VDC-operated micro-PLC and insulated sections which isn't really rocket science.  I also figured out I could sense direction with two isolated sections, and various delays. And if you think about it, I was able to detect the moment the lead wheels cross the junction of one insulated block to another.

 

Quite possibly you could have three sections, short-long-short straddling the crossing, and you could detect when the engine crosses either junction.

 

Now I am not so sure I would use a micro-PLC. Sure was easy to interface it to the isolated section. But maybe some way to work with one of those Raspberry Pi, Arduino, Beagle Board, or that new $9.99 one that is on Kick-Starter.

 

I could see each board doing its own thing, then optionally sending info out some WiFi connection.

 

Found the $9.99. --- Warning --- it is big time beta.

http://arstechnica.com/informa...ilding-a-9-computer/

Last edited by illinoiscentral
Originally Posted by nvocc5:

Hi Stan thanks for the reply. The first link Ebay does not work could resend it please.

Link fixed (I think!).  $1.07 free shipping.  I got mine from this seller but there are dozens selling the same item.  Note that the color of the case changes the price dramatically.  Obviously it doesn't matter for this application - seems all the different sellers have the purple/pink case the cheapest. 

 

I see you started another thread for a rolling-stock sound application.  If you are pondering this alternative, I'll post comments there as I think I'd approach it differently for rolling-stock sound vs. track-side accessory sound.

Dear Stan

 

Thanks for the reply and the corrected link. I would like to keep the track side and the rolling stock separate as not to confuse the two. I ordered the parts and I am waiting for them to come. How would wire this up to the IR trackside with  oscillator module  and the MP3 player. Could you provide a scheme so I could follow, thanks! 

Dear Stan

 

Thanks for the vote of confidence. Since I have a good mentor like you where I can ask question and bonce idea off of. Now I do not have that confused look when I use to go to RS and look at the parts draw. I have a clue of what I doing or very dangerous man with a soldering iron. Have soldering iron and electrical scheme will build. I am still amazed (with a lot of your help of course) that the IR works.

 

Dear Michael

 

I read the article you suggested, I am very impressed.

Originally Posted by nvocc5:

How would wire this up to the IR trackside with  oscillator module  and the MP3 player. Could you provide a scheme so I could follow, thanks! 

It will take a few weeks to get it but I am working on it!  I'm still working on some arcane technical issues but so far so good. 

 

insanely priced mp3 sound accessory

Wow. The MP3 player is absolutely incredible!  There's only 1 IC in there, one diode, 2 resistors and not a single capacitor on the entire board.  And all this for $1.07 free shipping.  I have it blasting out Pink Floyd right now with room filling sound thru the amplifier module. 

 

I've touted these insanely priced eBay modules for a while now but this one may be the best bang-for-the-buck.  Yes, I'll drop back to a "boring" crossing-gate sound and show how to hook it up with the crossing flashers and IR detector when I finish dotting the i's and crossing the t's.

Attachments

Images (1)
  • insanely priced mp3 sound accessory
Originally Posted by nvocc5:

What is the story with rechargeable battery roll your own or an EBay special?

The battery is included in the clip-on-your-belt MP3 player.  I think it's a Lithium type about 3.8V.  Since you're driving headphones you don't need a big battery.  The cube MP3 player also has a battery but much bigger as it must drive the built-in speaker.  So in both cases, you charge the device via the mini-USB and you get some amount of play time.

 

Amongst other things, I'm poking around and measuring things to see if it works reliably WITHOUT the battery installed...powered by 5V from the mini-USB that normally charges the battery.

 

OTOH, for the rolling-stock application it may be that you want the battery so that it can take track-voltage dropouts without hiccuping the audio.  We all know about installing a capacitor in the LED lighting cars to demote flicker.  But when pumping out over 1 Watt of audio power, that's substantially more than LED lighting.  It would have to be one huge capacitor to handle intermittent power loss...hence maybe using the free rechargeable battery is the way to go.  Anyway, this is the kind of stuff I'm looking into...

Add Reply

Post

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

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