Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : drive a relay
Author | Message | ||||
heppy36 Regular Member Joined: 29/07/2011 Location: AustraliaPosts: 54 |
Hi again (sorry for been a noob)I built my little project and it does what its ment to (with a LED) turns off when pin1 =1,but when I connect a relay thinking power one side of relay pin1 other nothing happens?do I need a transistor to drive it? SETPIN 1,8 Pin(1) = 0 setpin 2,1 setpin 3,1 setpin 4,1 setpin 20,2 DO CLS Font #2 print "Fuel Main " FORMAT$((pin(2) / 3 * 100), "%4.1f")"%" print "Fuel Reserve " FORMAT$((pin(3) / 3 * 100), "%4.1f")"%" PRINT "Battery " FORMAT$((pin(4) * 4), "%5.2fV") if pin(2) > 1.8 then pin(1) = 1 print "Pump OFF" else pin(1) = 0 endif if pin(20) = 0 then PRINT@(0,90,2) "BRAKE Fault" else endif pause 500 loop Heppy |
||||
jman Guru Joined: 12/06/2011 Location: New ZealandPosts: 711 |
You sure do need a transistor or mosfet That is from the original Maximite article Regards John |
||||
heppy36 Regular Member Joined: 29/07/2011 Location: AustraliaPosts: 54 |
Thanks can I use a transistor,as its only a 12V relay?(I also have a lot of transistors) Heppy |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3802 |
You need the diode etc as well. |
||||
heppy36 Regular Member Joined: 29/07/2011 Location: AustraliaPosts: 54 |
Thank you ,that work great Heppy |
||||
jman Guru Joined: 12/06/2011 Location: New ZealandPosts: 711 |
Hi Heppy Take a look at this web site Drive a realy with a PIC Regards John |
||||
CircuitGizmos Guru Joined: 08/09/2011 Location: United StatesPosts: 1425 |
Here for reference is a relay shield on a CGCOLORMAX1. And controlling the relay with MMIDE 3. Micromites and Maximites! - Beginning Maximite |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9307 |
@ jman: That's a nice little link. Something to bear in mind, is that not all 12v relays are equal in terms of what their coil current is. While it is certainly true that you can drive small DIL PCB relays with a single transistor such as a BC548 as their coil current is so small, for larger relays(like a 12v car "Horn relay") that have a much higher coil current, you have to use a Darlington transistor with much higher gain and current rating - or use two discrete transistors in a Darlington arrangement. ALWAYS test this on the breadboard BEFORE you make your PCB's like I DIDN'T at one stage, then found that the single transistor could not switch the large relay... I always prefer to configure my relay switching so that the transistor sinks the coil current rather then sourcing it, but as the page that jman linked to states, you can do it the other way, you just need extra parts. Smoke makes things work. When the smoke gets out, it stops! |
||||
MOBI Guru Joined: 02/12/2012 Location: AustraliaPosts: 819 |
I have often used a BC337 to drive 12v car type relays with no problems, mind you, a good darlington or mosfet doesn't go astray. David M. |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9307 |
It's funny you should mention 337's - I was going to do an edit along those lines, but you beat me to it. Generally, it is not mission-critical if you put the wrong transistor in, as in MY case where the single 548 would not switch the relay, I replaced it with a suitable Darlington in the same pinout as the 548, and away it went. Smoke makes things work. When the smoke gets out, it stops! |
||||
TinkersALot Regular Member Joined: 20/11/2012 Location: United StatesPosts: 72 |
here is a sampling of relay boards: http://winfordeng.com/products/cat_rly.php http://www.futurlec.com/InterfaceBoards.shtml http://arduino-direct.com/sunshop/index.php?l=product_list&c =38 |
||||
Print this page |