Does this Digital output design correct? - Page 1
Forum section: electronics / projects

author: Danesh_SA
author_rank: Contributor
timestamp: January 01, 2020, 12:37:23 pm
content: Hi all,Happy new year ,I design this circuit,which is a 4 channel Digital output.Maximum acceptable voltage is 28V .I use ULN2803 for this design.I use optocoupler to have isolated digital output from my MCU (this is an industrial design).My question is:As the ULN2803 is darlington pairs,does it necessary to have pull up (R2,R5,R8,R11) and pull down (R3,R6,R9,R12) resistors for TLP521-4 emitters and collectors?Thanks!

author: oPossum
author_rank: Super Contributor
timestamp: January 01, 2020, 01:57:36 pm
content: All of the 4k7 resistors can be removed. D3 must also be removed to allow the diodes in the ULN2803 to work.

author: MarkF
author_rank: Super Contributor
timestamp: January 01, 2020, 02:35:21 pm
content: Quote from: oPossum on January 01, 2020, 01:57:36 pmNo. That would cause a short between VIN and GND.One of four inputs:OR

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 01, 2020, 04:18:02 pm
content: Quote from: MarkF on January 01, 2020, 02:35:21 pmIndeed. *All* was weird. Maybe that was some alcohol in play there.Quote from: MarkF on January 01, 2020, 02:35:21 pmYep, the version to use would depend on what polarity is needed from input to output - of course we don't know for sure what the OP intended.As to D3, I guess it provides simple protection against polarity inversion. The internal diodes of the ULN2803 are meant to act as freewheeling diodes I guess? Problem here is that if using D3, the supply voltage for the outputs should be taken at the cathode of D3, and not at its anode as we can guess from the schematic and the "Digital out" connector.Finally, I'm guessing the whole idea is just to make an isolated level shifter, but we don't quite know what it's supposed to drive. Knowing that may help finding an alternative to the ULN2803.

author: Danesh_SA
author_rank: Contributor
timestamp: January 01, 2020, 05:09:31 pm
content: Thanks all for replys,This circuit is just an industerial digital output card ,it used for driving 24v relays coil , low power selenoid's,signal lamps and ,... .As @SiliconWizard mention it,D3 is simple reverse polarity protection in my design.More information:MCU is 3.3V and D4 is TVS.Quote1-would you please explain me on both of the @MarkF suggestions?and why place both pull up and pull down resistors is wrong design?2-As ULN2803 has 2.7K series resistor in all of the inputs,No need to add current limit resistors between optoucouplers and ULN2803 inputs.Is it right?

author: MarkF
author_rank: Super Contributor
timestamp: January 01, 2020, 06:25:33 pm
content: Quote from: Danesh_SA on January 01, 2020, 05:09:31 pmLook at these three examples with the opto's replaced with switches.- In the 'Pull-Up' and 'Pull-Down' cases:If the switch is OPEN, the output is pulled HIGH or LOW through the resistorIf the switch is CLOSED, the output is pulled directly HIGH or LOW.- In the case with BOTH Pull-Up and Pull-Down:If the switch is OPEN, the output is pulled LOW through the resistorIf the switch is CLOSED, the output is a voltage divider between both resistors.(i.e. The output voltage is V/2. Neither HIGH or LOW.)Technically, you can NOT be sure how the ULN2803 will interpret the input.Quote from: Danesh_SA on January 01, 2020, 05:09:31 pmThe 4.7K resistors are there to limit the current through the opto's output transistor. Not the ULN2803 inputs.If too low, you may burn out the opto's output or it will NOT reach the desired logic level when ON.If too high, the current may be so low that noise could interfere with the ULN2803's input.

author: MarkF
author_rank: Super Contributor
timestamp: January 01, 2020, 06:34:37 pm
content: Quote from: Danesh_SA on January 01, 2020, 05:09:31 pmPin 10 of the ULN2803 is connected to Vcc so that the internal diodes on each output can protect against back-emf when the relay coils are turned OFF. By adding D3, you are blocking the current path for back-emf protection.Leave D3 out or bring both the high and low sides of each relay coil to the PCB.

author: Danesh_SA
author_rank: Contributor
timestamp: January 01, 2020, 08:24:49 pm
content: Dear MarkF,Thank you for your detailed answer,As i told itsNOTjust for relays,it used for many other things such as 24V lamps or 24V low current solenoids and ... .1-Which one of pull down or pull up resistor ,is better for my design and why?2-I think the combination of optocoupler and ULN2803 is a 3-stage darlington pair,Right?ULN2803 has 2.7K resistors series with each input pin inside it.3-I add 1N4148 diode on my design to handle back EMF if any inductive load connected ,and still have D3 for Reverse polarity protection in my design(it's very important!).

author: MarkF
author_rank: Super Contributor
timestamp: January 02, 2020, 12:17:12 am
content: Your opto's are NOT wired correctly.They will pull the ULN2803 input high when ON.However, the ULN2803 inputs will be floating when the opto is OFF.The back-emf diodes are for relays, soleniods, low power motors, etc. Anything with an inductive coil.The discrete diodes you added for back-emf are wired the SAME as the ULN2803 internal ones.Look at the datasheet for the ULN2803 logic:You want the high side of the diodes PRIOR TO the diode D3.DO NOT USE BOTH the internal diodes (i.e. pin 10) and the discrete diodes.WHEN THE ULN2803 TURNS OFF, THE BACK-EMF CURRENT WILL GOOUTTHRU THE FUSE.THE DIODE, D3, PREVENTS THIS.If you really want the reverse power protection, only put the diode on the pull-ups for the opto's.You use either pull-up or pull-down depending on whether you want to invert the logic.Do you want a '0' or '1' in the software to turn ON the output of the ULN2803?I believe you want pull-down's.When the MCU sends out a '1',the opto will turn ON and pull the ULN2803 input HIGH,the ULN2803 output will then go LOW and energize what is connected.

author: oPossum
author_rank: Super Contributor
timestamp: January 02, 2020, 02:39:05 am
content: Quote from: SiliconWizard on January 01, 2020, 04:18:02 pmNo. I assumed people where smart enough to realize some would be replace with 'shorts' and some would just be gone. Bad assumption I guess.

author: oPossum
author_rank: Super Contributor
timestamp: January 02, 2020, 02:43:11 am
content: Quote from: MarkF on January 02, 2020, 12:17:12 amThat's not a problem. External pulldown is pointless on these extremely slow devices.

author: MarkF
author_rank: Super Contributor
timestamp: January 02, 2020, 04:17:41 am
content: Back up the horses...I just realized you intend to drive the opto's with +24V.The ULN2803 inputs can NOT exceed +5V. So, you need to limit the current to about 1mA.And assuming you do not want the pull-down resistors:

author: Danesh_SA
author_rank: Contributor
timestamp: January 02, 2020, 07:52:58 am
content: Quote from: MarkF on January 02, 2020, 04:17:41 amDear MarkF ,the optos and ULN2803 is the same as my design .1-As you explain about pull up and down resistors in perviuse post,here is just a current limit resistor ,There is no Pull down resistor in this design(which is prevents ULN2803 floating when optos are turn off),why?2-there is no way to protect ULN2803 reverse polarity protection ,with your schematic,Right?

author: MarkF
author_rank: Super Contributor
timestamp: January 02, 2020, 02:27:56 pm
content: Quote from: Danesh_SA on January 02, 2020, 07:52:58 amSince your last circuit did not have them, I left them out.As @oPossum stated, they are really not needed because of the ULN2803's input configuration.Look at the ULN2803 schematic. When the input is open, the 7.2KΩ and 3KΩ resistors pull it to GND.(This is unique for the ULN2803. For a logic gate or a MCU input, you would want them.)QuoteLook at the schematic for the ULN2803. For reverse polarity, the internal diodes (blue above) on each output will conduct and the solenoid (or whatever) will always be ON.The internal diodes protect against reverse polarity on the inputs and outputs.The bigger question- How to protect against total power dissipation?Remember, the total current sunk with all outputs conducting is 500mA.How do you control what devices are connected to the outputs?

author: Danesh_SA
author_rank: Contributor
timestamp: January 02, 2020, 06:25:16 pm
content: Now i got it ,there is internal pull down resistor inside ULN2803 and we just need current limit resistor because ,optos collector is 24V.I use 250mA fast fuse ,series with all output pins of ULN2803 and output connector,and there is one 1Amp fuse(F1) for total current limit for this chip.I have another big concern!when i check related topics,a few days ago,i noticed someone had issue with ULN2803 internal free wheel diodes on each outputs,he saidTHESE ARE NOT ROBUST FOR INDUCTIVE LOADS SUCH AS BIG 24V RELAYS,AND IT CAUSES ULN2803 BURN!I think add discrete free wheel diode is much relaible for this chip!what do you think?(and why you say "DO NOT USE BOTH the internal diodes (i.e. pin 10) and the discrete diodes.")

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 02, 2020, 06:32:32 pm
content: Quote from: Danesh_SA on January 02, 2020, 06:25:16 pmNot sure why. DS states a typical Vfd of 1.7V for the internal clamp diodes. Adding discrete external diodes in parallel should work as the typical discrete diodes for this will have a much lower Vfd, thus conducting first?

author: MarkF
author_rank: Super Contributor
timestamp: January 02, 2020, 08:15:29 pm
content: Quote from: Danesh_SA on January 02, 2020, 06:25:16 pmI avoid putting diodes in parallel.If you want external diodes on the outputs, use something like a UF4004.The 1N4148 you showed before are signal diodes and NOT appropriate for this application.

author: Yansi
author_rank: Super Contributor
timestamp: January 02, 2020, 08:20:36 pm
content: (unrelated to ULN2803 or whatever:) Bullshit. If the switched current is below what 4148 can handle, there is nothing wrong in using 4148 as the backemf protection for a say 50mA relay.Neither do I believe internal diodes of ULN2803 are not enough to handle some relay switching, if the currents are within the datasheet limits. I have used a lot of ULN2003 ICs in the past, never had one failed in a relay switching application.Maybe if you buy inferior cheap crap from fleabay...

author: Danesh_SA
author_rank: Contributor
timestamp: January 02, 2020, 10:10:03 pm
content: Whats wrong with paralell diodes(internal diodes and discrete diodes,both of them) ?BAV70 is another option,i see alot in industrial products used for free wheel diode to handle back EMF .@yansi do you use discrete diodes for ULN2003 and ULN2803 for your switching applications or just rely on internal diodes?

author: Yansi
author_rank: Super Contributor
timestamp: January 02, 2020, 10:15:36 pm
content: Only internal ones. No reason to add extra ones. Used for relays up to about 50mA coils without issues. Don't see a reason to add external ones.

author: Danesh_SA
author_rank: Contributor
timestamp: January 03, 2020, 07:50:29 pm
content: Dear Yansi,Thank you for your reply,my application need 200mA per channel ,total is 4*200=800mA .with this situation,do you think to add external free wheel diode on each output?

author: Yansi
author_rank: Super Contributor
timestamp: January 03, 2020, 08:00:41 pm
content: I am not sure, but 800mA total current seems a bit too much for the IC.What is the maximum specified current total per whole IC?If you need just 4 outputs, at least think about paralleling 2 channels per output to help it a bit with heat dissipation.

author: Danesh_SA
author_rank: Contributor
timestamp: January 03, 2020, 09:54:51 pm
content: ULN2803 Continuous collector current is 500mA .I want to use 100mA Continuous current per each channel,and 200mA peak current .I use fast fuses on each of the output.But i really think about add discrete free wheel diodes on outputs.I see it many times.

author: Yansi
author_rank: Super Contributor
timestamp: January 03, 2020, 10:09:29 pm
content: Fuses won't help anything. Absolutely anything.Reason for fuses is fire prevention, not silicon protection. Transistors always burn faster, than fuses.If you need robust industrial outputs, use apropriate circuitry. ULN2803 is outta question.For example, ROHM BD8LB600FS or similar. Is quite on the cheap side and a robust solution for this. Or the good old fashioned 4 channel VN340 switch.There are a lot of industrial grade both low- and high- side switches (typically for PLC or sensor output applications). Just google for them.

author: TrickyNekro
author_rank: Frequent Contributor
timestamp: January 03, 2020, 10:22:33 pm
content: Quote from: MarkF on January 02, 2020, 04:17:41 amMaybe not all created equal then? Look page 4:http://www.ti.com/lit/ds/symlink/uln2803a.pdf

author: Yansi
author_rank: Super Contributor
timestamp: January 03, 2020, 10:45:45 pm
content: That is the absolute max ratings, not recommended operation voltages.ULN2803 is supposed to work with 5V (and likely 3V) logic, for higher voltages (CMOS) there was the ULN2804.

author: MarkF
author_rank: Super Contributor
timestamp: January 03, 2020, 11:12:44 pm
content: And the ULN200x series as a comparison with the same max specifications:

author: Danesh_SA
author_rank: Contributor
timestamp: January 04, 2020, 09:39:21 am
content: VN340 and BD8LB600FS are great options but the price tag is HIGH!I think for lower price tag we have other options such as:1-TI DRV8803 is an inductive load switch with integrated protection ,3-TBD62783 is 8channel source type DMOS transistor arrayWITHOUT BUILT IN PROTECTION(Lower power consumption and better operation )4-discrete MOSFET or BJT driveBut still I don't understand WHY ITS NOT GOOD TO USE DISCRETE FLYBACKDIODE WITH EACH ULN2803 OUTPUT,COULD SOMEONE EXPLAIN IT IN DETAILED?

author: Yansi
author_rank: Super Contributor
timestamp: January 04, 2020, 11:27:21 am
content: Using a motor driver as an output switch, is dumb idea, as its over-current protections rely upon the load having at least a bit of inductance. Will likely burn to shits when shorted directly. Also, you have a totem pole drivers there.Price tag high and bla bla... Then find another solution with the same robustness, as the industrial/automotive drivers have.Not sure what you want it to use for, but ULN2803 is not the recommended way for any kind of a slightly industrial application, let alone one when user can access the outputs. Remember that fuses are fire protections, not for silicon protection. Transistors always burn faster than fuses!Quote from: Danesh_SA on January 04, 2020, 09:39:21 amBecause there is no need for them, the internal ones shall be absolutely fine. That's why they are there.Also, if you look further without fussing about the price tag being high, you can sure find solutions like BTS3118D, etc. There is a metric crap ton of these cheap single channel ones, if you just bother to look.Problem only is, if you want the output for a PWM operation - most of these protected switches have very slow turn on and off.