Author Topic: Does this Digital output design correct?  (Read 6312 times)

0 Members and 1 Guest are viewing this topic.

Offline Danesh_SATopic starter

  • Contributor
  • Posts: 30
  • Country: us
Does this Digital output design correct?
« on: January 01, 2020, 12:37:23 pm »
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!
« Last Edit: January 01, 2020, 12:39:04 pm by Danesh_SA »
 

Online oPossum

  • Super Contributor
  • ***
  • Posts: 1472
  • Country: us
  • Very dangerous - may attack at any time
Re: Does this Digital output design correct?
« Reply #1 on: January 01, 2020, 01:57:36 pm »
All of the 4k7 resistors can be removed. D3 must also be removed to allow the diodes in the ULN2803 to work.
 
The following users thanked this post: T3sl4co1l

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2763
  • Country: us
Re: Does this Digital output design correct?
« Reply #2 on: January 01, 2020, 02:35:21 pm »
All of the 4k7 resistors can be removed.
No.  That would cause a short between VIN and GND.

One of four inputs:

900362-0

 OR

900378-1
« Last Edit: January 01, 2020, 02:56:31 pm by MarkF »
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15797
  • Country: fr
Re: Does this Digital output design correct?
« Reply #3 on: January 01, 2020, 04:18:02 pm »
All of the 4k7 resistors can be removed.
No.  That would cause a short between VIN and GND.

Indeed. *All* was weird. Maybe that was some alcohol in play there. ;D

One of four inputs:
(...)

Yep, 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.


 

Offline Danesh_SATopic starter

  • Contributor
  • Posts: 30
  • Country: us
Re: Does this Digital output design correct?
« Reply #4 on: January 01, 2020, 05:09:31 pm »
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.

Quote

One of four inputs:
(...)

Yep, 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.


1-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?
 

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2763
  • Country: us
Re: Does this Digital output design correct?
« Reply #5 on: January 01, 2020, 06:25:33 pm »
1-would you please explain me on both of the @MarkF suggestions?
and why place both pull up and pull down resistors is wrong design?

900456-0

Look 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 resistor
      If 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 resistor
      If 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.


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?

The 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.
« Last Edit: January 01, 2020, 06:46:38 pm by MarkF »
 
The following users thanked this post: Danesh_SA

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2763
  • Country: us
Re: Does this Digital output design correct?
« Reply #6 on: January 01, 2020, 06:34:37 pm »
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.


Pin 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.
 

Offline Danesh_SATopic starter

  • Contributor
  • Posts: 30
  • Country: us
Re: Does this Digital output design correct?
« Reply #7 on: January 01, 2020, 08:24:49 pm »
Dear MarkF,
Thank you for your detailed answer :-+,
As i told its NOT just 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!).
 

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2763
  • Country: us
Re: Does this Digital output design correct?
« Reply #8 on: January 02, 2020, 12:17:12 am »
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 GO OUT THRU 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.

   
« Last Edit: January 02, 2020, 01:00:01 am by MarkF »
 

Online oPossum

  • Super Contributor
  • ***
  • Posts: 1472
  • Country: us
  • Very dangerous - may attack at any time
Re: Does this Digital output design correct?
« Reply #9 on: January 02, 2020, 02:39:05 am »
All of the 4k7 resistors can be removed.
No.  That would cause a short between VIN and GND.

Indeed. *All* was weird. Maybe that was some alcohol in play there. ;D

No. I assumed people where smart enough to realize some would be replace with 'shorts' and some would just be gone. Bad assumption I guess.
 

Online oPossum

  • Super Contributor
  • ***
  • Posts: 1472
  • Country: us
  • Very dangerous - may attack at any time
Re: Does this Digital output design correct?
« Reply #10 on: January 02, 2020, 02:43:11 am »
However, the ULN2803 inputs will be floating when the opto is OFF.

That's not a problem. External pulldown is pointless on these extremely slow devices.
 

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2763
  • Country: us
Re: Does this Digital output design correct?
« Reply #11 on: January 02, 2020, 04:17:41 am »
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:
« Last Edit: January 02, 2020, 05:16:10 am by MarkF »
 
The following users thanked this post: Danesh_SA

Offline Danesh_SATopic starter

  • Contributor
  • Posts: 30
  • Country: us
Re: Does this Digital output design correct?
« Reply #12 on: January 02, 2020, 07:52:58 am »
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:
(Attachment Link)

Dear 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? :(
 

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2763
  • Country: us
Re: Does this Digital output design correct?
« Reply #13 on: January 02, 2020, 02:27:56 pm »
Dear 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?
Since 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.)

900982-0

Quote
2-there is no way to protect ULN2803 reverse polarity protection ,with your schematic,Right? :(
Look 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?
« Last Edit: January 02, 2020, 03:00:51 pm by MarkF »
 

Offline Danesh_SATopic starter

  • Contributor
  • Posts: 30
  • Country: us
Re: Does this Digital output design correct?
« Reply #14 on: January 02, 2020, 06:25:16 pm »
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 said  THESE 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.")
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15797
  • Country: fr
Re: Does this Digital output design correct?
« Reply #15 on: January 02, 2020, 06:32:32 pm »
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.")

Not 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?
 

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2763
  • Country: us
Re: Does this Digital output design correct?
« Reply #16 on: January 02, 2020, 08:15:29 pm »
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 said  THESE 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 reliable 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.")

I 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.
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3930
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: Does this Digital output design correct?
« Reply #17 on: January 02, 2020, 08:20:36 pm »
(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...
 

Offline Danesh_SATopic starter

  • Contributor
  • Posts: 30
  • Country: us
Re: Does this Digital output design correct?
« Reply #18 on: January 02, 2020, 10:10:03 pm »
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?
« Last Edit: January 02, 2020, 10:14:25 pm by Danesh_SA »
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3930
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: Does this Digital output design correct?
« Reply #19 on: January 02, 2020, 10:15:36 pm »
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.
 

Offline Danesh_SATopic starter

  • Contributor
  • Posts: 30
  • Country: us
Re: Does this Digital output design correct?
« Reply #20 on: January 03, 2020, 07:50:29 pm »
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?
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3930
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: Does this Digital output design correct?
« Reply #21 on: January 03, 2020, 08:00:41 pm »
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.
 

Offline Danesh_SATopic starter

  • Contributor
  • Posts: 30
  • Country: us
Re: Does this Digital output design correct?
« Reply #22 on: January 03, 2020, 09:54:51 pm »
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.

 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3930
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: Does this Digital output design correct?
« Reply #23 on: January 03, 2020, 10:09:29 pm »
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.
 
The following users thanked this post: Danesh_SA

Offline TrickyNekro

  • Frequent Contributor
  • **
  • Posts: 265
  • Country: gr
  • Drinking FrappĂ© on the way to Isomnia!
    • Youtube channel, electronics and more ;-)
Re: Does this Digital output design correct?
« Reply #24 on: January 03, 2020, 10:22:33 pm »
The ULN2803 inputs can NOT exceed +5V.  So, you need to limit the current to about 1mA.

Maybe not all created equal then? Look page 4: http://www.ti.com/lit/ds/symlink/uln2803a.pdf
If you are an engineer and you are not tired...
You are doing it wrong!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf