RS232 9600 8N1 & Opto-Isolator
hmlittle59
Posts: 404
Hello All,
I'm learn how to use the Optocoupler with RS232 Data. I have a working unit Scanner, but want to Isolate it from the I/O pin once the Data has been received. I've Googled and YouTubed what I could to figure it out. But has anyone ever done this before and got it working?
I'm using my DG4062 (SQ Wave) & Scope for my test signal for now and a BOE.
I've used this (on hand) part before as a switch (https://www.mouser.com/ProductDetail/Broadcom-Avago/ASSR-1411-001E?qs=/ha2pyFadujqZRlk8FbaCxsFnFMaIZhm0pCj%2bakKD4xmiRcEDqqyeg==), will it couple Data?. Inverter Amp. arrives tomorrow.
Find attached the 2 designs I think may work. One is from the Sparkfun.com website.
:::Just want to Isolate the I/O pin once the Data is received.
Thanks for any help.
I'm learn how to use the Optocoupler with RS232 Data. I have a working unit Scanner, but want to Isolate it from the I/O pin once the Data has been received. I've Googled and YouTubed what I could to figure it out. But has anyone ever done this before and got it working?
I'm using my DG4062 (SQ Wave) & Scope for my test signal for now and a BOE.
I've used this (on hand) part before as a switch (https://www.mouser.com/ProductDetail/Broadcom-Avago/ASSR-1411-001E?qs=/ha2pyFadujqZRlk8FbaCxsFnFMaIZhm0pCj%2bakKD4xmiRcEDqqyeg==), will it couple Data?. Inverter Amp. arrives tomorrow.
Find attached the 2 designs I think may work. One is from the Sparkfun.com website.
:::Just want to Isolate the I/O pin once the Data is received.
Thanks for any help.
Comments
Why? That part is great as a solid-state "relay" but due to the way the MOSFET is activated it is slow to response. It might be ok at 300 baud, but not 9600. The rurn-on time can be 0.25ms or more.
Anyway, if you are really using optos then why bother with an inverter output although there are many devices with integrated logic outputs (HCPL-22xx etc). You could use the opto output in emitter follower so that a high input in the anode of the LED produced a high output. Or you could have your ground emitter circuit and drive the cathode of the LED instead etc.
Up date.
Bottom schematic, with resistor(s) removed, GND on pin 2 and signal (Sq. Wave) in on pin 1.
See attached Wave form Screen Shot.
Do you know of a part that would work at 9600 Baud?
Thanks
read over your part number ref...my bad, getting late.
Just ordered parts...Thru hole was out, so I ordered FairChild/ON (https://www.mouser.com/ProductDetail/512-HCPL2630SDM).
NOTE:Had googled your part and looked it up at Mouser.com, just was not sure if that was over kill or not.
Thanks.
will update.
The RS232 signal would feed the LED through a resistor although that resistor can be anywhere in series, the important thing is to convert the voltage to a limited current. There is no "pull-up" voltage on the transmitter side from the RS-232 but I'm guessing that this circuit is not a real circuit, just another one of those "interweb" circuits. Quickly typing in RS232 OPTO I picked a circuit that seems to be able to actually work although I don't know what they mean by "available via licence", as if it were something clever and patented whereas it is a basic circuit. This one at least uses the negative voltage from the RS232 itself although it does require an RTS for the positive voltage. Always always, there are caveats.
BTW, there are thousands of parts that would be suitable and you could get by even with something basic but it all depends upon where you source your parts.
read over your part number ref...my bad, getting late.
Just ordered parts...Thru hole was out, so I ordered FairChild (https://www.mouser.com/ProductDetail/512-HCPL2630SDM).
NOTE:Had googled that part and looked it up at Mouser.com, just was not sure if that was over kill or not.
Thanks.
will
Plenty of sources, and package choices.
Want some help. Need someone to look over this circuit and let me know if it will work as planed (few tweaks).
This may be over kill, but will it work and how can it be reduced.
I want to separate two different RS232 units that will transmit their DATA into one I/O pin. Each unit will transmit data at separate times, but I thought about one unit being damage from the other units signal because the Traces will be connected. I will be setting up a test unit on the BOE unit.
Schematic attached
Enjoy!
Mike
Thanks for all the help. OEM PCB's/Stencil should be here next week from China($1.00) apiece. Hope to have it built to specs and see it will pass the Data.
will update
Howard
PCB's came in and.....AHHHHH....Don't order PCB's 2:30 am after making lots of Modifications. Wait a day and RE-INSPECT. A few traces missing. :swear: :swear: :swear: Anyway...
Lots of Bench testing on the (BOE) trying to understand how RS232 (ASCII) will work with a Opto-Isolator (Non-Inverting) using my DG4062 Sig. Gen. (9600 Sq. Wave). Never really got that to working correctly(not the best Sq. Wave). Didn't help with the Thru Hole IC's wanting to keep popping out of the BOE(very frustrating).
Went back to the bad PCB and added only the parts needed to turn on the Opto Isolator and WAH-LA. Lot more stable, easier to work with and Scope. Could have saved a week. Also, the Data Sheet had Test Points plus component values off the IC so I had already added them to the PCB. Will try and add them from now on for new IC's if possible. Makes testing and hook up a breeze. I was also able to solder in the Mag. Swipe Reader and the testing was stable.
Thanks Peter for pointing out a part for me to check out. I'm currently using the Mouser:630-HCPL-2201-300E. Basically Plug and Play. I do have a 470 ohm resistor on the input. The (ASCII) Signal Voltage out is 2.6. I had already designed in a Op Amp circuit but the part I ordered is a Inverter and the Non-Inverter should be here tomorrow.
Side Note:I have one of the original Rigol DS2102 scopes and because of a flaw with the Self Cal. wipes out the Trial Bundle (Trigger/Decode/Memory) options if pressed and I forgot and pressed it. But I was able to get a second Trial (30 hrs or so) from Rigol. Always only used the Scope when needed to preserve that time. The time finally ran out during this design and so I purchased the Bundle 3 weeks ago for $250.00. No problem for (6+) years and now, Channel 1 and Decode 1 cut in and out, Run/Stop and SINGLE lock ON together. Simply turning it OFF and ON will not fix it either. Have to press Self Cal. to get things back to normal for a random amount of time. Will call Rigol tomorrow.
Will order new PCB's after fine tuning the Op Circuit.
WOW, what a pass 2 weeks.
Til next update
If you want to invert the signal through the opto all you do is you feed the other side of the opto's LED instead. So either put it into the anode and ground the cathode or else feed the cathode and ground the anode (negative volts activate). The series resistor should be more like 3k3 since the opto only needs about 1ma or so to drive and most modern RS232 drivers are usually more like +/-6V drive and nowhere near the +/-15V of the original spec. The fact is RS232 is a joke but everybody still plays the game even though the rules were changed.
I had already designed it into the PCB that I received, not know how strong the signal would be coming from an Opto-Isolator. See: screen shot (Yellow from Module & Blue out of Isolator). Way better then what I was expecting.
Will connect second Module and start the second level of electrical testing. Next spin of PCB will be a full operational test. To much patch work to get this board to that point.
Will update.
Thanks again
What is the (Minimum) level of RS232 Data/ASCII can the BS2xxx family properly detect? I know 5v is idea.
The Oscope is showing Data as low as 1v.
ex.: 1v, 1.5v, 3v 4.5v.
Thanks for any help
but according to SX Family User's Manual, almost all input ports are configurable as TTL or CMOS fashion.
If so, generally speaking, for logic high, at least 2.0V at TTL input, a half of Vdd at CMOS input.
Anymore inputs would be welcome.
Thanks again
From a quick scan of the opto docs, the input has a breakdown voltage of 5V max. RS232 can exceed this so you will need some protection here.
I think you need to explain your circuit a bit more. What are you sending RS232 from - both devices? What voltage swing do they have? How do you turn off the second port - is that via a switch to open the serial line? Are both devices true RS232 and by that I mean normally the TTL levels are inverted. RS232 transceivers invert the data.
Almost working per concept.
One (1) RS232 unit is turned off (NPN) during normal operation. The other unit is electrically (ON) but (ISOLATED) thru the Optoisolator from the MC (BS2p 48). The Isolator is (weighting) down the (1) I/O line that I am using. When (electrically) disconnected my OEM PCB (ALL) seems to be well. My short program detects the DATA from either unit.
Will try a (blocking) diode tonight. If that does not work, then redesign with electrical toggle ON/OFF concept.
Thanks again
Put a 10K pullup on BS P0.
Change R3 from 330R to 1K in series with a diode 1N4148 or 1N914 with anode to P0.
Replace R4 & D1 with 1K in series with a diode with anode to P0. This should work fine.
Personally i dont like the R1, R2, C1 circuit but i havent looked at the datasheet. I understand what they are doing, just dont see that its necessary.
Note resistor values i suggested are examples. Anything near that should be fine. Even 3K3 is ok.
-Phil
I checked the datasheet. Reverse input voltage must be limited to 5V. So I stand by my recommendation for an external reverse diode in RS232 applications, where negative voltages can reach -15V.
-Phil
+1 regarding a diode across the opto's LED and also too there was never any need for the extra RC on the opto so that R1 = 2k2 or more and the cathode could have been grounded. As for R3 that value is way too low for effective current limit (if the output of the opto is actually 5V) so just use 1k or more instead.
These are same 8PDIP size, and could simplify the circuit.
As I stated before, I had also designed in a Op Amp circuit not know what the Isolator output would be(to low). That part was not needed so I just added a jumper wire to by pass it. I had tried Diodes before on the I/O lines but with bad results on the BOE. Also during my research for this project, I found a cable that used the (D1/R4) layout. That's were that came from. R2 and C1 are from the Data Sheet and as I understand it, it's for the TEST POINT only (No Load).
I did try a Diode were the Op Amp jumper wire was installed and it did not work so I removed it.........Now I think it was a bad solder connection...1:00am soldering. After Phil mentioned about negative blocking Diode, I tried it again and it worked...A good night sleep helps with (0805) soldering. Thanks Phil.
WORKING: So now I have 2 RS232 devices using the same I/O line on my BS2p40 OEM. The Mag. Reader can stay ON (with blocking Diode Mouser:621-SBR2A30P1-7) and the other unit will work. For now the other RS232 unit is just coded (HIGH/LOW) for testing.
I will look into the Dual Isolator also. At $1.00 per PCB from ( ), I maybe able to afford 1 or 2 more spins to get it working.
Will start back on more testing and re-layout Tue.
will update
Thanks
But, the schematic you attached shows that the ground line is shared with devices, i.e. external device is NOT isolated.
And, silk print of your prototype board includes both "RX" and "TX": I didn't think your board needs BIDIRECTIONAL communication with external RS232 device. I think I misunderstood very much. I'm so sorry.