This proximity Sensor is excellent. For my outside app, folks said I would get false detections from sunlight, etc. However, this detector modulates its output signal and will only confirm a reflection if the modulation matches. I have shown it directly into the AZ sun without getting false detections. One consideration is its output is either near zero or 5V, too much for a 3.3V MicroController. I'm inserting a combination Pull-up resistor and voltage divider between the detector and the processor.
Start with a 220k resister between +5 and the signal lead of the detector. Continue the "tree" with a 6700 ohm resistor to the (low active) GPIO input of the processor. Then, finally connect a 22k resistor from there to ground. The processor will see either nearly 0 or 3.39V, both within the safety range. (I have a schematic drawn, but I don't see how to attach it)!
A little lost with your description but you have a max of 5.0 volts from sensor either a True or False (0.0 volt). I would just run with a 2:1 simple divider. Since you mention 220K I would use a pair of 220K resistors like so or a pair of 10 K resistors.
With 5.0 Volts Applied Vout is 2.5 volts which should be a logic high (True) on your uC. Why do you want a pullup in the mix?
Yes, only a 2-resisor divider will do.
5volt and 3.3volt is a 3:2 ratio. Pick two resistors with that ratio.
R1 = 1k and R2 =2k (2k2) is common for high speed applications.
Could increase that 10x for low speed and/or short wiring.
Data could be corrupted with high resistor values and high bitrates.
Leo..
Edit: Didn't see the previous thread.
An NPN sensor doesn't need a voltage divider, so this and the previous post are irrelevant.
You have wasted out time. Thank you..
The pullup is specified by the manufacturer. Without it , the resultant output voltage drops a little to 3.3 from 3.47V in my test setup. That is consistent with the manufacturer saying it's TTL output, but not with them specifying a 10k pullup. They did not say "open collector" which is what I would expect to work with a pullup.
Subsequently, I took a suggestion and looked at Level-shifting circuit modules. They would be simpler for my case of needing 4 shifts in one application. One version does not have a ground connection for itself as long as both logic level sides share a common ground. And they are cheap!
Using smart IR Proximity Detector E18-D80NK-ETC outdoors. This detector is very sensitive to its own beam, but ignores almost all other light (even direct AZ sunlight). However, it operates at 5V and is advertised to be TTL output. However the data sheet examples all have a 10k pull-up resister on the signal (output) lead. I'm using a three resister "tree" to keep 5V out of vulnerable inputs of 3.3V devices. From +5 to Detector output is 220k. From there to 3.3V input it's 6.7k. From there to ground, it's 22k. Much simpler than the use of level shifting ICs.
According to this data sheet and this one the output of that sensor is open collector NPN, which is quite common for such sensors.
If so, you need only one pullup resistor to 3.3V to interface it with a 3.3V device. That could even be the internal input pullup resistor on Arduino, specified by pinMode(pin, INPUT_PULLUP).
Your two or more topics on the same or similar subject have been merged.
Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.
Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.
Repeated duplicate posting could result in a temporary or permanent ban from the forum.
From the spec page:
"and a 10K Ohm resistor between Brown and Black."
Which tells me that this is an open-collector NPN sensor.
My pea-brain tells me that you don't need a resistor or voltage divider or level shifter.
Measure the output of the sensor with just 5volt/ground connected to the sensor.
No resistor, no Arduino.
If the output is 0volt and stays 0volt, then it's an NPN sensor.
If so, then you can connect the output directly to the 3.3volt-logic pin.
With internal pull up enabled. pinMode(sensorPin, INPUT_PULLUP);
If... you get false triggers from noise pickup from a long wire, then you could add a 10k resistor between Arduino pin and Arduino 3.3volt VCC, and/or a 10-100n capacitor from pin to ground.
Leo..
Thank you. The first datasheet that you referenced is the one that got me confused. Note in that circuit diagram the 10k resistor labeled "Pull-up" is in series going to D5.
However, another published data sheet (IR Sensor Switch E18-D80NK-N-ETT) specifically says the output is TTL. Hence my confusion. Further, the DEVMO brand sample I bought from Amazon with +5 to the detector V++ and only a 10k PU to 3.3V yields 4.7V out when IR reflection is absent, which is consistent with TTL output rather than Open-Collector NPN.
Button line, different outputs by different manufacturers.
I hope this clears things up, and I will be looking for a model that has Open Collector output going forward.