1

So I am using a Raspberry Pi Zero to detect the signal from this NPN Inductive proximity sensor (its input supply range is 6 to 36V and the signal pin to output the same amount of voltage which we give as input).

The input supply of the proximity sensor is 6 volts from a step-up converter. Its output is also 6V, which is connected to a voltage divider made from resistors to bring it down to around 3V.

This 3V is then connected to a GPIO pin on the Raspberry Pi Zero, but it just doesn't detect it. The pin stays on "low" no matter what.

This 3V is then connected to a GPIO pin on the Raspberry pi zero but it just doesn't detect it. The pin stays on low no matter what.

The code I am using is this

import RPi.GPIO as GPIO
import time

p = 7

GPIO.setmode(GPIO.BCM)
GPIO.setup(p,GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

print(GPIO.input(p))

while True:
    #print(GPIO.input(p))
    if GPIO.input(p) == 1:
        print('Input was HIGH')
    else:
        pass
        time.sleep(0.5)

I've tried changing the GPIO pin multiple times, but no result. I've also connected a 4x4 matrix keyboard and an LCD to the pi. Those work fine, only this Inductive proximity sensor is creating issues.

Please help. Any help is appreciated, I really need to complete this client's project om time.

1
  • 2
    Need a clear photo showing the connections made.
    – joan
    Dec 27, 2021 at 10:04

1 Answer 1

0

It is solved now. The issue was that the step-up converter was unable to provide enough current. So I used another device for powering it and it works. Peace!

1
  • Congrats, but it seems a bit odd that simply connecting the GPIO pin to the sensor would add enough loading on the 6V supply to reduce its output voltage.
    – Seamus
    Dec 27, 2021 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.