I have been playing around with the Arduino for a little while now. I have acquired all the parts I need to make my first real project, a wifi garage door opener, which will be operated from an iPhone app (already developed).
I am not very experienced in electronics and circuits and am running in to difficulties getting my relay setup. Here are the parts I am using:
I have followed a few guides but cant seem to figure it out. The relay is really the only thing different from the other guides. The relay I am using has 8 pins (ground, 5v, COM, NC, NO, COM, NC, NO) rather than the typical 6 that are in most guides. I have tried a lot of different things pretty much guessing at what to do when it comes to the relay wiring.
I have been testing by trying to switch an LED on and off. Tonight, I made the LED stay on constantly, but then switch off and then back on through the app. So it was reverse of what it should have been doing.
If you look at the data sheet the coil is on pins 1 and 16, connect say pin 1 to 5v and pin 16 to the collector of the transistor.
Then use one of the NC,NO,C groups (I can't make out the pins #s, but use 3 pins on one side) the same as in the flickr drawing and ignore the other pins.
From what I can see on that data sheet pin 16 is the - of the coil so yes if you were just using a couple of wires then pin 16 goes to GND and pin 1 would go to 5v.
The transistor is like a switch inserted into the wire between pin 16 and GND. Therefore when the transistor is activated pin 16 is affectively switched to GND by the transistor.
Oh, I think I understand now. So would I just have another wire coming off the collector going to the COM pin to switch the relay? So in total off the collector I would have pin 16 (- on the coil) and pin COM.
Also, im confused on how to hook up the relay to the garage door button. I have 2 wires on the garage door button. I measured one and it reads around 9VAC, and the other reads nothing (as it should). Im not exactly sure how to hook these up. I ended up frying my Ardiuno last night trying different things so I thought I should ask before I try anything again.
Sorry if this is all basic knowledge. For whatever reason I am having an incredibly hard time understanding circuitry.
So would I just have another wire coming off the collector going to the COM pin to switch the relay?
Nope, NC, NO and COM have nothing to do with controlling the relay in your case. All you have is
5v --- plus coil minus --- C transistor E --- GND
I have 2 wires on the garage door button.
Do these wires come form the back of the controller's switch? Are you saying that when you touch these two wires together the door operates?
If this is the case then connect one wire to COM and the other to NO. When the transistor is activated the relay will connect NO to COM the same as if you touched the wires together.
Wow, I think its clear now. My understanding of the relays was completely off. I thought that I had to have the arduino controlling the COM pin. I will try this once my new arduino comes in.
Edit: Ignore this last question. I understand whats going on. The diode on the 5v is protecting the rest of the circuit from the brief high voltage when the coil is switched off.