Skip to content

Instantly share code, notes, and snippets.

@satishgunjal
Last active January 30, 2019 14:55
Show Gist options
  • Save satishgunjal/b94a52ddcbd105d13783e0b5ff36c527 to your computer and use it in GitHub Desktop.
Save satishgunjal/b94a52ddcbd105d13783e0b5ff36c527 to your computer and use it in GitHub Desktop.
Relay board with high level/ low level trigger selection
Most relay boards are 'ACTIVE LOW' which means: 0 or LOW (0V) = Relay ON, 1 or HIGH (3V3) = Relay OFF.
Some relay board have high and low level trigger mode selection. We can use jumper pin to select the mode the mode.
If low level level trigger mode is selected then Relay on will occure for control signal 0 / false / ground
If high level trigger mode is selected then Relay on will occure for control signal 1 / true / 3V3/ Vcc or Vdd
Ref. https://robu.in/product/songle-single-channel-5v-30a-relay-module-power-failure-relay/
Above 5V 30A relay module has trigger mode selection. I have tested it with Low level trigger mode only.
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(05, GPIO.OUT)
GPIO.output(05, GPIO.HIGH)
GPIO.output(05, GPIO.LOW)
print "Relay on for 5 sec"
time.sleep(5)
GPIO.output(05, GPIO.HIGH)
print "Relay off for 5 sec"
time.sleep(5);
# Reset GPIO settings
GPIO.cleanup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment