driving a relay with the Propeller
gio_rome
Posts: 48
Hi,
(I'm a little new to this)
I'm to set up a PCB board with a Propeller that drives a relay that ons or offs a current.
This is the Relay I'm to use:
http://www.abra-electronics.com/products/MR009%252d001.1-Relay-Module.html
I think I understand that I will connect an IO Propeller pin to the Relay IN pin. The Relay of course is already connected to +5V and GND sources.
With this Propeller IO pin - Relay IN pin connection I think I will simply set the OUTPUT level of that Propeller pin HIGH or LOW if I want to activate or deactivate the Relay...
Did I undestand it right?
Thank you,
G.
(I'm a little new to this)
I'm to set up a PCB board with a Propeller that drives a relay that ons or offs a current.
This is the Relay I'm to use:
http://www.abra-electronics.com/products/MR009%252d001.1-Relay-Module.html
I think I understand that I will connect an IO Propeller pin to the Relay IN pin. The Relay of course is already connected to +5V and GND sources.
With this Propeller IO pin - Relay IN pin connection I think I will simply set the OUTPUT level of that Propeller pin HIGH or LOW if I want to activate or deactivate the Relay...
Did I undestand it right?
Thank you,
G.
Comments
Arduino is 5V Propeller-Chip is 3.3V this might be to less for reliable switching. In this case you would have to insert a driver-chip
which can drive the output high to 5V with an inputvoltage of 3.3V
Recently I had to to this drive a 5V-input from 3.3V and had only a 74HCT125 handy. This chip does the job but isn't the best choice for this.
If you have the relay already - make a test with 3.3V on the input pin.
$8 is pretty much for switching a current on/off.
What kind of current AC/DC and how much Ampere are you switching?
Maybe a solidstate-relay fpr $3 or a MOSFET for $2 will do the job too.
best regards
Stefan
It seems you are right. I'm not able to drive this relay. The output is 3V and this relay is TTL compliant, although TTL states that HIGH should be between 2.6V and 5V. Well never mind
[FONT=Helvetica, Arial, lucida grande, tahoma, verdana, arial, sans-serif]I'm now trying to rise up the signal using this logic level converter, what do you think?
[/FONT]https://www.sparkfun.com/products/12009
Regarding your other suggestions, I'm now trying to switch 1,4A normal current to a maximum of (I think) 5A. I have no experience of setting up solidstate relay or Mosfet, although I've used some. Can you direct me somewhere?
Thank you again
G.
That module has an optocoupler which looks like it needs to be driven high so it doesn't matter that you are driving it with 3.3V rather than 5V although TTL outputs are more like 3.6V anyway. The output of the opto feeds a transistor which is switching the coil however the coil does need 5V.
So you can connect the IN signal straight to the Prop at 3.3V but the 5V input will need to be 5V.
BTW, there are easier ways to switch 5A but at what voltage? AC/DC?
An NPN transistor (2N2222 for instance) should be able switch this, I would think.
PNP transistor would be similar, but different. *diode across the relay coil may not be necessary if relay already has one, or is otherwise isolated
Contrary to what has been discussed in this thread I looked at the picture of the module on the datasheet and it showed the input opto with the output going to a drive transistor, so this is not an issue about "drive level" per se but about coil voltage which is rated at 5V and this level is provided by a separate '+5V' pin from the 'IN' pin. The relay coil may not be able to pull-in with only 3.3V on the +5V' pin. The Prop pin is effectively driving an LED so there is no concern about the level from that end and besides "TTL compatible" implies 3.6V logic highs. OP would have the same problem even if he drove it with more than 5V but still only had 3.3V on the "+5V" pin.
thanks for the reply.
Now, the relay is fed with +5V and is grounded correctly. Then, for the "IN" pin a +3.04V HIGH level is provided. Since it does not seem to be working, I think maybe that's not enough?
That +3.04V HIGH level (with respect to 0.04V LOW level) is provided with an output pin from the Propeller chip (the 18th, exactly).
I
but nothing happens...
what should I be checking, IYO?
tnx
G.
given the product I'm using, of whose characteristics I'm unaware, what should I be connecting to what?
I have problems in understanding what the coil ports really are i.e. where should I be conncting the current ends I want to switch.
:-(
tnx
G.
This is the photo I looked at on the useless datasheet (no schematic, specs 14ma but doesn't state drive voltage etc)
R1 controls the current through the 357 optocoupler which will have a voltage drop of 1.2V or so and it looks like R1 is 270 ohms so that means 3V (your figure) - 1.2V = 1.8V / 270 = 6.7ma. The 14ma they quote can only come from supplying a full 5V into the IN pin. I would change R1 or even short it out or bypass it and use an external resistor of R = V/I = 1.8/14ma = 120R instead.
The output of the opto sources directly into Q1 (NPN?) with R5 as a 3K3 to ground. Q1 could be a digital transistor (code = 12W ?) with it's own current limit but either way it should handle the relay fine.
EDIT: This seems to be a 2N7002 MOSFET which explains it all but once again, it should work fine.
As for your code I can't really see a problem but you could always put an LED+resistor across the I/O to check that it flashes.
They mention 'galvanic' isolation but the circuit doesn't provide isolation both on power and ground.
So how can power be isolated, and ground not, yet still provide ground loop protection?
.. And why am I the noob pointing this out, when the pro's should be jumpin my train?
+5V goes to the coil, it's ground is the same as the signal ground as the signal is normally +5V but since it's only a matter of current we can change R1 and drive it straight from the Prop. The contacts are "galvanically isolated" from the signal and +5V.
So just because they use an optocoupler that doesn't mean that that is the galvanic isolation mentioned, or even don't be surprised if whoever put it together isn't perfect as the optocoupler doesn't really help much at all, it just needed the transistor
Facts:
There are only 3 pins to control the relay.
1. IN
2. +5V
3. GND
Therefore the GND is common both to the signal AND to +5V so the opto is redundant. Sometimes people think they need an opto or they include one to make the design appear superior to what any newbie could cobble together themselves. So people buy them believing they have a better product, fact.
EDIT: posting this just in case "galvanic isolation" is misinterpreted
my approach is functional, not engineering.
if you want, if you can, you could simply redraw it with a paintbrush or so and post the pic....I'm really sorry to be that naive, but I'm kind of new to this kind of electro-technics...
G.
1) led+ resistor connected to the propeller pin: it works
2) i simply tried connecting the +5V to the IN pin of the relay: it works
3) tester measurement of that IN pin voltage: 3.22V HIGH, 0.5v LOW.
so it is clear that simply +3.22V it's not enough for the switch to occur...Peter sorry but I didn't quite get your point in all the analisys you performed on the breakout...I actually thought you implied that +3V should have been enough...
(more to come -> I actually want to draw myself what I unsurely get from abcedarian ASCII sketch...and see if he concurs...)
I think the only way I have is to use some operational amplifier to rise the +3V to +5V...I have to devise a schematichs, or maybe understand abcedarians suggestion
(more to come)
3V is more than enough IF YOU CHANGE R1 from 270R to 120R using any of the methods I have previously outlined.
I really don't think you are reading all the information that you have been given, you simply cannot gloss over it and miss the point again and again and again. You may end up finding it hard to elicit help in the future.
BTW, You could just remove R1 and connect the bottom right-hand pin of the opto, the one with R5 and connect that directly to the IN pin. This means that the Prop just drives the logic level MOSFET instead of the redundant opto. Either way is very very easy, if you actually do it.
G.
Yes I do believe we are patient. I think if you put 1/10 of the time that it takes us to prepare and answer your post into actually doing something rather than leaving it to "try tomorrow" you will have it working.
Here is a schematic that I deduced from the pictures, the second version shows how very very simple it would be to drive the logic level MOSFET directly bypassing the useless opto. Alternatively you could just change/bypass R1 so that you end up with 120R instead.
Therefore, if it requires 5v to turn it on, the Propeller has to give that pin 5v... somehow, but that's difficult to do considering the Prop doesn't work at 5v levels, hence the transistor thing.
I think your diagram above would work IF you connect the transistor collector to 5v and the emitter to the "IN" on your module.
And I think it might be beneficial to know the definition of my user name, which is, as I intend, a beginner in any field of learning / knowledge.
So I try not to pretend I know everything about anything. But sometimes I fail at failing.
You're getting it wrong, it needs sufficient current to drive the LED of the opto which is directly related to the voltage and resistance. For 3.3V drive you simply lower the value of resistance to 120R to achieve the same result. All these "boost" schemes are totally missing this basic fundamental understanding of a simple opto circuit which btw is also implemented incorrectly so that the opto ends up serving no useful purpose itself due to the fact that the signal ground and +5V ground are the same.
Gio_rome, if there's no compelling reason to use that $8 board, then don't. Stop trying to force it to work with modifications or transistors, and simply build your own circuit. Peter even created a schematic for the wiring and components.
Chris
In defence of my earlier post, I've never encountered a TTL device that refused to work with a Prop.
My first impression was simply driving a relay with the Prop, so transistors, either way, would have been prudent. Once I realized it was a 'module' that tried to do its best to work, I didn't have much else to offer.
Still, a PNP with a resistor on the base to the Prop and driving the "IN" of the module would be my choice. It might be overkill but I'd rather smoke a cheap transistor or the relay module than a $9 USD Prop chip.
I haven't found anyone selling "magic smoke refill kits" on Ebay.
Overall, it's all good, and we all learn something along the way.
long time no see. I've been busy thinking things through, trying them out.
Now, thing is that the above relay _does_ work with the Propeller _without_any_ modifications. Just by plugging an output pin to the IN relay breakout pin (which has been grounded and powered with +5 VDC).
Maybe earlier I had made some other kind of mistake for things not to work properly.
This relay breakout is just perfect for me, although not so easy to find (last time I had to wait weeks for the delivery). So I'd want to do without...learn how to do without.
My constraints are:
+3-3.2V dC to pilot the relay, coming from an output pin from the Propeller chip.
+220 AC, some 5-10A of current / 1000-2000 VA to handle
+monostable relay, so I don't have to check its status....
Why did the above relay work? Was is underdimensioned to work at 5VDC, so that it ended up working even with 3.2VDC? don't know.
I've found something like this (+3V, 10A monostable relay) http://uk.rs-online.com/web/p/non-latching-relays/8113533/?searchTerm=811-3533&relevancy-data=636F3D3126696E3D4931384E525353746F636B4E756D6265724D504E266C753D656E266D6D3D6D61746368616C6C26706D3D5E5C647B337D5B5C732D2F255C2E2C5D5C647B332C347D2426706F3D313426736E3D592673743D52535F53544F434B5F4E554D4245522677633D4E4F4E45267573743D3831312D3335333326
Sadly it won't be available till november...anyway since I'm here I'd want to check if I understood the wiring...
I connect 6 to propeller out pin, 1 to GND. 3 and 4 are COM and NO...
Can you tell me if I understood right? Also the price seems so low...50 pieces is like 3£ or 4€....
---
The initial question stays: what kind of part can I use for my purpose (switch ac mains currents, drive with the Propeller)?
It has also come to my attention (suggested by groggory in another thread like this) this Solid State Relay:
http://www.dx.com/p/ssr-25da-25a-solid-state-relay-white-134494
While it is affordable, seems easy to use, and perfect for the job (or is it?), it's...a little big.
I want to check more if there are alternatives.
Are there any? Suggestions?
tnx in advance for all the support, I owe you big time :-)
G.