CODE UPDATED - it was incorrect on the OP:
Greetings fellow Particle People! I am in desperate need of some assistance from the community for my garage door project others have made look so easy. I’ll thank you in advance!! I’ve laid out my request for help in two parts…Questions without detail and questions with detail:
- I have already setup my Spark/Particle Core and it is operating correctly.
Questions without the details
(1) Where do the two garage wires go into the relay board?
(2) Where do the two wires from the reed switch come from (COM/NO or COM/NC)?
(3) Where do the two wires from the reed switch go into the relay board (COM/NO or COM/NC)?
(4) When coding the software, do I simply bring the Relay Board and IFTTT libraries in and flash the Spark/Particle?
Desired State: Operate my single garage door using IFTTT, by way of the Spark Core and Spark Core Relay Board.
Products being used: (1) Spark Core module (1) Spark Core Relay Board (1) Standard “reed switch” (can be wired to NO or NC)
**Please note that the Spark Core items were replaced by the Particle Core and I understand they operate if not exact, very similar to the Partcle Core. I’m just ruling out that as a possible issue. Photos are included with the questions below:
Here is what is (not) going on:
I have been reading several other members’ tutorials on building a garage door opener with the Particle, some have used various means to operate. Personally, I like the IFTTT route as we use this in our household with other projects. That said, I’m having the hardest time trying to figure out how to wire and code my project.
Hardware/Wiring:
(1) From my garage door button on the wall, there are two wires…red and white. I understand that these are just signals and need to go into one of the four relay “pods” (green in photo). Do I wire into COM/NO or COM/NC? (first and second pictures)
(2) From the “reed switch”, there are two wires…red and white with an option to wire COM/NO or COM/NC. Which of these combos should I wire into? Do they go into the relay and if so, to COM/NO or COM/NC? (third picture)
<img src="//cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex026/uploads/particle/original/2X/4/4ea744008a470c91c95c695587e77fe1c1c9ac5d.JPG” width=“375” height=“500”>
Coding/Software:
(1) Attached/below is the code from the libraries I am using. As I understand, I should bring in the Relay Board library, make a slight adjustment to indicate it’s the Spark Core Relay Board, save, verify and flash. However, doing that, I don’t get any response from the Relay Board, just the Spark which is responsive. The relay board is getting power and appears to be working correctly.
// This #include statement was automatically added by the Particle IDE.
#include "RelayShield/RelayShield.h"
// Create an instance of the RelayShield library, so we have something to talk to
RelayShield myRelays;
void setup() {
// .begin() sets up a couple of things and is necessary to use the rest of the functions
myRelays.begin(2);
// Use myRelays.begin(2); if you have the square, white RelayShield (from the Core)
// to use, just add a '2' between the parentheses in the code above.
}
void loop() {
// If relay1 is on, then turn it off
if(myRelays.isOn(1)){ // myRelays.isOn(1) will return TRUE if relay 1 on and FALSE if it's off
myRelays.off(1); // myRelays.off(#) will switch relay # off
}
// If it wasn't already on, then turn it on
else{
myRelays.on(1); // myRelays.on(#) will switch relay # on
}
// Change it once a second
delay(1000);
}
I truly believe that everything is working properly, it’s just hooked up incorrectly. The hardware can’t read the incorrect software or the software can’t tell the hardware what to do. For whatever the reason, I am stuck right in the middle and would really appreciate some assistance! Thanks again in advance!
Andrew