You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old September 14th, 2021, 01:35 AM   #1
lwmar
Member
Argentina

lwmar is offline
 
Join Date: May 2021
Location: In a house
Posts: 22
Driving a FX2N' digital input with a LDR

Dear all,


I want to connect a LDR to one of the digital inputs of my chinese clone FX2N PLC (it has no analog inputs) and make that input active when the LDR is not receiving my laser's light. For that, first I measured the resistance value of the LDR and I've got this:


32kOhms when the laser is illuminating it

430 Ohms when the laser is not illuminating it



I know that the simplest circuit I can make is like this one (where R2 is my LDR), however I am asking here because I don't want to blow up the transistor and I think that over 4 Volts in R2 is probably too much. (I tried increasing R3 but in that case the LED does not light up) My intention is to connect the transistor's emitter to the PLC's input I want to drive and the collector to the common connection of the PLC (which is located next to the inputs). R1 and the LED you can see in the simulation are there just to simulate the ones located inside the PLC. I would like to know why the current meters at the transistor's base are showing 0.00 each.


Many thanks, best regards


Marcelo
Attached Images
File Type: jpg LDR_PLC.jpg (130.4 KB, 112 views)
  Reply With Quote
Old September 14th, 2021, 04:05 AM   #2
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 3,616
First of all connecting the PLC input to the emitter will not give enough voltage to the PLC to trigger the input, in simple terms the emitter in an NPN transistor will only have a difference of 0.5v below base, remember transistors are essentially current devices, you need a PNP in real terms for voltage sourcing.
Many years since I have designed & implemented discrete transistors so a little rusty. From the circuit I cannot see why you are not getting base current.
  Reply With Quote
Old September 14th, 2021, 06:50 AM   #3
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 3,867
Quote:
Originally Posted by lwmar View Post
I would like to know why the current meters at the transistor's base are showing 0.00 each.
The following is less than rigorous to be sure, and may be out to lunch entirely for that matter. But it may suggest, if not an answer to that query, then at least a path for further investigation.
  1. Base voltage is 4.05V
  2. Emitter voltage is 3.35V
    • = Base voltage - forward bias voltage = 4.05V - 0.7V
  3. D1:R1 junction voltage is 3.3V minimum
    • D1 LED forward voltage is around 3.3V
    • Cf. Pure-Green LED per The Google
  4. Voltage across R1 is 0.05V
    • = 3.35V - 3.3V
  5. Emmitter current iE across R1 is 23μA
    • = 0.05V / 2.2kOhm
    • Collector iC current is roughly the same
  6. Q1 BC549 DC gain iC/iB is 200 to 270
  7. Base current iB is 0.08μA to 0.12μA
    • = iC / gain = 23μA / 270 or 23μA / 200
Which iB is pretty small, but still not too small for the simulated μA ammeter.

That said, the (0.05V = 3.35V - 3.3V) difference in step 4 above is sensitive to the forward bias voltages of Q1 BC549 and D1 LED. E.g. relatively small increases in either or both of those forward bias voltages on the order of 45mV+ could drop iB below the 0.005μA limit to show 0.00 on that μA ammeter, while a yellow-green LED, with a forward bias voltage of around 1.9V, instead of the pure-green LED assumed above throws this post in the trash.

Obviously this is a ballpark approach with concomitant assumptions. It might be interesting to add meters on the load side of the circuit to infer what assumptions the simulator is making.


xxx.png
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
  Reply With Quote
Old September 14th, 2021, 01:48 PM   #4
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 3,616
This circuit is probably irrelevant as the emitter connected to the PLC will probably not be enough to turn it on.
  Reply With Quote
Old September 14th, 2021, 07:59 PM   #5
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 3,867
Quote:
Originally Posted by parky View Post
This circuit is probably irrelevant as the emitter connected to the PLC will probably not be enough to turn it on.

Ah, I think I see it now: is that because the base never goes higher than 4.05V, so the emitter cannot go above that 4.05V less the forward bias?
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
  Reply With Quote
Old September 15th, 2021, 09:34 AM   #6
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 3,616
Only way to use an NPN transistor to drive the PLC input would to make the PLC input sinking and put everything in the collector, in other words, the transistor collector will sit at 24v when the transistor is effectively switched off (no base current) so PLC input would be at 24v, when the transistor turns on the collector voltage will drop below the threshold of the PLC input & change state.
  Reply With Quote
Old September 15th, 2021, 02:12 PM   #7
lwmar
Member
Argentina

lwmar is offline
 
Join Date: May 2021
Location: In a house
Posts: 22
Thanks Parky and Drbitboy. They guy who sells me the electronic components is normally busy but this time he wasn't and suggested me this other circuit, I am going to build it in a few hours and I will let you know the results.
Attached Images
File Type: jpg LDR_TO_PLC_2.jpg (153.0 KB, 84 views)
  Reply With Quote
Old September 15th, 2021, 03:07 PM   #8
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 3,616
Yes, that makes more sense, just remember, if the PLC is wired as 24v source then your logic will be opposite i.e. when the led is off the input to the PLC will be on, the average current drawn on PLC inputs is around 10ma so to ensure the PLC input switches correctly the resistor needs to be around 2.5k at 24v supply & the PLC input might not switch at 12v although I have seen them switch at 8v.
  Reply With Quote
Old September 15th, 2021, 04:02 PM   #9
nehpets
Member
Wales

nehpets is offline
 
nehpets's Avatar
 
Join Date: Mar 2009
Location: Wales
Posts: 480
Or just put a relay in the collector and use a contact of that to switch the input
__________________
Why do programmers get confused between Halloween and Christmas - OCT31 = DEC25
  Reply With Quote
Old September 15th, 2021, 04:26 PM   #10
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 3,867
Please bear with me, I am trying to understand.

The PLC input is in the middle of a voltage divider between the [R5/R1] (sub-?)circuit and Q1, where the "resistance" of Q1 is either very high or very low. So to get the voltage at the PLC input side, we use Ohm's Law on a two-elements-in-series circuit where the resistance ratio is either very high or very low.

In the image, below, the LDR is lit and its resistance is 32kΩ, so the Q1 Base voltage is at or above the the 0.7V "forward bias." That bias allows current flow through Q1 from Collector to Emitter, which makes the Q1 Collector voltage ~ PLC input voltage low. I.e. Q1 "resistance" is near zero and therefore low compared to the [R5 8200Ω/R1 2.2kΩ] circuit, so Q1 "pulls" the mid-voltage-divider PLC input voltage low toward the Ground/PLC common to which Q1 Emitter is connected.

If the LDR is not lit and its resistance is low (430Ω), then the Q1 Base voltage will be low, below the 0.7V forward bias, which prevents current flow through Q1 from Collector to Emitter, which makes the Q1 Collector Voltage ~ PLC input voltage high. I.e. the [R5 8200Ω/R1 2.2kΩ] circuit's resistance is low compared to Q1's near infinite and therefore high "resistance", so the [R5 8200Ω/R1 2.2kΩ] circuit "pulls" the mid-voltage-divider PLC input voltage high toward the +12V to which it is connected.

Is that about right?

If yes, what is the purpose of [R5 8200Ω] (and why is it not [R5 8.2kΩ])? R5 not current limiting because more current will be flowing through the [R1 2.2kΩ + D1 LED] circuit. Wouldn't the circuit work almost identically without R5, or at least with a much larger resistance for R5?

For that matter, since it's a voltage divider, why not skip all the gubbins on the left and put the LDR directly where Q1 is. I realize that would switch the relative polarity of the light/no-light state and the state of the PLC input, but that could be remedied by connecting +12V to one end of the LDR, then the other end of the LDR to the PLC input and the positive side of [D1 LED], then [R1 2.2kΩ] between the negative side of [D1 LED] and Ground/PLC Common.

What does the transistor buy us here? Isn't the LDR analogous a to an NPN transistor, but with a light window and photons in the LDR replacing the base and electrons in the transistor?

If I am way off base here, feel free to mock.

[Update: maybe putting the LDR over controlling the base of Q1 limits the current flow through the LDR?]





__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.

Last edited by drbitboy; September 15th, 2021 at 04:29 PM.
  Reply With Quote
Old September 19th, 2021, 08:31 PM   #11
lwmar
Member
Argentina

lwmar is offline
 
Join Date: May 2021
Location: In a house
Posts: 22
Thanks all for the answers:

Drbitboy:

You can forget about R1 and D1 as those are not necessary and I didn't put them in the circuit I built. Where you ask me "is that about right?" I answer I think so (as this circuit was designed by the Engineer who sells me the electronic components). I have to apologise as I think I made a mistake in the circuit as the low resistance of 430 ohm happens when the LDR is illuminated.

I am not sure if he understood me as the results I am getting while measuring voltage between that PLC's input and ground are: 18V while the LDR is not illuminated and 5,8V when the LDR is illuminated. However I cannot find the LDR that shows 430 ohm and I am using one that shows 26,5 kohm without being illuminated and 2,8 kohm while being illuminated.

You ask me why 8200 ohm is not 8.2 kohm: it is the same value, isn't it?
Then you mention the possibility of not using the transistor in the circuit: Could you please draw that circuit?
  Reply With Quote
Old September 20th, 2021, 12:40 AM   #12
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 3,867
Re: 8200 vs.8.2k

I was asking why the diagram used "8200" to display the R5 resistance instead of "8.2k" - as long as they mean the same thing it does not matter.
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
  Reply With Quote
Old September 20th, 2021, 01:20 AM   #13
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 3,867
Quote:
Originally Posted by lwmar View Post
Then you mention the possibility of not using the transistor in the circuit: Could you please draw that circuit?
Maybe I am missing something obvious, but it would be a basic voltage divider, with two states; see below. I know you say the LDR lit/unlit resistances are different now, but something like this might still be possible.

In the schematic in Post #7 with the transistor, when the transistor is conducting the +12V flows to ground through only [R1 2.2k], the LED and the transistor. So the max current on the PLC sidehas to be at least a few mA (< 12V / 2.2kOhm ~ 5ma). The current in the circuit in this post could be about the same, depending on the final characteristics of the LDR and the pulldown resistor chosen.


xxx.png
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
  Reply With Quote
Old September 20th, 2021, 04:45 AM   #14
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 3,616
DR is right, however, one or two points, the PLC is usually rated at between 5-10ma drawn current (will depend on how the circuit is configured, very often the input transistor & LED are driven directly & the opto isolator after that hence the possible 10ma per input) what typical current will the LDR stand this is important as if it was rated at 10ma max then it could destroy it.
The other problem is the LDR will act like an analogue signal i.e. the voltage drop will vary with it's resistance (no light through to full light), therefore the PLC input may hover around it's switching point so cause intermittent switching although the hysteresis may help. you really need a positive transition from off to on for reliable operation. so a transistor to amplify is best.
  Reply With Quote
Old September 20th, 2021, 01:07 PM   #15
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 3,867
Quote:
Originally Posted by parky View Post
... need a positive transition from off to on for reliable operation. so a transistor to amplify is best.

Ah, transistor provides hysteresis.


Thanks for the lesson, @parky!
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Beckoff PLCs - FAST INPUT MODULE EL1202 | 2-channel digital input terminal 24 V DC, T naturephoenix LIVE PLC Questions And Answers 3 July 17th, 2018 02:00 AM
AC/DC Digital Input Card Help macese LIVE PLC Questions And Answers 9 October 30th, 2017 08:01 PM
Micrologix 1400 digital input as a counter marcinski LIVE PLC Questions And Answers 4 February 21st, 2014 04:08 PM
Control Logix Digital Input Card Problem SAM Khan LIVE PLC Questions And Answers 1 January 31st, 2013 02:32 PM
Digital Input Modules [Sinking] sunnyvaleplc LIVE PLC Questions And Answers 5 May 6th, 2011 09:53 PM


All times are GMT -4. The time now is 08:43 AM.


.