Thanks, everyone, for your input. I’ll address a couple of responses that I missed before.
I guess it has to do with what the counter is for. Where the count will be used and what it is counting. But however I guess the OP knows how to do all that and that's why he does it that way he only asked us for the connection between the sensor to the RPi.
BeBuLamar, Apologies for missing this… My project is embarrassingly simple. I want to make a production machine surveillance system. The first step will be to use the sensors I’ve shared here previously to count production pieces. I want to count input with one and output with the other. Then, with some basic programming I can determine the % waste (raw material). If that all goes well, I’ll add another sensor at a different location in the process for greater insight. With two sensors in place, it will tell us a lot about our process. Adding the third would be a bonus!
You are correct, my biggest struggle is getting the sensors hooked to the RPi and working properly.
That will be 50 edges per second, for the PI this is no problem.
If you use my schema leave out the capacitor, then it can go up to several thousands of edges per second. (not that the PI can handle this in standard mode)
Benno
Thank you, BennoG. I read somewhere that the Pi can handle the number of units we are producing and I've seen these sensors work in a different type of system. I'm just not knowledgeable enough to put it all together and make it work. I appreciate all the feedback! My next hurdle is learning what your schematic is telling me to do. I don't know how to read it. I think it's telling me that brown and blue are power and ground coming from the power supply. From there, I'm struggling. I Googled some things but I don't understand what it's telling me yet. I'm getting closer. I'll write back when I think I have it.
NPN output, 4.7K resistor from output to +3.3V (get it from the Pi) and things will probably work out fine. Just make sure the sensor power supply ground is connected to the Pi logic ground.
Looking at the sensor datasheet, I'm now sure how you are going to use this sensor. You could use 10V and connect the 'Load' outputs to an opto-isolator. You will need to calculate a series resistor based on the opto LED current and the sensor voltage. The output will be a totally isolated open collector transistor (NPN is likely). Then pull the GPIO pin to ground with a 4.7k resistor to +3.3V from Pi.
Where things are going to come off the rails is writing the code for the Pi. If your signal has a slow rep rate, an application program might be written to detect a changing edge and do some kind of counting. But, under Linux, you can't count on finding every edge but you can count on missing them.
Your signal would ideally generate an interrupt on the falling edge forcing the code to immediately branch to an interrupt handler to do the counting. I don't know how to write interrupt handlers for Linux. I DO know how to do that kind of thing for bare metal. If I was going to output the count directly with no other outputs to the world (like Ethernet) then any other processor could do the job. Easiest might be an Arduino with interrupt driven code. My favorite would be the mbed LPC1768 with the Teensy 4.1 a close second and a much faster device. Both can handle concurrent networking.
Before you lock yourself in to the Pi, make sure you know how to generate an interrupt on the falling (or rising) edge of the input signal and capture the change with interrupt handler code.
If your rep rate is low, the Pi code can just loop waiting for a change. I don't know how low.
Maybe this will help:
https://roboticsbackend.com/raspberry-pi-gpio-interrupts-tutorial/
Thank you for your input, rstofer. There is quite a lot here that I don't understand. The list is growing rather than shrinking. A couple of terms you shared have come up before but I need to do more reading on them such as, opto-isolator and interrupt handler. Also, when you mention
slow repeat rate am I wrong to assume you are referring to the number of units the sensors will count, such as per minute or per second? I'll be counting up to 1600 per minute. To me that seems fast but I don't have a reference.