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.

Milliways
62.8k33 gold badges114 silver badges228 bronze badges
asked Dec 27, 2021 at 9:53
1
  • 2
    Need a clear photo showing the connections made. Commented Dec 27, 2021 at 10:04

1 Answer 1

1

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!

answered Dec 27, 2021 at 10:22
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. Commented Dec 27, 2021 at 17:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.