I recently purchased a Sunfounder single relay board (https://www.amazon.ca/gp/product/B013GAGFOU) and am attempting to use it with my Pi. I have connected the board's GND, VCC, and SIG wires to Pi pins 2 (5V), 6 (GND), and 7 (GPIO 4), and created a basic script to test functionality:

import RPi.GPIO as GPIO
import time

pin = 4

GPIO.setup(pin, GPIO.OUT)

    while 1:
        GPIO.output(pin, GPIO.LOW)
        print "low"
        GPIO.output(pin, GPIO.HIGH)
        print "high"
except KeyboardInterrupt:

The expected result is the the relay turns on for half a second and then turns off. However, the relay is being turned on and not turned off at all, despite the pin being cycled.

Interestingly, the status LED on the board is always on.. it is on but dim when the pin is high, and on and full brightness when the pin is low. I'm not sure what I'm doing wrong, so any input would be appreciated.

1 Answer 1


The relay is sold for a 5V Arduino.

The description says it is triggered low so it will be ON when you output 0 (0V) and OFF when you output 1 (5V). But the Pi can't output 5V from a GPIO as it is a 3V3 device.

The relay may switch off if you change the GPIO to be an input.

  • Bit of a case of me not reading before I hit the buy button. Your suggestion of making it an input worked. Are there any concerns about doing it this way?
    – Timr
    Mar 26, 2016 at 19:20
  • @Timr I don't know. Hopefully someone with electronics knowledge will comment.
    – joan
    Mar 26, 2016 at 20:03

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.