Pages: [1]   Go Down
Author Topic: Ardunio relay module wiring  (Read 3162 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!

I'm looking at using one of these relay modules to control switching a mains powered air freshener on/off:

http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=320654392812&ssPageName=ADME:X:AAQ:GB:1123

Unfortunately the logic of the module seems to be the opposite of what I want (it seems like it's acting normally closed, whereas I want it normally open). After mucking around with a transistor, I somehow came out with the following circuit to act as a kind of logical NOT gate (please excuse my lack of ability with Fritzing - also, the 'servo' is actually the servo style connector leading into the relay module!):



Can anyone explain why this works? I'm not entirely sure why....

And also, can anyone see anything dangerous with how this is wired up? The air freshener draws super low current, so the G5LA-14 relay should handle it, and I'm presuming that the module isolates the Arduino/breadboard sufficiently (it looks like it has a requisite diode for back EMF, etc). I'm not looking to hold anyone accountable should I blow up myself and burn my house down, I just want to double check I haven't missed anything obvious!
Logged

0
Offline Offline
Shannon Member
****
Karma: 162
Posts: 10496
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You appear to have an NPN transistor with its collector at the most negative potential in the circuit - that doesn't look right.
Logged

[ I won't respond to messages, use the forum please ]

Red Sea, Saudi Arabia
Offline Offline
God Member
*****
Karma: 11
Posts: 579
..On The Red Sea
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry: WRONG:

Your relay seems to have only one available contact.  Still don't "expect" it to be normally closed. Check on DFRobot site!

---( Wrong solution)---
Simple solution: the relay has both "Normally open" and"Normally closed" contacts. Rewire it for Normally Open...
See: http://arduino-info.wikispaces.com/Brick-1Channel-Relay
« Last Edit: March 29, 2011, 08:36:10 pm by Terry King » Logged

Regards, Terry King  ..On the Red Sea at KAUST.edu.sa
terry@yourduino.com  LEARN! DO! (Arduino Boards, Sensors, Parts @ http://yourduino.com

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Aha! Found a wiki page on the module here, with a relevant code example:

http://www.dfrobot.com/wiki/index.php?title=Relay_Module_(Arduino_Compatible)_(SKU:_DFR0017)

So a high voltage will indeed open the relay/switch it off. Am I just being stupid with faffing with transistors to invert the state of the digital output - should I just invert the logic in the Arduino code? I'm guessing this will mean that the relay will be closed during Arduino boot up time (as power will be flowing to it and the digital output controlling it will be low), but this shouldn't be a problem in this application...for future reference, is there a way around this?
Logged

Red Sea, Saudi Arabia
Offline Offline
God Member
*****
Karma: 11
Posts: 579
..On The Red Sea
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey, that relay DOES have both Normally-open and normally-closed connections although the DFROBOT page doe not show the exact connections  Grr....

Just operate the relay and check the connections. I think you're all set....

See: http://datasheet.octopart.com/G5LA-14-DC12-Omron-datasheet-134281.pdf


This is a Single Pole Double Throw relay with both Normally-open and normally-closed connections.
« Last Edit: March 30, 2011, 10:18:58 am by Terry King » Logged

Regards, Terry King  ..On the Red Sea at KAUST.edu.sa
terry@yourduino.com  LEARN! DO! (Arduino Boards, Sensors, Parts @ http://yourduino.com

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 514
Posts: 31543
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
should I just invert the logic in the Arduino code
Yes every time providing the arduino can stand the load.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks very much for the help guys, much appreciated smiley

So, just taken a look at the module - unless I'm mistaken, it sadly doesn't look like it's possible to do NO operation with it. If you take a look at the PCB traces:



And compare with the datasheet:

http://datasheet.octopart.com/G5LA-14-DC12-Omron-datasheet-134281.pdf

Pins 1 and 3 of the relay are hard-wired to the outermost contacts of the module, and the inner most contacts on the module are hard-wired to each other. Here's the view from the top for comparison:



As I understand it, switching the relay on swings the connection from pin 3 to pin 4 of the relay, opening it. It doesn't look like pin 4 is connected to anything to me...

Unless I'm talking nonsense - there's a strong possibility of that, mind.. smiley-wink

If this is the case, I'll rewrite the logic of the Arduino code to send the output "low" when I want to switch the air freshener on - annoying to have power blips on start up, but it'll have to do for now..

EDIT: In fact, I was talking nonsense about 'power blips' - have the appropriate pin set to high in setup and it seems to be seamless! Lovely. smiley
« Last Edit: March 30, 2011, 03:02:59 pm by stikeymo » Logged

Red Sea, Saudi Arabia
Offline Offline
God Member
*****
Karma: 11
Posts: 579
..On The Red Sea
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I bet DFRobot didn't intend to do that....

This one gives you both options: http://arduino-direct.com/sunshop/index.php?l=product_detail&p=49

« Last Edit: March 30, 2011, 03:13:19 pm by Terry King » Logged

Regards, Terry King  ..On the Red Sea at KAUST.edu.sa
terry@yourduino.com  LEARN! DO! (Arduino Boards, Sensors, Parts @ http://yourduino.com

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, it seems like an odd design choice to limit users like that. Thanks for that - I'll buy one of those next time!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi there,

I'm a total newbie in electronics, but I want to learn. I'm a software developer.

I bought the follow relay module http://cgi.ebay.ca/5V-4-Channel-Relay-Shield-Arduino-Electronic-DIY-/110648585724?pt=LH_DefaultDomain_0&hash=item19c32b6dfc#ht_1351wt_1139.

I thought that I knew how the basics of relay worked, i.e. put a small voltage and it close/open a switch. But nothing seems to work.

I have connected the VCC and the ground to the board and connected K1 to pin 13. Now let say for testing purpose I want to make a led blink from the relay, where do I plug the cables?

Thanks
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16548
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
have connected the VCC and the ground to the board and connected K1 to pin 13. Now let say for testing purpose I want to make a led blink from the relay, where do I plug the cables?

Well all that wiring just powers up the relay board and allows the relay's coil to be turned on and off by pin 13. You should be able to hear the relay click on and off if you just use the standard pin 13 blink sketch. Check that out and tell us if you hear a one second click and then we can talk about how to wire a circuit to be turned on and off by the contacts of the relay.

Lefty

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, I realized that the relay 1 and 3 were defective  smiley-confuse. Well, there is no clicking sound from them. I'll test them later directly with their pins. After all, I'm not that dumb.
Logged

Pages: [1]   Go Up
Jump to: