PNP switch

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

mrp192
Posts: 95
Joined: Sat Oct 10, 2020 4:32 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 3699, 3788
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

PNP switch

Post by mrp192 »

So I have some Festo proximity switches that I would like to use for pneumatic actuator position that I am going to be using for my ATC rack on my router. I know for Homing switches we have to use NPN switches. But is it possible to use PNP for this? Right now I am trying to use a transistor to change PNP to NPN but so far it isnt working.
Gary Campbell
Posts: 2164
Joined: Sat Nov 18, 2017 2:32 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: Acorn 238
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Marquette, MI
Contact:

Re: PNP switch

Post by Gary Campbell »

PNP devices are not compatible with Acorn. You can use a small relay module as a "gender changer " to be able to use them tho
GCnC Control
CNC Control & Retrofits
https://www.youtube.com/user/Islaww1/videos
mrp192
Posts: 95
Joined: Sat Oct 10, 2020 4:32 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 3699, 3788
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: PNP switch

Post by mrp192 »

Gary Campbell wrote: Mon May 31, 2021 3:44 pm PNP devices are not compatible with Acorn. You can use a small relay module as a "gender changer " to be able to use them tho
Thanks, I just figured that out.
mrp192
Posts: 95
Joined: Sat Oct 10, 2020 4:32 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 3699, 3788
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: PNP switch

Post by mrp192 »

Sorry for the super detailed drawing but I got the transistor figured out.
Attachments
PNP to NPN.png
Richards
Posts: 692
Joined: Sun Sep 16, 2018 9:01 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: South Jordan, UT

Re: PNP switch

Post by Richards »

You've drawn a NPN tranistor. With an NPN transistor, the Collector (C) must be connected to +V (or at least wired so that it SINKs current flowing through a device that is connected to +V. The Emitter (E) is normally connected directly to GND . When an NPN transistor's Base (B) goes positive when compared to its Emitter, the transistor turns on. The voltage required to do that with a silicon transistor is 0.7V. The current flowing through the Base junction is multiplied by the Beta (gain) of the transistor. If a transistor has a Beta of 25, then the transisor will allow 25X more current to flow through the Collector/Emitter junction than is flowing through the Base/Emitter junction. In other words, a small amount of current flowing through the Base controls a large amount of current flowing through the Collector. Because an NPN transistor that is connected to work as a switch SINKS current through a device, the Inputs on the Acorn will work as expected.

A PNP transistor (such as your PNP proximity sensor) SOURCES current. It can't be used with an Acorn Input because you SOURCE the voltage going to the inputs when you connect +24VDC to the +24V pin(s) on the Acorn's Inputs. Giving an Input 24VDC will not allow current to flow through the circuit. Whatever is connected to an Acorn Input must SINK current. It must pull the +24VDC to +5.9 VDC or less (see the Acorn Spec Manual, page 7).

A PNP proximity sensor can be connected to an NPN transistor to invert the signal. When the PNP transistor SOURCES voltage to the NPN transistor's Base, the NPN Collector will SINK current. The SINKING circuit will work with the Inputs on the Acorn. It is overly complex to wire up that kind of circuit when you can buy NPN Normally Closed proximity sensors on EBay for $6.00. I use both the 12mm barrel type sensors and the "hockey puck" sensors that you can see in MechTechMike's Mill video on my test bench. They work well.

Here are two circuits, PNP and NPN showing their typical use as switches.

PNP_NPN.png
PNP_NPN.png (2.32 KiB) Viewed 2811 times


Here is a simplified circuit showing a PNP transistor driving an NPN transistor. (Remember that a PNP transistor turns ON when its base voltage is 0.7V lower than its collector voltage. An NPN transistor turns ON when its base voltage is 0.7V higher than its emitter voltage.)
Attachments
NPN_PNP.png
NPN_PNP.png (3.25 KiB) Viewed 2811 times
-Mike Richards
Muzzer
Posts: 728
Joined: Mon Feb 19, 2018 2:52 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 38D269594F9C-0110180512
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: UK
Contact:

Re: PNP switch

Post by Muzzer »

I wouldn't want to see anyone try to drive the bottom circuit from an open collector output. There is nothing limiting the base current and the base would get upset if you tried to take it 0.7V or so below the 24V supply. The result would be either a blown open collector output (on the proximity switch or Acorn) or a blown PNP transistor or possibly both. If anyone really needs this level of basic introduction, it's likely they wouldn't know that.

Between the first diagram and the second, the NPN has developed a base-emitter resistor and an input (base) resistor, which is good. You'd need an equivalent pair of resistors on the PNP. In other words a resistor between the base and emitter and another one from the base to the open collector input of the proximity switch or Acorn.
Richards
Posts: 692
Joined: Sun Sep 16, 2018 9:01 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: South Jordan, UT

Re: PNP switch

Post by Richards »

Perhaps I should have drawn the bottom schematic as a PNP proximity sensor feeding an NPN transistor. The PNP proximity sensors that I use have three wires, a brown wire that is connected to +24VDC, a blue wire that is connected to GND, and a black wire that outputs the signal. The proximity sensor self-limits the current flowing through the black wire. Depending on the device used, it should be about 10mA. That black wire is represented by the emitter in the PNP transistor. Note that I drew that circuit with a voltage divider, but without any values assigned to the two resistors that connect GND to the PNP emitter. General practice uses 1:10; that is, the bottom resistor has 10X more resistance than the top resistor. 1K and 10K, 2.2K and 22K, 4.7K and 47K, etc. The gain of the NPN transistor determines how much current is needed at the base of the NPN transistor. If the transistor has a gain of 10X and you need 10mA to sink current from the Acorn, then you would need a resistor that allows about 1mA to flow into the base of the NPN transistor. Use Ohm's law to determine the resistance needed at the voltage you're using. The bottom resistor pulls the base to GND when the proximity sensor is NOT conducting. In the DIY world, the actual design is up to the builder, presumably after having read up on the subject and after having built a few prototypes using differing resistance values.

You'll note than in my post, I suggested that people use (edited) NPN N/C proximity sensors like the one shown in MechTechMike's mill video, rather than building a circuit like the one that I presented. That being said, I would also recommend that everyone buy 100 NPN general purpose transistors and 100 PNP general purpose transistors from DigiKey or Mouser, along with a variety of 1/2 watt resistors, and a white punch-down type breadboard. Surely I'm not the only Acorn user who asks himself, "What if I tried this?". Inverting a PNP NO proximity sensor so that it acts like a (edited) NPN NC proximity sensor, if done properly, requires that you build a robust circuit board. You'll need the proper schematic and pcb programs to do that. If you have the prototype boards made in the USA, plan on spending at least $150 for the prototype. If you have the prototypes make in China, plan on spending about $50 and then waiting a month. That's why I used the same type of sensor as MechTechMike. It does the job.

For those who just want to see how it's done, here's a schematic that throws out any attempt to explain theory. It shows a simple way to connect a PNP proximity sensor to an NPN transistor so that it SINKS current from an Acorn Input pin. The resistance values have been omitted because their value depends on the gain of the transistor, as explained above. I have used 2.2K with 22K, 4.7K with 47K, and 10K with 100K on various tests with a 2N2222 transistor. Because YOUR proximity sensors might use different colored wires than mine use, I've left off the wire colors. Note also that the Acorn's inputs have two pins labeled 24V. Either pin can be connected to +24V. I connect both 24V pins to +24V to keep me from connecting an input directly to the unused +24V input.


PNP_Acorn.png
PNP_Acorn.png (8.94 KiB) Viewed 2735 times
{Post was edited to correctly identify NPN NC proximity sensors as my preferred type.]
Last edited by Richards on Mon Jun 07, 2021 8:00 am, edited 2 times in total.
-Mike Richards
ShawnM
Posts: 2190
Joined: Fri May 24, 2019 8:34 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 7804734C6498-0401191832
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Clearwater, FL

Re: PNP switch

Post by ShawnM »

Or you could just buy the proper NPN switches. Just sayin’ :mrgreen:
Richards
Posts: 692
Joined: Sun Sep 16, 2018 9:01 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: South Jordan, UT

Re: PNP switch

Post by Richards »

Yes. I should have spent more time proof-reading. I meant to say NPN Normally Closed proximity sensors like MechTechMike showed in his mill video. NPN means that it SINKS current. Normally Closed means that the switch is ALWAYS ON except when it senses a target or when the switch fails because of a broken wire or some other physical problem with the circuit. A PNP sensor SOURCES current, so it can't be used with the Acorn unless it drives a relay wired as a Sinking circuit or an NPN type transistor is added to SINK current.

[I've edited my previous post to correctly identify the preferred sensor as NPN NC.]
-Mike Richards
mrp192
Posts: 95
Joined: Sat Oct 10, 2020 4:32 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 3699, 3788
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: PNP switch

Post by mrp192 »

ShawnM wrote: Sun Jun 06, 2021 2:42 pm Or you could just buy the proper NPN switches. Just sayin’ :mrgreen:
Normally yes. But The actuators that I got came with the switches so I would rather use the switches then just junk them.
Post Reply