CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Relay and PIC pin

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest
Guest







Relay and PIC pin
PostPosted: Fri Apr 21, 2006 7:34 pm     Reply with quote

Hi all,

I have a latching relay and there is a constant positive supply to the + side of it's coil, normally the negatice side is floating (basically not connected, I want to pull down the negative side to switch off the relay can I do this directly with a pin of a PIC that can sink tens of mA?

Because I was unsure if I could or not and being a electroins newbie I tried using a BCR148 with the MCU feeding the base and the emitter going to ground and the colloctor attached to the negative side of coil but this does not appear to work?

I know your probably laughing but any help will be great.....
Storic



Joined: 03 Dec 2005
Posts: 182
Location: Australia SA

View user's profile Send private message Send e-mail

PostPosted: Fri Apr 21, 2006 9:40 pm     Reply with quote

I use a ULN2003 to gnd the relay. the micro I am using is the 18F1320, it has a 25am source/sink current.

check your micro and the PDF file from microchip.
usually at the beginning. check for Shocked
Quote:
Peripheral Features:
• High current sink/source I/O pins: 25 mA/25 mA


extracted from dsPIC30F3014/4013 pdf file (70138C.pdf)
as well the current draw of the relay startup and hold current

consider the back EMF of the relay, this could cause the micro to reset (BOP). Do the research, look at sample circuits http://www.uoguelph.ca/~antoon/circ/circuits.htm
http://www.interq.or.jp/japan/se-inoue/e_pic6.htm
some of these links may help Rolling Eyes

ANdrew
_________________
What has been learnt if you make the same mistake? Wink
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Fri Apr 21, 2006 9:52 pm     Reply with quote

... or you can use 2N7000 MOSFET. Connect: gate to the PIC, drain to relay, source to ground
Guest
Guest







Thanks Kender but another question
PostPosted: Sat Apr 22, 2006 3:04 am     Reply with quote

Thanks Kender but another question, does the 2N7000 need any other external components like a resistor etc? if not it's ideal.

Sorry for being a newbie!!!
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

Re: Thanks Kender but another question
PostPosted: Sat Apr 22, 2006 3:18 am     Reply with quote

Guest wrote:
Thanks Kender but another question, does the 2N7000 need any other external components like a resistor etc?


Nominally, an N-channel MOSFET would work for your application without external conponents. But it would help if you add a 100k pull-down resistor from gate to ground. This will make sure that your relay is off when the PIC's pin is floating, which happens when the PIC is reset.
Guest
Guest







To Kender
PostPosted: Sat Apr 22, 2006 5:29 am     Reply with quote

Thanks Kender you a star..
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Sat Apr 22, 2006 6:19 am     Reply with quote

Make sure that you check the specification on how long to pulse the relay. There is a minimum pulse duration as well as a maximum.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Sun Apr 23, 2006 7:10 pm     Reply with quote

You really need a snubber or catch diode on the relay coil for any transistor circuit. The ULN2003 has this catch diode built in. Put a 1N4000 or simillar diode in parallel with the relay coil with the cathode to the plus supply.
The reason is because when you try to shut off the transistor (either bipolar or FET) the coil with produce an "inductive kick" that may be high enough to damage the transistor. The diode shorts the kick out.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group