08-25-2016, 01:42 AM
(This post was last modified: 08-25-2016, 01:43 AM by MarkHaysHarris777.)
(08-25-2016, 01:17 AM)vigor Wrote: Alright, the relay via GPIO project works, my python code attached at the bottom, one anomaly i noticed just now, whenever i power cycle or turn on the pine64 board, it triggers the relay, which is obviously a bad thing because my relay triggers the garage gate to open or close.
so then if power blips - my garage gate will open.
Any idea how to prevent GPIO blips on boot or on power on ?
my python code (no rocket science, and based on relay rpi lab):
import RPi.GPIO as GPIO ## Import GPIO library
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(15, GPIO.OUT)
GPIO.output(15,False)
time.sleep(4)
GPIO.output(15,True)
You have to have a two or three level AND condition; the relay must never be connected to just one GPIO pin, not directly anyways. You must have fail safe protocols in place... its a more complex project than you anticipated.
Another thing you can do is to place a power control circuit in-line with the relays so that when the power blips the relays do not get power until a set duration of power ON time... allowing your PineA64 board to initialize and do a full POR (um power on reset). This also is more complicated than it at first appears.
Lastly , you need to have more than one control board running... at least two, but maybe three. The purpose is that there is a closed loop of control structures which can 'watch' each other; for redundancy and for backup. At least two have to agree before an action is taken.
its just not as simple as turning a GPIO pin on and off.
edit: and PS... I hope you have your control system on a good UPS (uninterruptable power supply)
marcushh777
please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )
please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )