OK. Subject says it all :-) I have to open 12 DC electric lock when someone send command from Android App to raspberry.
To do so i'm using saintsmart 2 relay board and 12VDC adapter.
formatting link
My question would be, what's the best way to connect this relay board to raspberry and to setup some "security fail system", if necessary ?
As far as i can see this board has all the necessery protection build on the board itself. So should i connect 12V power supply to VCC / GND pins of this board and one pin to GPIO ?
Guys, thnx for answers. Relay is working on 12V, that's why am asking. I know how to connect it but i want to know if i can hook up 12V directly to VCC / GND pins of the relay board ....
You keep writing "12V relay" but the links posted are to 5V relays. Actually I do not know if SainSmart has any 12V relays (other vendors have them, but I have no time to search trough SainSmart offer). Note 5V here means voltage used to drive relay. 5V relay can control much higher voltage: for example up to 30V DC or 250V AC. On 5V relay (the blue boxes) you will see something like SH-05DC (the 05DC part means that this is 5V relay). On 12V relay the 05 part is replaced by 12 V.
In general there are three different voltages with different grounds:
1) Control voltage for relay module with control ground. You need to connct control ground to Raspberry Pi ground and control voltage to GPIO. Note: this assumes that the relay is compatible to 3.3V signal from Raspberry Pi (SainSmart claims this, but I have no way tell if this claim is true).
2) Voltage for operating relays. If you have 5V relay you need to connect 5V here. If you really have 12V realy you connect 12V here. In better relays this circuit is sepatate from contol circuit. However, in most modules contol ground is connected to relay supply ground.
3) Controlled circuit. Here you usially have 3 connectors: middle gets connected either with left or right. You connect your lock here.
I have a similar looking 2 relay module from different supplier. On my module GND connection goes to GND on rapberry Pi and Vcc goes to 5V on Rapberry Pi (control groung and relay ground are connected). My module allows separate power for relay via RVcc pin, but the module is shipped with Vcc and RVcc lines shorted by a jumper so relays and control part gets the same 5V voltage.
Thnx for detailed answer. Yes the relay board has two 12V relays. Shortly, if i connect 5V relay board everything works OK but when i connect 12V ( ofcourse with 12V power supply ) relay isnt triggering anything.
I use the came code for both boards.. That's the main problem.
You need to look what connection your relay has. For 12V relay there should be separate connection for 12V power. There are few kinds of control circuits. Two popular types has transoptor connected is series with LED and resistor. If this trasoptor
LED + resistor circuit is connected between ground and input, then the relay is probably incompatible with RPi, such control circuit typically needs more than 3.3V to work. If transoptor
LED + resistor of is connected between 5V and input then the control circuit should work both from 3.3V logic and 5V logic. There are other kinds of control circuits, without detailed look at your module (or schematics) it is impossible to say which control circuit do you have.
Probably the easyest method to check what is needed by your relays is to leave RPi uncennected to relays and use a piece of wire to connect input to 5V and then to ground. If relay activates with 5V on the input then try 3.V on the input. If 3.3V also activates the relay then having RPi connected to relay and high should activate the relay, in such case you need to check if the code is doing so. If 5V activates the relay but 3.3V does not work, than you need different relay (RPi outputs only give 3.3V). If your relay activates with input connected to ground then it should also activate with RPi connected to relay and output low. Note that such kind of realy needs opposite polarity of control to compared to previous type, so you need to check your code. Also, relays active with control at ground level need 5V supplay to control circuit, while relay active at 5V level need ground connected to the control circuit. So depending on your relay you may have different conmections.
BTW: It is easy to check connections using diode check function on a multimeter, but if you know how to do this you would probably solve your problem without asking here.
Bottom line: first check you relay without connecting it to RPi output (of course you need 12V for relay and ground or 5V for control circuit). It is also possible that your
12V relay module is faulty -- likely so if controlling it from 5V does not give any effect when trying both possibilities.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.