Skip to main content

For Stan or anyone else who has ordered stuff from China.

 

Without looking carefully, I ordered a 5V 2-Ch relay module. Just received it, but when looking it up on ebay, there was no explanation as to what to connect to what to trigger each channel.

 

There is an accompanying schematic, but good luck trying to read it (and it is no better printed out).

 

The link to the module is as follows:

 

http://www.ebay.com/itm/5V-2-C..._cvip=true&rt=nc

 

Thanks for any help.

 

Ken

Stan,

 

Back on Feb 28 (2015) we had a number of back and forth posts on time delays for the IR detection circuit. In one of your posts, you questioned whether I had the module with a 1K resistor--I could not verify. You also said to insert a cap in the trigger circuit.

I have my detector set up for across track and inserted a 100uf electrolytic cap between the IR module OUT and GRD. Before adding Cap,with detection, the relay is off (OUT is LO). When I break the beam, relay is on (OUT is HI) With the Cap, the detection circuit works as before, but no delay. If indeed the R4 1K resistor is not there, could that be the problem---i.e., cap discharges too quickly.

 

Ken

Last edited by ken's trains

Hi all. I'm getting very frustrated. I did some more diagnostics. As I mentioned before, I have the LED/sensor combo removed to do cross track sensing. So, with detection (beam not broken), I should have a LO from the IR module OUT. I have VCC adj to ~5V. When the IR OUT is not connected to the relay module, it measures a few mV (LO), and when the beam is broken, it measures VCC. When I connect IR OUT to the relay module IN, and the beam is broken, IR OUT drops to about 2V. I have tried connecting the relay module GRD to PWR GRD only, connected the relay module COM-GRD to PWR GRD (other GRD removed), and on and on. The only way the relay module will trigger, is with PWR GRD connected to relay GRD and the COM-GRD jumper installed. But then the IR OUT drops to 2V. I would guess this has something to do with my n- delay problem.

 

Boy am I confused?????? Any ideas.

 

Ken

Originally Posted by ken's trains:
Without looking carefully, I ordered a 5V 2-Ch relay module. Just received it, but when looking it up on ebay, there was no explanation as to what to connect to what to trigger each channel.

 

There is an accompanying schematic, but good luck trying to read it (and it is no better printed out). 

Assuming the schematic is correct, it is an active-LO trigger for both channels.  It cannot be configured for active-HI trigger like the other module.  Connect +5V to VCC pin, connect Ground to GRD pin.  Connect the two active low trigger signals to IN1 and IN2 pins.

Originally Posted by ken's trains:

could that be the problem---i.e., cap discharges too quickly.

Yes. The idea is to rapidly charge the cap upon activation, then slowly discharge it to effect the delay.  In looking at the schematic shown earlier, the IR module has an active-LO output. IIRC the module spec says it can drive 10 mA when LO.  The ability to drive the output HI (when the beam is broken) is much less than 10 mA.  With the 10K resistor between the module OUT pin and VCC, the HI current is no more than about 0.5 mA (i.e., 5V/10K).  So after the capacitor charges up (when the beam is broken), it gets discharged very rapidly when the beam is re-established.  That is, the IR module rapidly discharges the capacitor so there's no delay.

 

Originally Posted by ken's trains:

But then the IR OUT drops to 2V. I would guess this has something to do with my n- delay problem.

Per above, the IR module is an active-LO output.  Its ability to drive the output HI is limited.  That why when the output is LO is goes very near ground, but when HI and hooked up to a load (the relay module), it is not "strong" enough to drive it up to +5V but rather only to about 2V.

 

So there are 2 issues to deal with present configuration (active-LO IR module trying to drive an active-HI relay module). 1) The IR module rapidly discharges the capacitor when the beam is re-established.  2) The IR module can't drive the capacitor HI enough (only to 2V) so even if 1) is solved, the limited capacitor charge and the loading from the relay module do not provide enough hold time.  Both issues can be addressed with a few inexpensive components between the two modules.  This was described in a previous posting about adding delay to the dual-beam detector example though it did not use an IR module but just the loose IR LED and loose IR photo-transistor.  If you still want to use the IR module, I can adapt the circuit to be used with an IR module...that is assuming you haven't thrown in the towel...

Stan, with regard to your first post, could I just insert an inverter in the circuit to change the LO to a HI?

 

Stan, with regard to you 2nd post, thank you for the explanation and no, I will not throw in the towel. I have plenty of salve for my soldering iron burns (a little humor). Let me know what mod.'s I have to make.

 

By the way, in one of your early posts, you mentioned the 2-detector approach where you could set things up like logic devices. I was wondering with that approach, what additional components would I need to make an OR, so that when either IR detector beam was broken, the relay would be triggered?

 

Ken

Last edited by ken's trains
Originally Posted by ken's trains:

Stan, with regard to your first post, could I just insert an inverter in the circuit to change the LO to a HI?

Yes.  A suitable and economical inverter is a resistor and NPN transistor as shown... less than 10 cents. 

 

ogr relay control signal inverter

with regard to you 2nd post ... Let me know what mod.'s I have to make.

Similar to the time-delay circuit shown earlier with the 2 stacked loose/bare IR detectors.  That is, the IR module takes the place of the bare IR photo-transistors:

 ogr IR module itad with delay hookup 5v

Parts described earlier.  The 10uF capacitor value can be adjusted for time-delay.

By the way, in one of your early posts, you mentioned the 2-detector approach where you could set things up like logic devices. I was wondering with that approach, what additional components would I need to make an OR, so that when either IR detector beam was broken, the relay would be triggered?

See previous post with 2 stacked IR detectors and time-delay.  You don't need the IR module.  In fact, since you've already disconnected the IR photo-transistor detectors from the IR module you're essentially there already.  In this case you need to mind the polarity of the detector with + going to the transistor collector pins, and - going to the transistor emitter pins.

 

Obviously you still need the IR LED(s) to transmit the beam(s).  I suppose you could use the IR module for the sole-purpose of providing the resistor needed to limit the IR LED current.  But that's kind of lame.  Just power each IR LED transmitter with +5V and a current-limiting resistor as shown in previous posting.  You will need to establish polarity on the IR LED. If you have to wait on the resistor (I recommend just buying one of those resistor assortments on eBay where each resistor is less than a penny) use the module to continue experimenting so that the IR LED(s) get power.

 

It's a bit trickier to implement logic when combining modules because, in general, the modules have components meant to allow them to work alone.  OTOH by working with bare components (not modules) you have more flexibility to combine them in ways to perform logic "tricks".  Kind of a poor explanation but in this application, I'd go with the bare/loose components which is also cheaper.

Attachments

Images (2)
  • ogr relay control signal inverter
  • ogr IR module itad with delay hookup 5v
Originally Posted by ken's trains:

I'm giving up on model railroading and opening KEN's SHACK.

Actually, if someone can figure it out, I think there's an opportunity to buy stuff from Asia and re-sell it in the US after testing, providing instructions in English, short delivery time, and so on.  DigiKey is frequently recommended as a parts supplier on this forum.  What's not commonly known is it was started by a ham radio operator selling off his excess inventory from a failed electronics project - a Morse code "keyer" gadget known as the "Digi-Key".   So Ken's Shack makes perfect sense to me!

Oh, and I also ordered a bucket of resistors (I believe 400 assorted for about $2).

Spot on.  For 1/2 cent per resistor, I recommend anyone messing with this electronics stuff get such an assortment...less than a cup of coffee at Starbucks!  I don't understand their "new math" where they say "30 values x 30 pcs=400pcs" but then I guess I'm just old-school...

 

http://www.ebay.com/itm/Kinds-...;hash=item2ecd21d3e8

 

Hi Stan,

 

My EE degree is from 1965 and I spent most of my career as a Systems Engr., little to no original electrical design work. Pretty good with computers and S/W, but that's about it. I will show my lack there of with the following questions.

 

Many posts ago, you suggested and I bought a bunch of LED emitters and sensors (940nm). I couldn't find the purchase info, so I found your post on same subject which also linked me to digikey---I chose Asian cheap instead. Just looked at same items on digikey (where they have actual spec.s), I got further confused. It appears that the max. sensor voltage is 1.3V. Also confusing was the spec.s on the emitter as "30V collector to emitter max..  I then looked at the 2-IR detector circuit (the OR function) you provided and saw that you connected the emitter to 5V thru a 100 ohm resistor and connected one of the sensors to 5V direct with the other connected in series with the first to ground.

 

How about the 1.3V max. spec. on the sensors and what does the 30V max. mean on the emitters?

 

As to other circuits. To be honest, I am still waiting to pick up 2 more sheets of homosote so I can cut a hole for my turntable and start my layout. When I finally get things set up, I want to get into sensor-controlled operation--the sky's the limit. I also have many, many operating accessories.

Ken 

Originally Posted by ken's trains:

Hi Stan,

 

My EE degree is from 1965 and I spent most of my career as a Systems Engr., little to no original electrical design work. Pretty good with computers and S/W, but that's about it. I will show my lack there of with the following questions.

 

Many posts ago, you suggested and I bought a bunch of LED emitters and sensors (940nm). I couldn't find the purchase info, so I found your post on same subject which also linked me to digikey---I chose Asian cheap instead. Just looked at same items on digikey (where they have actual spec.s), I got further confused. It appears that the max. sensor voltage is 1.3V. Also confusing was the spec.s on the emitter as "30V collector to emitter max..  I then looked at the 2-IR detector circuit (the OR function) you provided and saw that you connected the emitter to 5V thru a 100 ohm resistor and connected one of the sensors to 5V direct with the other connected in series with the first to ground.

 

How about the 1.3V max. spec. on the sensors and what does the 30V max. mean on the emitters?

 

As to other circuits. To be honest, I am still waiting to pick up 2 more sheets of homosote so I can cut a hole for my turntable and start my layout. When I finally get things set up, I want to get into sensor-controlled operation--the sky's the limit. I also have many, many operating accessories.

Ken 

Hi Ken

I have been watching this thread with great interest, many years ago in the days of valves and as transistor were just in there infancy, as an electrician I also used to hobby with electronics and model railroad, but the electronics has now evolved and I have found it so much easier and cheaper in the long run to BUY ready made Optical or IR detectors, this way I get more time playing with my trains than messing about building detectors etc, do not get me wrong, I still like messing about and have modified several of my Buildings and passenger cars. Reed Relays are sooooo cheap and its amazing with what you can switch using these alone, just go back to basics. (it's only a switch) I used to have a set up in my garden railway using relays on points, and magnets on the loco switching reed relays to operate points to set a locomotive to go in a different loop simply by the magnet operating the reed relay which remotely switched the points. SIMPLES!

MTH and LIONEL sell IR detectors, as does a IT products (West Hills CA) check out my you tube videos type in Ernie Stammers. Re ITP they do some great sound systems which I have used to modify several Lionel accessories, so I still play with trains and play with ready built modules, my trains will do as I say and not what some software says it should. (its only because I do not understand S/W) another small point. US=switches=UK =points.

sorry if that sounded confusing but it is 4:30 am here in the UK and I couldnt sleep.

Thank you Lionel man for your suggestions. Problem is, I enjoy the electronic end of the hobby just as much as the train part. I have been away from electronics since the early days of uprocessors and assembly language/basic programming. I have a lot to catch up on, and really enjoy this part of it.

 

Stan, I think I understand how you can apply more volts to the emitter. From your circuit, you have 100 ohm current limiting resistors with the 5V VCC. I, of course, missed the relevance and in playing around, used one of the 12V power supplies you suggested to power one of the many, many LED emitters I bought. I cooked it. I then used the DC-DC volt reg to drop the volts to 1.27 and it worked without the resistor. Is that what they mean in the spec. (i.e., max. voltage is 'without current limiting'--except the emitters I have are 30V max.--so still confused). Is that how you get away with the higher voltage on the sensors (by current limiting thru connection in series)??

Originally Posted by ken's trains:
It appears that the max. sensor voltage is 1.3V. Also confusing was the spec.s on the emitter as "30V collector to emitter max..  I then looked at the 2-IR detector circuit (the OR function) you provided and saw that you connected the emitter to 5V thru a 100 ohm resistor and connected one of the sensors to 5V direct with the other connected in series with the first to ground.

 

How about the 1.3V max. spec. on the sensors and what does the 30V max. mean on the emitters?

Can you identify the link or where you found the 1.3V max spec on the sensor (the photo-transistor)?  I can imagine such a spec on the LED transmitter component but am scratching my head on what in a photo-transistor would be limited to 1.3V.

 

The 30V specification applied to the maximum allowed voltage between the collector and emitter pins of the photo-transistor.  It has nothing to do with the LED.  And it is unfortunate (and confusing) that one of the pins of the photo-transistor is called the "emitter".  This "emitter" pin has nothing to do with the LED acting as an emitter of a IR beam.  In any event, the 30V spec is clearly not an issue since with the 12V or 5V DC power supply, there is no way that 30V could appear between the 2 pins of the photo-transistor.

 

Getting back to the 1.3V, if that is actually referring to the IR LED transmitter, your supposition about the 100 ohm resistor is correct.  If the voltage across the IR LED is 1.3V, the 100 ohm resistor must be dropping 3.7V since the overall supply is 5V.  The current thru the resistor (and IR LED) is therefore 3.7V / 100 ohms = 37 mA.  Most guys have been "trained" to drive LEDs at 20 mA...but that applies to colored indicator LEDs.  IR LEDs are a different animal and are typically driven at higher currents and 37 mA is not a problem.

Originally Posted by ken's trains:

My EE degree is from 1965 and I spent most of my career as a Systems Engr., little to no original electrical design work.

 

Ken, a lot of us old guys learned all about vacuum tubes in school, but I've been slowly trying to get back into the electrical design arena too.  I have had stretches of time where I actually did electronic design, but larger stretches of time where I was a computer nerd, and then a project manager.  You learned it once, you can rev up those old gray cells again and get back in the game.

 

John, thank you for the support--sometimes I can't believe I actually have an EE degree, things have changed so much since the 1960's.

 

Stan in answer to your question, in a Jan 21 post you referred me to DigiKey for the following LEDs:

 - DigiKey emitter Part No. Kingbright WP710A10F3C: has listed a forward voltage of 1.2V & 50ma max.

 - DigiKey phototransistor Part No. Lite-On Inc LTR-4206E:  has listed "collector emitter breakdown (Max)" of 30V & collector current (Max) of 4.8ma.

I instead, bought pretty much (I think) the same from China. This is where those values I listed came from.

Also, still curious as to your series connection of the LED sensors in the schematic of your 2-detector setup. Specifically as to whether or not this is how you limit the collector current to 4.8ma max.

Ken

Last edited by ken's trains

I don't routinely run LED's IR or otherwise, at the absolute maximum ratings, you'll probably get more life out of them at more reasonable currents.

 

You'll have to be more specific about my "2-detector" setup, can you provide a link?  Note that the collector current of a phototransistor will be determined by the external IR light detected, the maximum is just a limitation to keep from toasting.  So, if you had a 5VDC power supply, you'd want around a 1k ohm load on it to avoid exceeding the maximum collector current rating of 4.8ma.

 

Originally Posted by gunrunnerjohn:

I don't routinely run LED's IR or otherwise, at the absolute maximum ratings, you'll probably get more life out of them at more reasonable currents.

 

You'll have to be more specific about my "2-detector" setup, can you provide a link?  Note that the collector current of a phototransistor will be determined by the external IR light detected, the maximum is just a limitation to keep from toasting.  So, if you had a 5VDC power supply, you'd want around a 1k ohm load on it to avoid exceeding the maximum collector current rating of 4.8ma.

 

Having had a very good nights sleep and having the family over for our traditional Good Friday fish and chip supper I would like to offer my two penny worth of information. During your calculations do not forget to include the following:

Volt drop  cable length and cable size, volt drop over diodes 0.7 volts for silicon and 0.35?? for germanium diodes, with out these you could easily think that something was wrong, so please build them into your factors, also remember that there is a difference in potential with LED'S.

Just some thoughts from an old old spark

 I had a 10th grade electrical class that touched briefly on electronics, but I grew up arguing with 3 automotive, 4 mechanical, and 2 aerospace engineers. When they get stuck, I usually get a call to help them simplify, or to think more "out of the box". Repair, and trouble shooting kind of come naturally to me. Most of the time.

 Being a fast learner, I understand things, better than "I know" them.

   I was also repairing radios by swapping parts as a kid.(with a woodburner) Mostly burnt resistors, but it was before I knew what the color bands meant.

  Logic maps, and schematics are just maze games that really couldn't be easier for me. I credit my introduction to electricity as " think of electricity as water seeking the easiest way to the ground. 

 And all the early stuff sunk in enough feed me well for seven years maintaining video/pizza joints as I learned more by curiosity, or necessity. 

 Manuals don't explain new components often. We got things in with very new chips regularly. I would have to wait for some things to hit cross reference catalogs to know for sure what I had, and identify differences. This thread alone would have saved me hours upon hours of self teaching, and experimentation.

 I haven't learned anything new here really, but the review has kicked what I know closer to the top again.

   

 Why bother with my drivel? To thank those really responsible for my being able to do all that. Folks like those of you sharing. 

 

 

 

 

 

Originally Posted by ken's trains:

The 2-detector circuit was from March 20, 2015 (this thread) post by Stan. In that circuit he has resistors in the emitter circuit, but none in the sensor circuit (instead he just connected them in series to VCC and ground.

Then that's my mistake though I don't see which circuit does this; there should NOT be a sensor circuit where the photo-transistor(s) whether just one or two in series are directly connected between VCC and ground.  Here are the two cases I believe you refer to...edited to just show the relevant components:

 

ogr max phototransistor current

In the left case, whether it be one or two photo-transistors, the 10k ohm resistor limits the current flowing thru the transistor(s).  The max current is if the photo-transistors are shorted or fully "on".  In this case the voltage across the photo-transistors would be 0 Volts and the current would be 0.5 mA.

 

In the right case, with the photo-transistors connected directly to the relay module input, note that the relay module input circuit contains the 817 opto-isolator chip plus a 1k ohm resistor.  The 817 contains an IR LED itself which drops just over 1 V when "on".  So the max current if the photo-transistor is shorted or fully "on" is less than 4 mA.

 

Attachments

Images (1)
  • ogr max phototransistor current
Originally Posted by Lionel man UK:
Originally Posted by gunrunnerjohn:

I don't routinely run LED's IR or otherwise, at the absolute maximum ratings, you'll probably get more life out of them at more reasonable currents.

 

You'll have to be more specific about my "2-detector" setup, can you provide a link?  Note that the collector current of a phototransistor will be determined by the external IR light detected, the maximum is just a limitation to keep from toasting.  So, if you had a 5VDC power supply, you'd want around a 1k ohm load on it to avoid exceeding the maximum collector current rating of 4.8ma.

 

Having had a very good nights sleep and having the family over for our traditional Good Friday fish and chip supper I would like to offer my two penny worth of information. During your calculations do not forget to include the following:

Volt drop  cable length and cable size, volt drop over diodes 0.7 volts for silicon and 0.35?? for germanium diodes, with out these you could easily think that something was wrong, so please build them into your factors, also remember that there is a difference in potential with LED'S.

Just some thoughts from an old old spark

I'd discount any drop in the wires unless you're wiring these to the other side of the house!  Ten feet of #30 wire, certainly smaller than most will be using, will have a resistance of around one ohm.  That's not going to affect our calculations for currents in the 10-30ma range.

 

This is for anyone, and I will stop impulse buying--I promise. I bought this thing w/o paying attention to the PM portion. Let's not get into how little I know about motors or motor controllers. But, I just assumed I could find a use for a motor controller. What kind of motor can I control with this. My dull brain seems to think that 21KHz PM is just high frequency AC. But it could also be reduced power DC due to the duty cycles. I'm in way over my head.

 

Adriatic, thank you for the encouragement. This site is the best, and I don't have to put out $40K a year for tuition to go back to school.

Attachments

Images (1)
  • PM Motor Controller
Files (1)

Stan, you are right. I just started the following topic: "Pulse Width Modulation Control & Motors".

But first a question about your single and 2-detector IR circuits. I have the single working and it's fine as a test case, but to use it in application don't I have to add the transistor inverter scheme you posted earlier so that the relay is not ON when the beam is detected, and ON when the beam is broken? Otherwise, the relay coil would eventually burn out being energized all the time. Also, that's how I can add the capacitive delay as you showed.

 

Ken, I don't think the coil will burn out but it's only common sense to leave the relay un-energized as the coil draws about 1/2 Watt when active.  That is, for the price of a 2 cent transistor and a couple solder joints why not.  As you point out, you'll need this circuit anyway to add the time-delay.  Perhaps obvious but if you don't need time-delay, you can use the transistor circuit without the capacitor

Thanks Stan. However, since I've gone to the independent LEDs approach (ridding myself of that IR module) I will have a HI when the beam is detected. I looked the 2N3904 up and it is an NPN. By going to a similar PNP transistor will that allow me to trigger on a LO, and if so what transistor do you suggest and will the circuit otherwise be the same? If I don't need to changed transistors, what do I need to change to do a LO trigger.

Oh boy, now I just checked (more carefully) the listing info on a new 5VDC relay module (this one: http://www.ebay.com/itm/321691968640?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AITl). I bought 10 of these, and although more expensive, they are easier to wire and have that an additional neat feature. The come with a jumper that lets you trigger on a LO or a HI. So, now that that's a non-problem,new question. Since the LED sensor won't drive the relay trigger, or should I just connect it backwards (best description I can come up with)?

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.
×
×