can the prop control this 4ch 5volt relay using its 3.3 volt i/o pins ?
whiteoxe
Posts: 794
this is the relay unit I have http://www.ebay.com.au/itm/190866383549?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649 I think it needs 4 x 5volt i/o pins to operate it and the relays themselves can operate from 5v to 24 volt.
So if i am correct then i will need to setup a breadboard with transistors so i can use the Quickstart 3.3v pins to turn on a separate 5volt supply . Each 3.3v pin operates a relay. but the 3.3volt quickstart i/o pin most likely wont be able to switch it. so i will have a separate 5 to 5.3 battery pack that will supply the power to the relay pin by using a transistor.
Here is another look at the 4ch 5volt relay http://www.freetronics.com/pages/relay4-4-channel-relay-driver-module-quickstart-guide#.U9pjSGflpdg
am i on the right path so far please ? ive got both common npn and pnp transistors, just not sure that my conclusions are correct but would be a good excuse to use a transistor again any advice much sort after. :thumb:
thanks,
Whiteoxe.
edit: is there a better way than using the transistors i propose ? i just read this thread a few threads earlier than mine which is similar but a bit different i think ..It's title is "Still Trying To Drive The Relay With A Propeller", maybe the 3.3volts will trigger the relays ?
So Arduino uno boards I/o pins put out 5 volts ? Well this board of relays said it was for the arduino but I always ignore that bit
http://forums.parallax.com/showthread.php/156690-still-trying-to-drive-a-relay-with-the-Propeller...
PS. now my imagination is running away with me... can two prop pins make 6.6 volts ? plug in a 5v regulator :frown: I bet there are 10 ways of solving this but I just want one . (1) the other 8 would be more twisted than a loose roll of barbed wire ........
So if i am correct then i will need to setup a breadboard with transistors so i can use the Quickstart 3.3v pins to turn on a separate 5volt supply . Each 3.3v pin operates a relay. but the 3.3volt quickstart i/o pin most likely wont be able to switch it. so i will have a separate 5 to 5.3 battery pack that will supply the power to the relay pin by using a transistor.
Here is another look at the 4ch 5volt relay http://www.freetronics.com/pages/relay4-4-channel-relay-driver-module-quickstart-guide#.U9pjSGflpdg
am i on the right path so far please ? ive got both common npn and pnp transistors, just not sure that my conclusions are correct but would be a good excuse to use a transistor again any advice much sort after. :thumb:
thanks,
Whiteoxe.
edit: is there a better way than using the transistors i propose ? i just read this thread a few threads earlier than mine which is similar but a bit different i think ..It's title is "Still Trying To Drive The Relay With A Propeller", maybe the 3.3volts will trigger the relays ?
So Arduino uno boards I/o pins put out 5 volts ? Well this board of relays said it was for the arduino but I always ignore that bit
http://forums.parallax.com/showthread.php/156690-still-trying-to-drive-a-relay-with-the-Propeller...
PS. now my imagination is running away with me... can two prop pins make 6.6 volts ? plug in a 5v regulator :frown: I bet there are 10 ways of solving this but I just want one . (1) the other 8 would be more twisted than a loose roll of barbed wire ........
Comments
-Phil
There was little voltage coming from that wire not enough to switch the clear plastic relay I was using. I got it to work using transistor but I cant now remember the diff between an emitter or a base. I'm starting from first base or more like in the bunker . I could see how a person could control their house from a parallel port. I was sad to see my next computer had no option for that port but id figured out serial ports and chips were easier. Anyway looks like there is a very similar thread id missed below mine ill keep an eye on.. thx Phil.
I asked the same thing here and got you confused with Heater http://forums.parallax.com/showthread.php/156620-Need-tips-on-soldering/page4
I believe the Propeller II requires a lower voltage power supply for it's internal logic although the I/O pins still work a 3.3v
Don't even "also try a 7404 gate" as that is absolutely redundant and unnecessary, no point at all since the signal voltage is current limited by the resistors to turn on the NPN bipolar transistors, and all they need is more than 0.6V and a few milliamps, which is what the resistor already does. If worse comes to worst you only need to change the resistors as mentioned or even putting a resistor in parallel maybe (if that's easier).
BTW, two Prop pins can't produce 6.6V really as the CMOS structure will conduct with any voltage more positive or negative than it. But mind you I have coupled the output of a pin through a cap and schottky diodes (or a dual) onto an output cap to almost double the voltage. For 3.3V this will most likely only be around 5.5V taking into account Rdson and diode drops and loading current.
sorry PJ , I just missed your post. Point taken.
Wot!? you were serious about the "7404"s then and you tried to buy them too!!!!
As mentioned before, it's all about the current which is controlled by the resistors, so forget about the voltage. NPN transistors in this grounded emitter configuration are really current amplifiers, they may have a minimum current gain of 100 meaning that you pass 1ma through the base-emitter then it will allow up to 100ma to flow between the collector and emitter, which also means anything in its path, such as the relay coil that connected to +5V and the collector. But typically this configuration is meant to work more like a switch or a relay as we want the transistor to turn on as hard as it can so we just end up pumping 3 to 10 times (roughly) the amount of current that we need into the base to get it to switch on fully (saturated switch). So that relay draws around 70ma so even at 3ma base current it will have no problem turning it on fully and I'm sure the base resistors do supply more than that at 3.3V input. If you confirm what value those input resistors are then that will certainly nail it if you yourself are in doubt (not me).
BTW, this preoccupation with voltage instead of current is what a lot of threads are about such as *** and his obsession with the magic 5V when it's all about current through an opto LED in this case which then drives a transistor which drives the relay. It's like days of our lives.
( So you know that to run an LED off 12V instead of 5V at the same brightness you just increase the value of the resistor and to run it at 3.3V you would decrease, although it would still work anyway, same thing).
the book has stated that 5volts is a common requirement, Ok, I get it crystal clear that not in this particular case of the relay board I have got. , that is good to have been made aware its the wrong approach. Im going to have to go over your posts a couple more times and google some questions I have before Im really understanding all the information posted so far. Give me a day or two !
There seems much talk mof voltages in these chapters I have read and of using resistors with the gates for protect\ion until everything is working right then the resistors may be removed possibly. Then the book starts teaching about constants, variables pub pri methods , objects, ram, rom shared or not , starting, stopping cogs. Only 5 chapters but its quite a lot to digest. , and I am digesting it but my eyes feel bigger than my stomach , I need a little break before I can swallow the lot ! but thanks I appreciate the help I am being handed. :thumb:
Whoa up there boy, you're jumping the creek before you are anywhere near the bank, all those facts and figures. If you understand that last little bit I said about the LEDs you will clue on that although there's a minimum turn-on (and clamp) voltage for diode structure (diode or transistor = 0.6V , red LED 1.6V etc) that it is the current that needs to be controlled. A red LED will work fine off 240V or 2.4V, depending upon the resistor (but the voltage across the diode will always be 1.6V or so). The NPN transistor switch will work fine off 50V, 5V or 1.5V, depending upon the resistor. You don't need a day, just a moment, KISS.
My approach to this is just to always by a couple of spare Propellers when messing with experiments on bread boards or proto boards. Ready for that day that I slip up. Seems to me that in that scenario I'm as likely to damage the Prop pins whilst implementing the protection circuit than just connecting them to what I want. Complexity increases the risk of error. One hundred ohms in series with outputs will protect from shorts, nice as long as that does not interfere with what you are trying to do.
Up to you.
It seems you could do with a little tutorial in the basic use of a transistor as a switch. As used on those relay boards like yours for example. For example this : http://www.electronics-tutorials.ws/transistor/tran_4.html which shows a nice typical relay driver circuit.
Notice how the transistor is turned on by current into it's base and that there is a resistor in between the input and base to limit that current. Without that resistor the transistor will pull as much current as it can and no doubt fry itself. It only needs to be a small current, 100 times less than the load current switched through the load.
So, as long as 3.3v from the Prop is enough to drive sufficient current through that resistor into the base the transistor will turn on an activate the relay. No need for any 3.3 to 5v conversion.
It's fun to build just simple circuits like those in that tutorial and measure the currents through and voltages across all the components. Experiment with different resistor values and see how things change. And, importantly, when the smoke comes out:) Then you start to get a feel for what is going on here.
In fact I would start such experiments with a resistor and a LED. As Peter is discussing. Measure the current through the LED. Measure the voltage across the LED and the resistor. Change the resistor value a bit. See how current through the LED changes. See how the brightness changes. Notice how the voltage across the LED stays almost the same all the time. Magic!
The current and voltage through a LED does not obey Ohms Law.
The current into and voltage on the base of a transistor behaves much like the current and voltage with a LED.
Same for normal diodes in the conducting direction, but the experiments are more fun with LEDs that light up:)
Round these parts if you want to know how it works, take it apart!
We do that by building simple circuits swapping out component values and "seeing inside" by measuring volts, amps etc. And blowing it up.
It helps to have an concrete aim in mind. Like understanding your relay driver circuit.
A little theory, ohms law and stuff, gets you a long way. And experiments fix it in the brain better than any dorky book reading.
You burn your dinner and you learn to take it off the stove a few minutes earlier, you didn't need no book to tell ya that, and you wouldn't have understood it really.
Instead you burn and learn
Now that's a real warm feeling right there.
So you see get the simple things right first, read it yes, but try it out, yes, then play with it till it "burns", the smell of that smoke etches itself into your memory and never gets forgotten.
PRAC 101 - LED + RESISTOR - what voltage do you read across the LED for various supply voltages and resistance - what does that tell you? - will it only work with 5V??? etc
(In fact I get budding young engineers to connect an LED directly to 5V since it's a "lamp", burn and learn)
"Burn and learn" I love it. Is that a catch phrase among chefs? It's going to be a catch phrase for me from now on.
Many years ago I just had to torture a good old fashioned red LED by winding up the current slowly, sure it got brighter and brighter, then levelled out and then started to dim. At that point there was a big bang and the top flew off. Nearly took my eye out.
One should be a bit careful with the burn and learn technique.
Protection? That's fer wusses, most they get is a pair of glasses and if it happens that a hot bit of "led" hits em in the face and it burns, then they learn even more n better!
Actually what Mike was saying about reading those kind of books, the problem is you ending up "knowing" how to do it exactly that way, but not understanding how to do it different or why. How many times have I come across engineers who absolutely insist that THIS is the way it has to be done. Oh boy, how do I tell em different from the "book", how dare I.
But I'd have hundreds of stories to tell, quite humorous if they weren't so true. I even had one very experienced and qualified hardware design engineer diagnose a circuit and after finding "only" 0.6V on the base emitter of an NPN figured it was faulty and needed to be replaced with one that showed the full voltage. Was he for real? Yep!. Another microelectronics grad knew all about the CAD but when I was talking about RC differentiation and integration he just didn't have a clue, not a sausage, go figure. Oh, the list goes on and on....
Keep it simple. That board is perfect and should work fine with a propeller. There are 6 pins. Gnd to Gnd on your quickstart. Vcc on that relay board to 5V - but in this case the relay board is pretty tolerant of variation and you could use 4 AA batteries. Ballpark anything 4V to 7V. And connect propeller pins directly to the inputs on the relay board.
That should be it - no other parts needed. Just some wires actually, and a few lines of spin. Turn the prop pins high then low once a second (use the led blinker code) and you will hear the relays clicking.
Way back during my pre-university physics course we did a lot of practicals involving capacitors and inductors, even transistors and tubes. All part of the elecromagetism thing. One day the lecturer held up a choke and a transformer and told us how we were lucky to be doing all this practical stuff, how the majority of EE's coming out of university could tell you all about the theory of inductors but would not be able to tell you which one of these was the choke and which was the transformer.
How we laughed. How stupid could that be? Most of us in the group had started playing with this stuff around the age of 10. Philip's Electrical Engineer Kits, building xtal radio sets, wrecking the family TV, and so on.
Sure enough when I graduated in Physics I knew a lot of EE's graduates. What my lecturer had said that day turned out to be true. I really wondered why half of them had bothered with EE when they did not seem to have a passion for it at all.
Winding time forward a few decades, I recently watched you tube video by an electronics lab tech in the states showing us around the labs and all the goodies in his back room store. He complained about exactly the same problem. Most of he students he had to deal with could not tell one end of a diode from another.
Things change, things stay the same....
As Im typing I have just started to think that if I connect the microcontroller and set the four pins IN1,IN2,IN3,IN4 to high then it might turn off all the relays ? I'll try that in the meantime.
I couldnt find the Quickstart when i started the experiment but it has shown up during the video
EDIT: I can't get the relays to work at all. I set all the pins high then connected the ground and they werre all off so I though that was the answer but when i then sert the pins to LOW nothing happened. So then I just went back to unplugging the arduino and unlike before when all the relays were on and the red lights lit up I get nothing. Its like the board is dead ?
EDIT #2; Well its working. When pin on relay boartd is set to LOW it operates the relay and the red light goes on. Turn it off by setting the pin to HIGH.
but is there something a little bit wrong with my wiring that when i disconnect the microcontroller then all relays and their lights are on ?
I think its all working correctly. Just being Active Low, threw me for awhile.
Whereas this very similar relay board has switches that also supply power from a supply connected between 5 and 24volts. Which seems to me to be slightly easier type of relay to use.
What are the part codes on the transistors ?
You should always test suck unknown Boards first with a variable control voltage (eg a second power supply) to check the switching thresholds. ON and OF will be slightly different.
If they are PNP transistors connected to 5V, that would fit your observations.
The Prop cannot drive 5V, so the LEDs are on faintly, and then a LOW turns them on more.
The problem here, is temperature and supply skew can move that just slightly glow effect, until a relay that turns on, can fail to release. Not a good design/use.
Worst case test is probably 3 relays ON and an inner relay going from ON to OFF.
The yellow overlay looks to use NPN drivers and can use higher voltage relays.
What I am curious about in the yellow overlay is where it has the 5 to 24 volt input, is that just giving me the operating range of that board or is that also used by the switches to source power, or do I still need another power supply and the relays are only switches. I've really not used a relay before no matter how simple or old they may be ? Well a single relay on a breadboard ages ago.
Reverse reading the image, which shows the tracks and plane connections, that yellow board powers at the relay voltage. So you can use 5/9/12/24V relays.
The Logic threshold is set by 2 resistors and the SOT23 device, likely a NPN - so the point where the relay turns on will change slightly with 5/9/12/24V, but not much. Expect a TTL level of 1.5V~2V, with > 2V => Relay Coil ON.
If you can read those resistor values, you can calculate the nominal switch point, but as I've mentioned before, better to actually measure what happens, then you learn more.(and eliminate false assumptions) & confirm the board does work before you apply software.