python 8 channel relay
hello can some help to get a script to start learning how to us a 8 channel relay board i lock alle over the internet but i cant vind it can some help me
Re: python 8 channel relay
The software/hardware needed to control a relay board depends on the exact model you plan to use.
Do you have a relay board in mind?
Do you have a relay board in mind?
Re: python 8 channel relay
To confirm the operation please do the following (at your own risk!)
Leave the green jumper in place.
See http://elinux.org/RPi_Low-level_peripherals for pin numbering.
Connect 5V (Pi pin P1-2) to the left-most pin marked VCC.
Connect ground (Pi pin P1-6) to the pin next to VCC labelled GND.
A LED should light on the board.
Connect 3V3 (Pi pin P1-1) to a wire.
Connect the other end of the wire to IN1 to IN8 in turn. Each relay should operate in turn.
Leave the green jumper in place.
See http://elinux.org/RPi_Low-level_peripherals for pin numbering.
Connect 5V (Pi pin P1-2) to the left-most pin marked VCC.
Connect ground (Pi pin P1-6) to the pin next to VCC labelled GND.
A LED should light on the board.
Connect 3V3 (Pi pin P1-1) to a wire.
Connect the other end of the wire to IN1 to IN8 in turn. Each relay should operate in turn.
Re: python 8 channel relay
alle te relays are working but i still need a script to let it work wat is the best script code i can us to learn to make them my self
Re: python 8 channel relay
Connect one relay input wire, eg from IN1, to pin P1-24, as well as the 5v and ground you already have connected
Try this in python, started from the gui by
startx
Double click on LXterminal
Type in sudo idle and the press Enter
when the Python Shell window appears
Choose File
Choose New Window
when the new window appears
Type in the code below
Choose run
Choose run module
Save it when it asks
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(24,GPIO.OUT)
GPIO.output(24,GPIO.HIGH)
time.sleep(2)
GPIO.output(24,GPIO.LOW)
The relay should switch for 2 seconds
Try this in python, started from the gui by
startx
Double click on LXterminal
Type in sudo idle and the press Enter
when the Python Shell window appears
Choose File
Choose New Window
when the new window appears
Type in the code below
Choose run
Choose run module
Save it when it asks
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(24,GPIO.OUT)
GPIO.output(24,GPIO.HIGH)
time.sleep(2)
GPIO.output(24,GPIO.LOW)
The relay should switch for 2 seconds