Inaccurate IR Sensor Reading

How can I achieve this? By that I'm more talking about the wiring, since all the ones I found have single, female plugs as this one:

image

Can you guide me further on the wiring?