Relay integration
#17
(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)

Unless one of the GPIO pins always starts up in a state that is usable as an 'off' state and stays that way until your python code can take over (which I wouldn't personally rely on), you're going to be out be out of luck. The pine64 is not suited for direct control of something like this, and needs a bit of help. Since it is a full blown computer, it has the inherent problem of things like the GPIO pin state being unreliable until they are initialised, it taking while for it to start up if it is powered down or reset, and the odd crash. So either it is better to use secondary boards that are intelligent enough to be able to wait for the pine64 to initialise / or can confirm/verify an command before doing something to make sure it's not a false trigger. Last thing you want is for the board to crash and in doing so... open your garage door for whoever wants to wander in...

 To do the sort of thing you want to do, I would be considering using something like an 3v Arduino Nano to do the actual relay control (you can buy cheap clones for around $3 on eBay). This means you would have a chip/board that is dedicated to driving the relay. One way to get the two to communicate could be to connect the serial of the pine to the serial of the Arduino, meaning you could send a message via the serial to instruct the Arduino to trigger the relay on or off, and the Arduino could confirm that back. If invalid data goes over the serial to the arduino, it can just ignore it as it isn't what it's waiting for. 

You might also have override switches on the Arduino for 'manual control' if the pine64 crashes and you just want to open/close the door. You can even take it a step further, and have the Arduino monitor the pine64 for a regular heartbeat, and if it doesn't see it, trigger a reset (basically a software emulation of a hardware watchdog timer).
  Reply


Messages In This Thread
Relay integration - by vigor - 08-15-2016, 06:08 PM
RE: Relay integration - by jl_678 - 08-17-2016, 03:48 PM
RE: Relay integration - by MarkHaysHarris777 - 08-17-2016, 04:22 PM
RE: Relay integration - by vigor - 08-21-2016, 09:37 PM
RE: Relay integration - by pfeerick - 08-22-2016, 03:27 AM
RE: Relay integration - by MarkHaysHarris777 - 08-22-2016, 07:40 PM
RE: Relay integration - by vigor - 08-22-2016, 08:41 PM
RE: Relay integration - by MarkHaysHarris777 - 08-22-2016, 09:21 PM
RE: Relay integration - by Boring - 08-22-2016, 10:11 PM
RE: Relay integration - by MarkHaysHarris777 - 08-22-2016, 10:20 PM
RE: Relay integration - by Boring - 08-23-2016, 12:35 AM
RE: Relay integration - by pfeerick - 08-23-2016, 06:11 AM
RE: Relay integration - by MarkHaysHarris777 - 08-23-2016, 12:50 AM
RE: Relay integration - by MarkHaysHarris777 - 08-23-2016, 06:57 AM
RE: Relay integration - by vigor - 08-25-2016, 01:17 AM
RE: Relay integration - by MarkHaysHarris777 - 08-25-2016, 01:42 AM
RE: Relay integration - by pfeerick - 08-25-2016, 06:53 AM
RE: Relay integration - by MarkHaysHarris777 - 08-25-2016, 11:07 AM
RE: Relay integration - by vigor - 08-25-2016, 03:30 PM
RE: Relay integration - by MarkHaysHarris777 - 08-25-2016, 08:35 PM
RE: Relay integration - by pfeerick - 08-25-2016, 09:48 PM
RE: Relay integration - by MarkHaysHarris777 - 08-25-2016, 09:58 PM
RE: Relay integration - by vigor - 09-04-2016, 03:25 PM
RE: Relay integration - by pfeerick - 09-05-2016, 12:27 AM
RE: Relay integration - by MarkHaysHarris777 - 09-04-2016, 09:00 PM
RE: Relay integration - by MarkHaysHarris777 - 09-05-2016, 11:33 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)