Hello everyone,
So I got a residential garage door opener and tried using it on my commercial doors at the office. The opener works fine, it runs through an app and has never failed, but only does one function. since the doors use a key relay to open and close, it is two separate relays that close the circuit to the motor when the key is turned to either open or close side. My problem is that the control i bought can only be connected to one relay at a time.
For wiring the positives on the relays are looped together and the negative has to go on one of the negatives on the relays. When I looped the negatives it would go up and down and like crazy and stop shortly after.
My solution was to use an arduino to connect the second wire from the controller going to the relay. From here I tried to code something to recognize all 4 of my doors for a pin on the board and have those 4 inputs and two outputs for each(the open and the close). At first I tried a counter that would increase whenever the input detected current and would ouput through the open or close pin assigned to the number and door input where current was coming through. Since I couldn't get that to work, I decided to try a simpler method.
What I am trying to do is infinitely read current through the 4 pins for the doors (loop digitalRead) and then when current is detected it will run open one time and continue with the loop for reading the input. When current goes in again, it will run the close pin and then continue the loop for reading. It seems straightforward, but I am barely learning how to code and cannot get it. This code should work perfectly and not mess with the door when it is opened or closed still using the key mechanism, by what I think.
Last code I wrote got deleted after it didn't work and it gave up, but here is the base that is was built on.
SA and TX are the street names for the doors and O and T are just One and Two for the doors on each street, O and C are Open and Close.
int SAO = 0;
int SAT = 1;
int TXO = 2;
int TXT = 3;
int SAOO = 4;
int SAOC = 5;
int SATO = 6;
int SATC = 7;
int TXOO = 8;
int TXOC = 9;
int TXTO = 10;
int TXTC = 11;
void setup(){
pinMode (SAO, INPUT);
pinMode (SAT, INPUT);
pinMode (TXO, INPUT);
pinMode (TXT, INPUT);
pinMode (SAOO, OUTPUT);
pinMode (SAOC, OUTPUT);
pinMode (SATO, OUTPUT);
pinMode (SATC, OUTPUT);
pinMode (TXOO, OUTPUT);
pinMode (TXOC, OUTPUT);
pinMode (TXTO, OUTPUT);
pinMode (TXTC, OUTPUT);
char r1 = digitalRead (SAO);
char r2 = digitalRead (SAT);
char r3 = digitalRead (TXO);
char r4 = digitalRead (TXT);
const int PCO = 0;
const int PCW = 0;
const int PCT = 0;
const int PCF = 0;
}
void loop(){
}
Sorry for the mess of information and the way I structured it, hopefully someone can see this and help me. Thank you