Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 6th August 2004, 01:10 PM   (permalink)
Default Relays & PIC18F452

Hi all,

Searching through this foru,I found somme interessting things about controlling relays from a PIC.

To sum up :
1- The relay must have is own PSU instead of sharing its PSU with the PIC one.

3- A NPN transistor should be placed between the trigger and the relay.
:?: How rating this transistor ?

2- The current from the PIC is 5V/25mA. Depending on the chosen transistor, it might be necessary to place a resistor between the PIC and the base of the transistor in order to get the current down to the max of mA accepted by the NPN.

Do Am I wrong ?

I will try to make a schematic later on

Cheers
ZERS is offline  
Old 6th August 2004, 01:33 PM   (permalink)
Default Re: Relays & PIC18F452

Quote:
Originally Posted by ZERS
Hi all,

Searching through this foru,I found somme interessting things about controlling relays from a PIC.

To sum up :
1- The relay must have is own PSU instead of sharing its PSU with the PIC one.
No, a 5V relay can work quite happily from the same supply as the PIC, but commonly you would be using a 12V relay (or something similar), which will need a suitable supply. Often the PIC will be fed from a 5V regulator driven by the same supply as the relay.

Quote:
3- A NPN transistor should be placed between the trigger and the relay.
:?: How rating this transistor ?
NPN is one way, and the way I'd normally choose, the rating depends on the specific relay. Also, you MUST! place a reverse polarised diode across the relay coil, or the transistor will blow as the relay turns off.

Quote:
2- The current from the PIC is 5V/25mA. Depending on the chosen transistor, it might be necessary to place a resistor between the PIC and the base of the transistor in order to get the current down to the max of mA accepted by the NPN.
A resistor is ALWAYS required, to limit the current - not using one could damage both PIC and transistor - certainly it would be extremely poor design practice not to include one.

Quote:
I will try to make a schematic later on
Have a look at my 'Hardware Extras' page in my PIC tutorials, I already discuss this - this page is still 'on going', but I've posted the work so far due to frequent questions about the subject.

I don't specify what transistor to use, but I will be going into more detail later on - when time allows!.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 6th August 2004, 01:47 PM   (permalink)
Default

thanks, I will look into your website and I'll get back to U

I'm still in the process of choosing the relay before going any further with the PIC...
ZERS is offline  
Old 6th August 2004, 02:59 PM   (permalink)
Default

Quote:
Originally Posted by ZERS
thanks, I will look into your website and I'll get back to U

I'm still in the process of choosing the relay before going any further with the PIC...
What are you wanting to switch?.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 6th August 2004, 03:46 PM   (permalink)
Default

Quote:
Originally Posted by Nigel Goodwin
What are you wanting to switch?.
Well to sum up, I'm building my own DIY CD PLAYER.

There are seveal modules in it :

1- The controller board made of the PIC18F452. This board manages the data from/to the the DRIVE (a philips CDPRO2 mechanism), data to be displayed on a LCD, IR data.

2- A dac made of 2 TDA1541A in //, with a tube output stage

3. A PSU board with several voltages :

* 5V for the controller board, the DAC as well as the decoder of the drive

* -21V for the DAC

* 235 V /6.3V for the output stage.

*9V for the drive (mechanism)

The issue is to manage the start of the modules in a good sequence as the CDP is switched off /on

When ON :
1- First the controler board (+5V)
2- Then after a short delay, the DAC (+5V, -21V, 6.3V, 235V)
3- Then the decoder of the drive (+5V)
4- At least, the +9V of drive.

A minimu m of 400ms has to be respected between each modules.

When OFF, take the sequence upside down.

I could manage the delay by inserting RC cells.
But it costs to much and it is less interesting than managing the delay by the PIC. On top of that, I could quickly changed the delay (400ms to 300, 500,...) just by amending the program.

That's why, I attend to control several relays between the PSU board and the other modules. They would switched on/off to enable the flow of current.

Hope it's clear, my english is not as good as expected ops:
ZERS is offline  
Old 6th August 2004, 04:00 PM   (permalink)
Default

Interesting idea, but I'm not sure why you want to switch them on at different times? - I'm also somewhat bemused by you wanting a valve (tube) in the design, but that's your personal preference!.

Depending on the current requirements most of the voltages could be switched by a pair of transistors (one NPN and one PNP for each rail), rather than by relays - which should be smaller and cheaper. Also, depending on the PSU design, you may be able to use the supply regulators as the actual switches.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 6th August 2004, 04:10 PM   (permalink)
Default

here is the schematic and the board of the psu
Attached Files
File Type: zip psuzers.zip (122.9 KB, 35 views)
ZERS is offline  
Old 6th August 2004, 04:11 PM   (permalink)
Default

the dac
Attached Files
File Type: zip daczers.zip (389.6 KB, 30 views)
ZERS is offline  
Old 6th August 2004, 04:15 PM   (permalink)
Default

Quote:
Originally Posted by Nigel Goodwin
Interesting idea, but I'm not sure why you want to switch them on at different times?
As far as the fdrive it's concerned, the datasheet explains that it is necessary to start the decoder before the mechanism.

It is written as well that in case of using external DAC, this dac must be started before the decoder..

Quote:
Originally Posted by Nigel Goodwin
Depending on the current requirements most of the voltages could be switched by a pair of transistors (one NPN and one PNP for each rail), rather than by relays - which should be smaller and cheaper. Also, depending on the PSU design, you may be able to use the supply regulators as the actual switches.
I would be interesting in this solution...
The requirements are close to 1A for the drive, less than 500mA for other parts except the output stage which requires more.
ZERS is offline  
Old 6th August 2004, 05:08 PM   (permalink)
Default

Quote:
Originally Posted by ZERS
I would be interesting in this solution...
The requirements are close to 1A for the drive, less than 500mA for other parts except the output stage which requires more.
Here's a simple example, the PNP transistor is the actual switch, with the output from the collector.
Attached Images
File Type: gif tran_sw.gif (2.1 KB, 374 views)
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 6th August 2004, 05:31 PM   (permalink)
Default

Cool !
I've just have to find the good NPN and PNP transistor to rate the resistors.

But how does your schematics works as the input voltage is negative ?
Do I replace the PNP by a NPN, i.e. 2 NPN on a rail ?
ZERS is offline  
Old 6th August 2004, 05:44 PM   (permalink)
Default

what do you mean by negative?

negative voltage? this can't be as the signal is coming from the pic and pic's don't run off a negative supply...

if you mean negative logic the you just change it in software
Exo is offline  
Old 6th August 2004, 05:49 PM   (permalink)
Default

Quote:
Originally Posted by Exo
what do you mean by negative?

negative voltage? this can't be as the signal is coming from the pic and pic's don't run off a negative supply...

if you mean negative logic the you just change it in software
Yes I mean negative voltage but voltage that is to be "switched" (i/e replace 12V IN by -12V IN in the schematic above) :wink:
ZERS is offline  
Old 6th August 2004, 09:55 PM   (permalink)
Default

Quote:
Originally Posted by ZERS
But how does your schematics works as the input voltage is negative ?
Do I replace the PNP by a NPN, i.e. 2 NPN on a rail ?
It's not so easy to switch a negative rail using a positive 0-5V output?.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 7th August 2004, 09:13 AM   (permalink)
Default

The easyest way would be to connect the -12V directly to your circuit and switch GND
Exo is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 04:29 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker