On Sun, 21 Aug 2022 at 08:57, andrew beck <andrewbeck0...@gmail.com> wrote: > > I'm trying to convert these color sensors > > US $50.00 | Color Mark Sensor HW-111 Use for Packing Machine voltage 12-24v > DC NPN metal case Photoelectric Eyes Marks > https://a.aliexpress.com/_mtEjRmc > > > To pnp.
Well, you can't actually convert NPN to PNP. PNP sensors connect the output to +V when triggered, and NPN connect the output to GND when triggered. If you need an output that goes high when triggered, then it's a bit difficult. However in most cases going low when triggered is just as good, and then you can simply use the inverted signal in HAL. To have an output that is low when triggered and high otherwise you just need to connect the output to a voltage supply with a resistor. (I would probably use 10k, as I doubt that the downstream system needs much current) Note that you don't have to connect it to the sensor supply voltage, you can use any other voltage that is convenient as long as they both share the same 0V reference (I am avoiding using GND for 0V reference as they are not necessarily the same thing. And Vee will just confuse matters). This means that a 24V supply NPN prox sensor can be connected to a 3.3V parallel port pin, if you are brave. -- atp "A motorcycle is a bicycle with a pandemonium attachment and is designed for the especial use of mechanical geniuses, daredevils and lunatics." — George Fitch, Atlanta Constitution Newspaper, 1912 _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users