12V output from a PIC

Thread Starter

Propeller

Joined Nov 27, 2005
10
Hi all,
I am working on a project for my car using a PIC microcontroller. I need to convert my 5v output from the PIC into 12v, 300mA... so that I can activate a relay elsewhere in the car. Pls note, that all i need is a 12v source going to the relay (single wire) as the relay is already ground. (Pls note that the pic/circuit board is no where near the relay)

Simply put, does anyone have a circuit design that shows how I can output the 12V from my circuit board using a PIC...

Cheers
Propeller
 

lightingman

Joined Apr 19, 2007
374
Hi...

Here it is....

Hope it helps....

Daniel......

P.S. Put a diode (1N4001, 2, 3, 4, 7). accross the relay (anode to ground side).....
 

Attachments

Thread Starter

Propeller

Joined Nov 27, 2005
10
Thanks Daniel... this is of great help.
Can you pls check my understanding:

The 1st diagram using PNP and NPN transistors appears that the output will switch onto 12V when the PIC is high (to the NPN Transistor). This is exactly what i hoped for.

I'm not sure why an N-MOSFET is used in your second diagram... doesn't this do the same thing...? Why MOSFET...?

Probably silly questions, but I'm a mechanical engineer tinkering with electronics...
Cheers
 

lightingman

Joined Apr 19, 2007
374
Hi....Yes you are dead rite !!! it does the same thing.....The reason I showed both, is that driving into the base of a transistor requires a small amount of current.....A MOSFET will require almost no current when it is in the on or off state, only during the low to high or high to low transition (the gate having a small capactance) that has to be charged / discharged at each transition......The reason for the 47K resistor from the gate to ground is that during the boot-up / settling time of the PIC (until the pin is made an output), the pin will be in the high impedence state...... This would leave the gate to the MOSFET floating.....casing it to pick up any stay static charge, switching it on / off as it feels.....Therefore if you wish to drive very high impedence load, the MOSFET would be the best bet.... (with the resistor for PIC's, no resistor for other CMOS logic devices).......And yes !! a high at the base of the NPN, will give you the 12 volts (minus the 0.7 or so volts drop accross the transistor) that you require.....The NPN transistor can be any small device (BC108, BC182, 2N4401......and so on)..... The PNP transistor needs to be able to handle the power required for the load.....If you wish, you could use a darlington transistor for the PNP one.....Good luck.....Daniel.
 

a_kent

Joined Jun 12, 2007
30
Propeller, please store this switch circuit provided by Lightningman forever!
It's a classic high side driver circuit that you will likely find MANY uses for!

I have been using almost that exact same circuit (except I like to add a little negative base bias to the NPN when used with microcontrollers) for many years!

I like this place. People actually do good stuff around here...
Take care,
Kent
 

SgtWookie

Joined Jul 17, 2007
22,230
When we need to do this with multiple PIC o/ps is n't ULN2003 (Darlington) is a better solution. Compact. Saves space relaible blah.. blah..
Not in this case.

The circuits presented already are just what was needed, as stated by the requestor's requirements: to energize a remote 12V relay that already had one side of the coil grounded.

Your solution was to ground the other side of the coil, too?
 

RiJoRI

Joined Aug 15, 2007
536
Not in this case.

The circuits presented already are just what was needed, as stated by the requestor's requirements: to energize a remote 12V relay that already had one side of the coil grounded.

Your solution was to ground the other side of the coil, too?
I think V.C. was expanding to more outputs. We did this back in the old (8085 :eek:) days: The relay had one side of the coil high, the other connected to a ULN-2003. The 2003, when activated, brought the other side of the coil to ground, and the relay activated. We had to feed the signal through a 74LS373 latch, 'cause the 8085 was a uProcessor, and did not latch any data. I don't remember using any current-limiting resistors -- probably depended on the 2003. We did use diodes across the relays' coils, though. ;)

--Rich
 
Top