Sanity check on using a transistor as a switch...

Reloadron

Joined Jan 15, 2015
7,523
You might want to consider an opto-isolator.
I would share in that thinking. Anytime there may be concerns about the source an opto-coupler offers up isolation. I am not saying this is a must in your case but rather a nice to have. Optocoupler interfacing is a good basic read on the subject.

<EDIT> I see AK is already up and about this morning so you may want to just address his questions. :) </EDIT>

Ron
 

Thread Starter

Non-Sequitur

Joined Oct 27, 2014
85
Even if the controller and the load share the same reference potential (ground), there still is the potential for load transients to go backwards into the controller output stage. An opto can help prevent this

What is the output of the controller? Hint - it might already be an opto-isolator.
How much voltage can it withstand?
How much current can it source and/or sink?
Manufacturer/part number/model number/website link?

ak
CORRECTION on chip type

OK, I asked the mfr and here's what I got back... They use the TI MR243E (TI 57K A6FR G6) and (TI 55K CHGQ G4), depending on whether the RS-232 component is a plugin adapter (the later) or integrated into the main board (the former). The MR243E (TI 57K A6FR G6) has a red, red, black, black, gold banded resistor downstream of each pin before the physical DB9 connector. I can't tell what kind of resistor the (TI 55K CHGQ G4) uses before the DB9 interface, they're SMDs and no color code. I hope that helps... I'm so glad to find out they aren't using the FTDI RS232 modules. I have a feeling I'm over-thinking the problem, and that the solution thus far is more than adequate. But if the information about the chips raises new concerns, so much the better.

I'm pretty sure this is the data sheet... http://www.ti.com/lit/ds/symlink/max3243e.pdf, too bad it's written in ancient Hebrew.
 
Last edited:

Thread Starter

Non-Sequitur

Joined Oct 27, 2014
85
I would share in that thinking. Anytime there may be concerns about the source an opto-coupler offers up isolation. I am not saying this is a must in your case but rather a nice to have. Optocoupler interfacing is a good basic read on the subject.

<EDIT> I see AK is already up and about this morning so you may want to just address his questions. :) </EDIT>

Ron
From the schematic of the opto-isolator, would it replace the function of the 2N3904,? Seems like the Q1 2N3904 is redundant at that point. Am I finally getting it at this point, or am I still cleaning the mud-flaps of the mule train in front of me?
 

ebeowulf17

Joined Aug 12, 2014
3,307
From the schematic of the opto-isolator, would it replace the function of the 2N3904,? Seems like the Q1 2N3904 is redundant at that point. Am I finally getting it at this point, or am I still cleaning the mud-flaps of the mule train in front of me?
I think you've got the right idea. Positive voltage from microcontroller output to pin 1, ground to pin 2. You'll need a current limiting resistor in series with the internal LED, and you may want a diode in series also. Connections on the output side of the opto (pins 3 & 4) would be the same as those in the current NPN.

I'm not at all sure on this, but it sounds like your RS232 output can go well below ground, which would reverse bias the LED. My understanding is that LEDs don't have very high reverse voltage blocking capability, so the external diode would be there to protect the LED from reverse current when the output is low. Hopefully others can confirm or deny my suspicions.
 

Thread Starter

Non-Sequitur

Joined Oct 27, 2014
85
I think you've got the right idea. Positive voltage from microcontroller output to pin 1, ground to pin 2. You'll need a current limiting resistor in series with the internal LED, and you may want a diode in series also. Connections on the output side of the opto (pins 3 & 4) would be the same as those in the current NPN.

I'm not at all sure on this, but it sounds like your RS232 output can go well below ground, which would reverse bias the LED. My understanding is that LEDs don't have very high reverse voltage blocking capability, so the external diode would be there to protect the LED from reverse current when the output is low. Hopefully others can confirm or deny my suspicions.
Would the current limiting resistor (R1) be the same as before, like the 1K? SInce I've already order all the parts for the design from mouser, I'd want to catch them before they fulfilled the order; it's what I get for pealing back more of the damn onion skin on this problem.
Sounds to me like the reason why some suicide vest makes get their fingers blown off...........
 

philba

Joined Aug 17, 2017
959
Would the current limiting resistor (R1) be the same as before, like the 1K? SInce I've already order all the parts for the design from mouser, I'd want to catch them before they fulfilled the order; it's what I get for pealing back more of the damn onion skin on this problem.
Sounds to me like the reason why some suicide vest makes get their fingers blown off...........
Which opto are you using? the datasheet will tell you what current you need to target and the LED's Vf. Also, you probably need to measure your rs-232 output because a zero can be anywhere from 3V to 25V (per the spec) though more likely to be 5V. Then you need to figure what the voltage drop in the resistor is going to be to figure out the resistor value. I'd definitely use a diode to block negative voltage.

I'm very happy if the vest makers lose more than just fingers...
 

Thread Starter

Non-Sequitur

Joined Oct 27, 2014
85
Which opto are you using? the datasheet will tell you what current you need to target and the LED's Vf. Also, you probably need to measure your rs-232 output because a zero can be anywhere from 3V to 25V (per the spec) though more likely to be 5V. Then you need to figure what the voltage drop in the resistor is going to be to figure out the resistor value. I'd definitely use a diode to block negative voltage.

I'm very happy if the vest makers lose more than just fingers...
I've not opted for any particular opto yet (cute play on words, eh?). I think I'll wait until you smart guys tell the villiage idiot (moi) how to boil water. As for the suicide vest builder, we did find one low-level guy that blew his genitalia off. Bet his goat was pissed.
 

philba

Joined Aug 17, 2017
959
It's hard to go wrong with the 4N35 but just about any of them out there will work OK. The PC817 in that link ron posted would be fine, too. They are both cheap (20-26 cents each - you'll pay far more for shipping).
 

Thread Starter

Non-Sequitur

Joined Oct 27, 2014
85
Maybe add a diode in series with R1, unless you're sure that the uC low output is 0V, as opposed to being a negative voltage (which is what I think it is.)
I'm never sure about anything, which is the reason I get on forums like these. Nothing wore than someone who knows enough the be dangerous. Does it make any difference if the diode is before or after the R1 resistor? And I suppose the orientation of the diode should be ----->|----- correct? And as always, do you have a favorite part number for that diode? Would be awesome if I could use the same type as D1.
 

philba

Joined Aug 17, 2017
959
Maybe add a diode in series with R1, unless you're sure that the uC low output is 0V, as opposed to being a negative voltage (which is what I think it is.)
If the source is an RS-232 interface, it most definitely will go negative. Any diode will do. 1n4148 would be fine and cheap.
 

ebeowulf17

Joined Aug 12, 2014
3,307
View attachment 136872
Rembrandt's got nuthin' on me! Loookeen good?!
Looks right to me. Next you have to pick an opto, then calculate R1. For that calculation, you'll need the Vf (forward voltage) for the LED in the opto and the Vf of the diode. You'll also need the target current (I) through the opto LED, and finally the voltage of your uC (RS232?) high output (Voh.)
The formula will be:
R1=(Voh - Vf_opto - Vf_diode) / I

So, for example:
Voh = 5V
Vf_diode = 0.7V
Vf_opto = 1.8V
I = 0.01A

In this example the formula becomes:
R1 = (5 - 1.8 - 0.7) / 0.01
R1 = 2.5 / 0.01
R1 = 250

All of these numbers are arbitrary guesses. I just chose them to give you an example of how to do the calculation.
 

Thread Starter

Non-Sequitur

Joined Oct 27, 2014
85
Looks right to me. Next you have to pick an opto, then calculate R1. For that calculation, you'll need the Vf (forward voltage) for the LED in the opto and the Vf of the diode. You'll also need the target current (I) through the opto LED, and finally the voltage of your uC (RS232?) high output (Voh.)
The formula will be:
R1=(Voh - Vf_opto - Vf_diode) / I

So, for example:
Voh = 5V
Vf_diode = 0.7V
Vf_opto = 1.8V
I = 0.01A

In this example the formula becomes:
R1 = (5 - 1.8 - 0.7) / 0.01
R1 = 2.5 / 0.01
R1 = 250

All of these numbers are arbitrary guesses. I just chose them to give you an example of how to do the calculation.
WAIT WAIT WAIT WAIT!!!!!!!!!!!!!! Guys and Gals, I'm a systems programmer. 1 + 1 = 10 ! Anything more than that is advanced math! Just kidding! Fantastic help. I will figure this out and redo the schematic.

Because the PCB mfg I use will only make a minimum of 3 prototypes, I am offering one (fully populated), to anyone would like it (as long as they agree to let me know if they find something wrong or have suggested modifications).Once the design is finished and I get all the parts and finish the prototype board I will let that person know and get their shipping address.
 

Thread Starter

Non-Sequitur

Joined Oct 27, 2014
85
Well, thanks again to all, based on the components I've used the formulas provided to produce the following schematic. I hope this is useful to others in the forum. I have one other question, "If I switch to SMD/SMT components for the final non-proto-type design, will the electrical characteristics of the overall architecture change?" VR/NSupload_2017-10-9_16-19-32.png
 

wayneh

Joined Sep 9, 2010
17,498
It may be a niggling point but the "ground" for the µC can be different than the motor ground, and that's a benefit of the opto, but it MUST be shared by the left-hand side of the opto so that the opto's LED can light.
 
Top