|
 |
|
04-06-2006, 04:16 PM
|
#1
|
|
Newbie
Join Date: Apr 2006
Posts: 17
|
Need help with PIC circuit
Hey, trying to delvelop a PIC circuit, but having problems with it...
Everything works right except for the relay. the pic runs fine, the switch works, and the 3 LED's go on and off when the pic tells them to.
My problem with the relay is this, the pic starts with the output of RB3 off (0V) and therefor the relay isn't energized (as it should be). Then, when the output of RB3 goes high (5V), there is voltage to the transistor's base, and it allows current to flow through the relay, energizing it (once again, as it should). Problem is when you go to turn off the relay. The output of RB3 goes back to 0V fine, but the relay never switches off... The only way to get it off is to remove power to the entire circuit. I've tried putting resistors all over the place (before the relay, between the relay and the transistor, after the transistor, and many combinations thereof) All I managed to do was not get the relay powering up at all... This really has me stumped... I admit to not knowing a ton about electronics, but to me this circuit should work no?
Any help would be appreciated
|
|
|
|
|
|
Advertisement
|
Sponsored links
|
04-06-2006, 04:20 PM
|
#2
|
|
Raw Wave
Join Date: Apr 2000
Location: Surrey, UK
Posts: 2,100
|
Couple of things to try. Dropper diode in RB3 line (perhaps RB3 isn't going close enough to ground to switch off the open collector transistor). Alternatively, a resistor between base and emitter of the transistor.
__________________
6yr old first install died 20/8/2005 as result of bad bios flash.
New system : 6x5x2" contains 1GHz C3 PCM9373, ISR based PSU, 8Gb flash DOM, 98Lite, DirectShow based frontend.
GPS : Rikaline 6010.
Display : LTM08C351 + LVDS receiver.
|
|
|
04-06-2006, 04:33 PM
|
#3
|
|
Newbie
Join Date: Apr 2006
Posts: 17
|
Tried both a 1k and a 10k resistor between the base and emitter, no luck
As for a dropper diode, I've never heard of them (ok so I'm actually kinda new to electronics) are they hard to get, or is there anything else I can try? (electronics store is like 30 min drive one way)
Thanks
|
|
|
04-06-2006, 05:25 PM
|
#4
|
|
Raw Wave
Join Date: Apr 2000
Location: Surrey, UK
Posts: 2,100
|
any diode will do. just a regular signal diode is good (eg 1n4148). just drops the voltage 0.6v.
__________________
6yr old first install died 20/8/2005 as result of bad bios flash.
New system : 6x5x2" contains 1GHz C3 PCM9373, ISR based PSU, 8Gb flash DOM, 98Lite, DirectShow based frontend.
GPS : Rikaline 6010.
Display : LTM08C351 + LVDS receiver.
|
|
|
04-06-2006, 06:32 PM
|
#5
|
|
Newbie
Join Date: Apr 2006
Posts: 17
|
No go... same thing, relay powers on but then stays on...
|
|
|
04-06-2006, 06:41 PM
|
#6
|
|
Newbie
Join Date: Apr 2006
Posts: 17
|
been doing some experimenting, and discovered that once the relay is energized, I can totally disconnect the transistor's base from the circuit, and it stays energized? :| me confused...
|
|
|
04-06-2006, 07:14 PM
|
#7
|
|
Maximum Bitrate
Join Date: Jun 2005
Location: Oakland, CA
Posts: 530
|
Do you happen to have a latching relay instead of a normal one?
-psyrex
|
|
|
04-06-2006, 08:04 PM
|
#8
|
|
Newbie
Join Date: Apr 2006
Posts: 17
|
nope. just a normal 12V relay...
|
|
|
04-06-2006, 08:51 PM
|
#9
|
|
Low Bitrate
Join Date: Sep 2005
Posts: 72
|
does power stop flowing through the transistor?
(I know, it's a silly question, but if not, then something wrong with either your setup, or the transistor. If yes, however, then you either got a latching relay, or a bad relay.)
|
|
|
04-06-2006, 11:08 PM
|
#10
|
|
Newbie
Join Date: Apr 2004
Posts: 34
|
Have you tried somthing like a 10K from the emitter to ground?
|
|
|
04-06-2006, 11:15 PM
|
#11
|
|
Constant Bitrate
Join Date: Nov 2005
Posts: 202
|
Post the datasheet, or at least the part number of the relay.
|
|
|
04-06-2006, 11:20 PM
|
#12
|
|
Constant Bitrate
Join Date: Feb 2006
Posts: 112
|
Your circuit looks fine and it ideally should work. Having the diode you've shown is good to prevent the kickback the relay causes when you turn it off.
You've measured the voltage at the base of the transistor when you've got the odd malfunction, and even disconnected the base and seen the relay stay on.
If you have a voltage meter, you could measure the voltage across the relay when the transistor is switched off. You should measure 0v but it would be interesting to verify that.
At this point, I'd have to say that the circuit knows more than you do! By this I mean there's a connection or something in the circuit that isn't accounted for in your schematic. It may be a short, or an extra connection. It may be the order of the transistor leads or even the part number isn't the same as your schematic. (For example, an SCR will do exactly as you describe!) It isn't magic waiting to be discovered! I would carefully re-check all of the connections and verify that everything is as you expect. There's a problem somewhere and the trick is finding the source.
|
|
|
04-06-2006, 11:29 PM
|
#13
|
|
Constant Bitrate
Join Date: Oct 2002
Posts: 170
|
Quote: Originally Posted by flipster125
been doing some experimenting, and discovered that once the relay is energized, I can totally disconnect the transistor's base from the circuit, and it stays energized? :| me confused...
Its not gonna do that if you have a 10K resistor to ground or B-E
Continue isolating the problem without the PIC
How much current does the relay coil draw?
|
|
|
04-07-2006, 07:00 AM
|
#14
|
|
Raw Wave
Join Date: May 2003
Posts: 2,021
|
Yes try pulling down the base with a 10K to the ground. I doubt this is the problem because the PIC can source/sink up to about 20mA and it should be enough to turn on/off the transistor properly.
Best thing to do is isolate the problem first. Disconnect the RB3 from the 1K resistor and replace the relay with an LED/resistor for now. On connecting the left side of the 1K to a +5V the LED should turn on, disconnecting it or connecting it to a 0V the LED should turn off.
If the simple relay driver does not operate the LED as expected then there is something wrong with the transistor or connection. If it does work then the relay must be sticking, unlikley but it does happens. Also check the diode across the relay. There isnt really much things to go wrong in there.
|
|
|
04-07-2006, 07:18 AM
|
#15
|
|
FLAC
Join Date: Jan 2004
Location: UK
Posts: 1,284
|
Like he said ^
looks like the voltage is not true zero, maybe because of the pics internal pull up resistance.
Are you sure that pin can sink current?
Some pic lines are emitter followers and cant pull down IIRC.
Had this happen using led and a switch on the same line, so that led toggles with the switch, 1 IO line doing both functions, problem was when the IO line was in an input state it had such high impedence that if _light_ fell on the led it thought the switch was pressed, try debugging that!
I spent a day on the thing before finding the 'problem' of light generating led's
(And please, no idiots saying led's dont generate power etc , they do, google is your friend, stops you looking a dick....)(wished I had used it that day)
__________________
Lez.
XM 2.1TD ~ Morette triple headlights+HID ~ Leather kit ~ XC70 alloys
Exhaust rear boxes removed ~ meshed air filter
|
|
|
|
Sponsored links
|
|
Advertisement
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:52 AM.
| |