PNP or NPN for plc and motor driver?

Discussion in 'The Projects Forum' started by suzusky, Sep 24, 2012.

  1. suzusky

    suzusky Thread Starter New Member

    Joined:
    Sep 24, 2012
    Messages:
    25
    Folks, I'm new here and I'm hoping to get some help from our community here.
    Here I goes. I have a stepper motor driver for hobbyist from sparkfun (easydriver).
    I also have a Keyence plc transistor output to send pulse to my driver.
    Now the problem is that I have used npn for all my previous projects. It seems like the easydriver is not a npn device.

    On the easydriver is 3 inputs, "step", "dir" and "gnd". Let's just focus on step and gnd.
    For npn connection, rightfully plc output common is connected to negative 0v. +24v to step pin of easydriver. Gnd of easydriver connect to Plc pulse output. This to me is seems more like a pull signal by plc rather than feeding signal to easydriver to drive motor.

    Should the flow be plc output common to +24v. 0v to Gnd of easydriver. Plc pulse output to step pin of easydriver. This circuit seems more right to me because signal is coming out from plc pulse output. Is this circuit correct and is this circuit called pnp?

    Seriously, any help is really appreciated. Thanks!
  2. GetDeviceInfo

    GetDeviceInfo Senior Member

    Joined:
    Jun 7, 2009
    Messages:
    1,503
    Location:
    Canada
    you tell us, as there are many I/O configurations. Check your specific model documentation.
  3. suzusky

    suzusky Thread Starter New Member

    Joined:
    Sep 24, 2012
    Messages:
    25
    From the model documents, i sees NPN and PNP connections as in the attached file. Does it means that it can be universal, meaning i can put it NPN or PNP whenever i want it to?

    Attached Files:

  4. suzusky

    suzusky Thread Starter New Member

    Joined:
    Sep 24, 2012
    Messages:
    25
    I tried to post physical wiring of my proposed method. I do not know if my wiring is considered PNP wiring so i hope someone can advise me.

    Attached Files:

  5. panic mode

    panic mode Well-Known Member

    Joined:
    Oct 10, 2011
    Messages:
    1,097
    Location:
    Mississauga, Ontario
    1. what is the plc model you have there
    2. what is the output type, polarity and voltage of your plc outputs
    3. you must use transistor output (not relay) to drive easydriver board.
    4. easydriver is not isolated. how do you plan to power it?

    easydriver expects positive signals that are in 0-5V range. most PLCs use 24V. if you send 24V to easydriver like you show, you will fry it and possibly even damage plc output.
    if your plc has 24v pnp outputs, you need to add resistor between plc output and easydriver input. also you have to ensure that all such signals are clamped to 5V of the easy driver.
  6. suzusky

    suzusky Thread Starter New Member

    Joined:
    Sep 24, 2012
    Messages:
    25
    Hi Panic mode,

    1. what is the plc model you have there Keyence PLC
    2. what is the output type, polarity and voltage of your plc outputs I have a transistor type ouput and will supply 24VDC to PLC (the above pic "PNP and NPN" is the plc specs and it says that "a 1.6kΩ is connected to the plc output to connect a driver") I guess it should be safe to connect to easydriver "Step" input.
    3. you must use transistor output (not relay) to drive easydriver board.
    4. easydriver is not isolated. how do you plan to power it?
    I plan to use a separate power supply to the easydriver for driving my stepper motor and also control the pulse into easydriver using a plc.

    easydriver expects positive signals that are in 0-5V range. most PLCs use 24V. if you send 24V to easydriver like you show, you will fry it and possibly even damage plc output. As above, if a 1.6kΩ is in series with the plc output, i hope i am safe here.
    if your plc has 24v pnp outputs, you need to add resistor between plc output and easydriver input. also you have to ensure that all such signals are clamped to 5V of the easy driver. Since you mention that plc output is to be connected to the easydriver "Step" input, then could you advise me if the above pics "Plc to driver" is correct? There is no way i can connect NPN because the plc output will be connected to "gnd" of easydriver which i feel is wrong. And is that pics wiring call PNP?
  7. ScottWang

    ScottWang Well-Known Member

    Joined:
    Aug 23, 2012
    Messages:
    1,714
    Location:
    Taiwan, Asia (GMT +8)
    1. First you have to disconnect the Easydriver from PLC.

    2. According to C3 and 500 of PLC, you can test the polar of Zener, then you can identify is that a NPN output type or PNP output type, after that you can do the rest test .

    3. To test what kind of output type of your PLC? (to choose one of LED)
    a) If you wired as NPN output to test, and the LED is lighting, then the type is NPN type, otherwise is PNP type.
    [​IMG]

    b) If you wired as PNP output to test, and the LED is lighting, then the type is PNP type, otherwise is NPN type.
    [​IMG]

    4) NPN output type, We called it "current sink type", it means that the current is come from the next device, C3 should connect to GND.
    [​IMG]

    5) PNP output type, we called it "current output type", it means that the current is output to the next device, C3 should connect to +24V
    [​IMG]

    All value may need to adjust, if it isn't work very well.

    Attached Files:

  8. panic mode

    panic mode Well-Known Member

    Joined:
    Oct 10, 2011
    Messages:
    1,097
    Location:
    Mississauga, Ontario
    NO, you need to CLAMP signal to 5V or you WILL damage easydriver IC.
    above circuit idea could or would work for current sensitive device such as LED or optocoupler but NOT for voltage sensitive high impedance input. input current here is in micro amps and those resistors will not do anything without additional components.

    read the datasheet:
    http://www.sparkfun.com/datasheets/Robotics/A3967.pdf

    this is how you do it, either option will work.
    btw. "keyence plc" tells brand but not model. i asked for model. with model info, one can download and read correct datasheet. saying "allenbradley plc" is the same thing, does not even tell the family, not to mention output details like type, polarity and ratings. asking for help only makes sense when all info is provided such as exact part number and or link to datasheet.

    Attached Files:

    Last edited: Sep 25, 2012
  9. ScottWang

    ScottWang Well-Known Member

    Joined:
    Aug 23, 2012
    Messages:
    1,714
    Location:
    Taiwan, Asia (GMT +8)
    I forgot to add the Zener 5.1V, but "panic mode" mentioned that, so I decided to add it to the circuit.

    [​IMG]

    [​IMG]

    Although we will add the zener to protect the IC from input, but if didn't add zener will it still work normally or will damage, because I also added the zener on the normal circuit, but never try if didn't add zener, will it really damage, I want to know the situation, so I did the lab as following:

    I used a 5~24V through 1.5K to test 74HC00, and stay at 24V, the 74HC00 didn't damage.
    24V → 1.5K → I_meter(11.5mA) → input 74HC00

    I tested it after two hours, and I didn't feel any temperature, no warm, no heat, IC still working fine, but the Vcc had a little high(measured : 6.75V, calculating V = 24V - (11.5mA x 1.5K) = 24V - 17.25V = 6.75V, so measured value and calculation value are the same.

    74HC00 datasheet, page 4, Vcc : 2~6V.
    http://www.datasheetcatalog.org/datasheet/philips/74HC_HCT00_CNV_2.pdf

    Attached Files:

  10. suzusky

    suzusky Thread Starter New Member

    Joined:
    Sep 24, 2012
    Messages:
    25
    Thank you panic mode and Scott,

    Pardon me pls. Because you asked for output type, polarity and voltage of plc output.
    So I answered accordingly except for polarity. I tried to give whatever answer I know from your question because other than that I don't know what info to provide as I'm really new here. But then I never thought of putting a link to a datasheet. That's my bad. Sorry about that but I learned. The model of Keyence plc is kv-40dt (transistor type).

    Datasheet:
    http://www.hoskin.qc.ca/uploadpdf/Instrumentation/Keyence/hoskin_visual_kv40b4e717f216d.pdf

    Initially I found two types of output circuit, NPN and PNP. So I was confused which circuit do I have. I think I need to find out which circuit do I have from the test provided by Scott.
    Like what Scott stated, if my output circuit is NPN, then I'll have to flip the signal shown in the NPN circuit. If PNP, then I can connect according to either circuit from both of you.

    is the signal diode shown by panic mode connected to 5v of easydriver like what you mentioned that ensure all such signal must be clamp to 5v of easydriver? Pardon me again, the 5v from easydriver shows output, and the signal diode shows direction towards the 5v.
  11. suzusky

    suzusky Thread Starter New Member

    Joined:
    Sep 24, 2012
    Messages:
    25
    Hi Scott, would you care to explain more on the NPN circuit where you used 2SA733 transistor. There are a few questions that i hope you can advise me. I would like to know about the purpose of the transistor 2SA733 as well as the purpose of those resistors attached "10K", "4.7K" and "1.6K". There is also a zener inside my plc, what is it for and what should be the voltage at zener after i appied 24V to my output circuit? I'm quite weak in that area.

    According to your NPN circuit, it is not using R500 output anymore. I'm just curious why keyence built up a R500 output and we couldn't use it. Must it be in PNP then only we are allowed to use R500 output?
  12. ScottWang

    ScottWang Well-Known Member

    Joined:
    Aug 23, 2012
    Messages:
    1,714
    Location:
    Taiwan, Asia (GMT +8)
    Why I want to add 2SA733 circuit, because the step input of EasyDriver need a positive input, so I add 2SA733 to suit your need.

    When internal LED of PLC is lighting, it means that it Ouput a logical 'Hi' or '1', and the E voltage of photo transistor will goes 'Hi' too, it will active the transistor, and C of transistor(or 500) will became 'Lo' or '0', Then B of 2SA733 got the current, and C of 2SA733 will goes 'Hi' or '1', but the C voltage is too high, so I used 1.6K to decrease the current, and used 5.1V Zener to clamp the Voltage to protect step input of EasyDriver.

    [​IMG]

    I'm not sure what voltage is the zener, probably is 24V, because the plc vcc is 24V.
    The zener is designed to protect the output transistor and it's circuit.

    To see how a zener is.
    [​IMG]

    If you want to know more about Zener, please see below.
    http://en.wikipedia.org/wiki/Zener_diode

    When you know more about Zener, if you still have question about Zener, Just post it.

    If you want to use R500, you can add one resistor R=10K-1.6K=8.4K, so you can add a 8.2k to R500, and Add 4.7K,1.6K and 2SA733.

    If you use R500, you still have to use four parts, that's why I didn't show the circuit.

    Whatever NPN or PNP circuit, you can use anyone of 500 or R500, but you cann't use them at the same time.

    Attached Files:

    suzusky likes this.
  13. panic mode

    panic mode Well-Known Member

    Joined:
    Oct 10, 2011
    Messages:
    1,097
    Location:
    Mississauga, Ontario
    ok, let me try to explain some more:

    reason i mentioned datasheet is because it tells you more about exact part you have. document you posted is not that, it looks like sales brochure or excerpt from a catalogue.

    this may be used as quick product selection guide or featuer overview but it is NOT a datasheet or manual - true manual is much more detailed. for example i just downloaded it from Keyence website (free registration required) and you get three manuals zipped together. one of them is installation manual for KV-40DT. it is 4.2mb in size and 444 pages long (KV_Installation_96M0364_UM_AS_3.pdf). obviously it has few more things than the couple of pages you have found.

    as with many industrial products, manual may assume certain knowledge. as you become more familiar with particular product line, detailed documents are less needed. until you get there, you need to focus a lot more on real manuals and pay attention to details because even info in them may not be easy to spot obvious but it is much less likely to be omitted as "non essential".

    there is another general thing to know about industrial controls (including PLCs): in western countries (Europe, North America) I/Os are PNP. in Japan I/O are NPN (not just on PLCs, also sensors, safety devices like light curtains etc.). You CAN buy products with either polarity anywhere in the world (because your customers can be anywhere in the world too) but if you look around you will see that the best prices, volumes/availability etc. match polarity by regions as mentioned above.

    Keyence is a Japanese company and like others it is forced to cater to more than just domestic market. They are well aware of the I/O polarity preferences and therefore they also make "world" edition of their products. In case of PLCs that is version with PNP outputs. Inputs generally can be either polarity thanks to built in AC optocouplers (work for either polarity of input signal).

    so "domestic" or "normal" part number is KV-40DT (which has NPN outputs).
    matching "world" edition part is KV-40DTP (which has PNP outputs).
    the extra letters in part number specifies special options or non-standard feature (such as PNP outputs). other Japanese brands (Omron, Mitsubishi, Panasonic etc.) of automation products have same thing (of course markign and part numbers will be different but there are flavours of part number that is "normal/domestic" and "export/world") so knowing EXACT part number can make a big difference. Sometimes the base part number that is printed on the front of the unit may be incomplete and only suggest product family. In that case detailed part number is on the side of product. in short make sure you know the true part number.

    as with in any industry, certain knowledge is assumed so even when you find detailed manual, many things are not always worded very clearly or explicitly. this is one of those cases so please take a look at image of one of pages. This is perfect example of how important things (like polarity) are presented. Each company has own standards so you better be careful. Compare this with what you had in post#3 for example.

    For NPN output you can use what ScottWang posted in #11 and #12 or you can go for simpler circuit as shown below. Note that in this case signal are inverted so you need to account for this in software which is very easy. Also this version of circuit only works for NPN outputs. Connecting PNP (common mistake when replacing PLC) can be tolerated if there are additional resistors between PLC and diodes.

    Clamping circuit here shows only one output (step) so if you want PLC to control direction, you need to replicate your circuit for another output(s) too.

    In case of zener clamp, external 5.1V zener clamps signal to just 5.1V (there is another diode like that in PLC but for higher voltage so it will be inactive in this case).

    using signal diode works a bit different. clamping is acomplished when diode is forward biased so voltage on input would actually reach 5.7V. in this case current from each PLC output would be some 11.9mA. voltage regulators are usually series regulators so if voltage is above setpoint (5V) they just cut off (stop supplying current). but if load cannot consume that current, voltage on 5V rail would rise. and the current from PLC output and it may not always work well for all power supplies if load is small, for example when current from PLC output(s) exceeds consumption of loads on 5V rail. EasyDriver draws about 50mA when outputs are enabled but less than 9mA when none is active. So if you have two PLC outputs high, that would make 2*11.9mA=23.8mA. If EasyDriver only draws less than 9mA at 5V, it's voltage will rise until 23.8mA flows through it. if you have no other loads in 5V circuit, you may want to add either dummy load such as 220 Ohm or another clamp across 5V or insert resistor(s) between PLC output and clamping diode. see how reading datasheets is important?

    Attached Files:

    Last edited: Sep 27, 2012
    suzusky likes this.
  14. suzusky

    suzusky Thread Starter New Member

    Joined:
    Sep 24, 2012
    Messages:
    25
    ScottWang, Thank you. I'm deeply impressed by the electrical knowledge that you and panic_mode have. I definitely have a clearer picture from your detail explanation but i'll absorb more and ask you again if i have any problem.
  15. suzusky

    suzusky Thread Starter New Member

    Joined:
    Sep 24, 2012
    Messages:
    25
    Well, panic mode i got to be thankful to you as well. you definitely brought sense into me. seriously, i never got to know so much about the PLC that i'm holding on right now until i sees your message. awesome. thanks!

    btw, so on the software, do i use R500 or 500 or both output to trigger the pulse to driver?
  16. ScottWang

    ScottWang Well-Known Member

    Joined:
    Aug 23, 2012
    Messages:
    1,714
    Location:
    Taiwan, Asia (GMT +8)
    You do not use R500 and 500 connecting to the same input of signal as I drawed.
    But you can use R500 and 500 both connecting to two different input of next stage.
    Even more, you can connecting to more input of next stages from 500 as I drawed.
    Last edited: Sep 27, 2012
  17. suzusky

    suzusky Thread Starter New Member

    Joined:
    Sep 24, 2012
    Messages:
    25
    Scott, do you mind illustrate in a simple diagram. According to panic mode diagram, i was thinking of only putting 500 as my output if i were to use his diagram.
  18. ScottWang

    ScottWang Well-Known Member

    Joined:
    Aug 23, 2012
    Messages:
    1,714
    Location:
    Taiwan, Asia (GMT +8)
    These two kinds of circuits using in light current input is ok, and it's easy, if the LOAD is too heavy, then you better use the circuit that I drawed.

    [​IMG]

    =============================================

    [​IMG]

    Attached Files:

  19. suzusky

    suzusky Thread Starter New Member

    Joined:
    Sep 24, 2012
    Messages:
    25
    All, I managed to look through the datasheet and found that there is a selectable input voltage for the PLC. Sorry if i go off topic in this thread but I think its getting more and more exciting here, its still a long journey but i think this forum is simply awesome because all the enthusiasts or experts are so willing to share and learn.

    OK, the selectable input voltage refers that input 000 to 007 can be changed to 5v input if 5v input voltage is selected. I don't get this point.

    I will be tapping the 24V from the power supply to PLC inputs common. So where does the 5V come from? what happen to the other inputs "008 to 015"?
    Input  circuit.jpg

    input 5v.jpg
  20. panic mode

    panic mode Well-Known Member

    Joined:
    Oct 10, 2011
    Messages:
    1,097
    Location:
    Mississauga, Ontario
    only inputs 000-007 can be switched to operate in 5V range. all others remain 24V only...
Similar Threads
Forum Title Date
The Projects Forum AC motor 0-400Vac/120hz driver Apr 17, 2014
The Projects Forum Interfacing the MSP430 with the A4988 Stepper Motor Driver Apr 7, 2014
The Projects Forum Motor driver nte15006 Mar 24, 2014
The Projects Forum 60-70 volt brushless DC motor driver (Schematic) Mar 8, 2014
The Projects Forum DC motor Driver Jan 29, 2014

Share This Page