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

Driving SPDT relay using PIC18F2580
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Gaara



Joined: 10 Feb 2014
Posts: 11

View user's profile Send private message

PostPosted: Mon Feb 17, 2014 6:28 am     Reply with quote

Hi all,

@Mike Walne:
Apologies. This was an error on my part WRT the post. My relay is the G5Q-1 and indeed it is an SPDT based relay. Thanks for clarifying which of the pins is the COMMON.

@Ttelmah and @gpsmikey:
My PSU details are as follows:
Input: 100v - 200v - 50 - 60 Hz - 0.2A.
Output: 6v - 150mA.

The actual output constantly reads 6.4v hence looking at the dropout voltage of 1.3v an output of 5v is obtained which is what I read from the Vout pin of the regulator.

@avro698:
I've connected my wiper, common or pole pin i.e. pin 2 to ground and the LED load doesn't toggle.

@Everyone:
As opposed to using the ULN2803 with regards to driving the relays I would like to utilise a combination of an NPN transistor and a diode to drive the relay, in similar fashion as seen on page 10 here http://www.apogeekits.com/PDF_Files/illustrated_assembly_manual_k8090.pdf

Having read more on this method of driving the relays using a PIC is this method any better than using the ULN2803?

With regards to ironing out the PSU as a reason as to why the relay might not be working I applied, Ttelmah's advice below:

Which is why I prefer to separate logic and relay supplies.

Remember this can (to a limited extent), be as simple as having one 5v rail, feeding the relays, and then having a resistor/capacitor filter feeding the logic off this.

Quote:

And (of course), concentrate on how the ground rails run. You don't want the relay current being drawn 'via' the logic ground....


Thanks.
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Mon Feb 17, 2014 9:00 am     Reply with quote

Gaara,

Some time ago you said this:

Quote:

I connected PIN 1 of the ULN2803 to 5v and its PIN 18 to the coil pin which I had connected to ground. This caused the relay to switch (click) hence I believe this far it works.


So, your relay driver *is* working, so why are you entertaining any changes now? How is it possible to have so many simple things all not working???

Your troubleshooting and communications skills remind me of this old classic skit: http://www.youtube.com/watch?v=airT-m9LcoY

John
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Mon Feb 17, 2014 9:47 am     Reply with quote

I have had a copy of the audio track of that for years, but not the video! Thanks for that link (and yes, it does apply). Too often (and here is an example) if it doesn't work, they re-arrange the deck chairs on the Titanic and try again instead of learning to troubleshoot the problem. That is a basic skill you have to develop if you expect to survive anywhere in the industry (or life for that matter). Start with simple test code that toggles or whatever something in the hardware to make sure that part works. Move on to the next part. Once you have verified each part works, then work on integrating the pieces together.

mikey
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Mon Feb 17, 2014 9:52 am     Reply with quote

Still no details of whether the supply is regulated or not.

The transistor gives the same result as the ULN. Remember you need the diode, transistor, & minimum two resistors for the circuit. No advantage at all.

The serious difference, with the manual connection, is that if the supply droops when the relay switches, the PIC will almost certainly reset, while the manual connection will stay solidly high. I'm strongly suspicious your 5v rail is _not_ maintaining a good 5v, when the relay tries to switch. Even with the LDO regulator, you are below the 'dropout' voltage for the regulator. An oscilloscope on the supply rail when the relay switches, might well show your whole problem.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Mon Feb 17, 2014 12:13 pm     Reply with quote

It's time for a review of where you're at.

Starting from RC1 tell us, clearly and precisely, which nodes in the circuit path to the relay contacts are toggling and which are not.

Mike
afyon



Joined: 10 Mar 2014
Posts: 1

View user's profile Send private message

PostPosted: Tue Mar 11, 2014 11:53 am     Reply with quote

@Gaara, I really don’t understand, how can everything so simple just won’t work? There has to some reason for that. Please check if there are any grounding issues in your circuit. These are the most common cause for such issues and generally with grounding issues, nothing seems to work properly. Since your regulator isn’t giving a proper output voltage, there can’t be much more that can go wrong with the circuit.
_________________
prototype pcb assembly
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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