12v output using ULN2803

Hello, i want to give 12v output using arduino. Actually what i need to drive is 2 relays but i dont have access to them because they are integrated in a control unit. i want to alter the operation of this control unit and that is why i need the arduino

i have read that the uln2803 output is 0.5v per output pin so if i want to give 12v output i have to connect 24 input pins to an arduino output pin and short-circuit the outputs to have 12v?

something like the sketch?

also i think that this also can work but i dont like the fact that i will have to suppley 12v always

ps r1, r2 are arduino output

thanks!!

The ULN2803 chips provide a current sink to ground. All you have to do is connect 12V to
the high side of the relay, and connect the low side to the 2803 output pin. Then connect
your Arduino directly to the input pin of the same channel. Also apply 12V to the COM pin
of the chip. See the ckt, you don't really need the pullup R on pin 1.

so i cant use them to operate the relays when they are grounded and give them 12v to operate?

the problem is that gnd at the control unit for the relays is the same so i think that if i give 12v continious without ground, when it will be grounded both relays will open

actually i have 3pins. pin 2 is gnd and 1 is for the relay no1 and 3 is for relay no2 12v.

if i connect pin 9 to gnd, pin 10 to 12v
pin 1 is input/pin 18 output for relay no1 gnd
pin 2 is input/pin 17 output for relay no2 gnd
will it work?

No, the ULN2803 can only sink current to ground, so it has to switch the low end of the relays.
It's difficult to say how to do it without seeing the actual schematic for the relay board.

the control unit is something like the image above. it has 3 input pins. one is ground the other 2 are for 12v input to close either the 1st or 2nd relay

You want high side switching.

For that you need either PNP BJTs, or P-channel MOSFETs. Personally I prefer MOSFETs, but that's just me.

To keep it logical you may want to drive them with an NPN or N-channel.

Here it is with BJTs:

R2 wants to be small enough that the transistors switch fast enough - between 1K and 10K should be find. R1 should be fairly low, but not too low. If you're using MOSFETs, then 150-200? is good. BJTs can go higher, maybe 1K or so.

Oh, and a pull-down on the input from the Arduino is a good idea to stop it floating and switching when you don't want it to if the Arduino is off / disconnected / IO set to input.

This last ckt looks like it would do the job.

oric_dan:
This last ckt looks like it would do the job.

It should do - I use it pretty much daily (but with MOSFETs) :wink:

oric_dan:
This last ckt looks like it would do the job.

That circuit is more or less guaranteed to burn out Q1. It needs a resistor in series with the collector of Q1 added. Alternatively, replace Q2 by a P-channel mosfet.

majenko:
Oh, and a pull-down on the input from the Arduino is a good idea to stop it floating and switching when you don't want it to if the Arduino is off / disconnected / IO set to input.

That's a good idea if the Arduino is not powered from the same supply as Q2, or if Q1 is remote from the Arduino pin, making it susceptible to noise pickup. Otherwise, it's not necessary.

dc42:

oric_dan:
This last ckt looks like it would do the job.

That circuit is more or less guaranteed to burn out Q1. It needs a resistor in series with the collector of Q1 added. Alternatively, replace Q2 by a P-channel mosfet.

Agreed. Like I said, I usually use MOSFETs.

majenko:
Oh, and a pull-down on the input from the Arduino is a good idea to stop it floating and switching when you don't want it to if the Arduino is off / disconnected / IO set to input.

That's a good idea if the Arduino is not powered from the same supply as Q2, or if Q1 is remote from the Arduino pin, making it susceptible to noise pickup. Otherwise, it's not necessary.

Don't forget the Arduino defaults the IOs to input mode, so it will be floating until the sketch sets it to output. That's all the time it is in the bootloader, and all the time it's doing whatever else the sketch might be doing before it sets the IO to output.

Best to be safe, especially if the far end is connected to a HumanMangler 5000™.

Good Circuit. I used it to control a solenoid and it worked very well.

Bob

That circuit is more or less guaranteed to burn out Q1. It needs a resistor in series with the collector of Q1 added. Alternatively, replace Q2 by a P-channel mosfet.

Oops, good point, I missed that.

what parts do u use for the circuit above with mosfets? :slight_smile: :slight_smile:

iason1907:
what parts do u use for the circuit above with mosfets? :slight_smile: :slight_smile:

Depends on the current draw and voltages you're working at.

For the N-channel make sure it's a "logic" level MOSFET (usually has an L in the code, like IRLxxxx). For the P-channel make sure it turns on fully below the voltages you are working at, and can handle the current and voltage of your relay.

Although ULN2803 is unsuitable for this application because it is a low-side switch, MIC2981 an an octal high-side switch that can be driven from the Arduino, so it could be used in this application. It has a voltage drop of around 2V, however your 12V relays will probably operate reliably on 10V. If your 12V supply is unregulated, then it may well deliver more than 12V anyway.

actually i have alreaydy made a circuit that works with a couple 2n2222, but with use of 2 more relays before the final ones. so i will check out the mic2981 if smthing better can be done.

thanks a lot