1

I want to make a program that on and offs a 5v single channel relay through a raspberry Pi zero w.(setmode is bcm) I connected 5v pin (pin number 2), gnd (pin number 6) and gpio 17(pin number 11) to the VCC, GND and IN pins respectively. The code uses GPIO.HIGH and GPIO.LOW to control the relay during 5 second intervals(repeats 2 times). But when I run the program, it immediately ons the relay but only seems to off after the whole code is executed (i.e GPIO.cleanup). I tried replacing GPIO.HIGH and GPIO.LOW with True and false and also 1 and 0 l.

I have also connected the raspberry Pi zero w using vnc. For the power source I used a 5v 550mA output adaptor.

Mayo
  • 11
  • 2
  • 1
    You need to provide the full specs for the relay module you are using. – joan Sep 13 '23 at 11:11
  • I tried replacing GPIO.HIGH and GPIO.LOW with True and false and also 1 and 0 l. ... post the code instead ... copy and paste into the question, not into a comment ... please, no pictures of code – jsotola Sep 13 '23 at 17:36
  • 1
    I’m voting to close this question because it's not clear what the OP has done. – Seamus Sep 13 '23 at 20:16
  • Adding the used code would be helpful. There might be a simple error, but since we cannot see it we can only guess. – wovano Sep 13 '23 at 20:24

1 Answers1

0

What "relay" - there is no relay you can control from a Pi without additional circuitry.

If it is one of the dodgy modules you find on the internet see Can you use a 5V Relay Module with the Pi?

If you connected one to your Pi you may have damaged the Pi.

Milliways
  • 59,890
  • 31
  • 101
  • 209