Gavonically Isolating the BS2 Serial poirt
Jason O
Posts: 16
Hello All,
For my application of the BS2, I need for the board containing the BS2 (which is running on batteries) to be gavonically isolated from the earth ground. But I also want to be able to connect it to the serial port for communications between it and my computer. The tricky part is that I'm using the same port connector to program the Stamp (all other I/O lines are dedicated to other parts of my circuit). I have already decided that I can just directly connect the stamp to a programming jack to program it, but during serial communications, I want to talk through an isolated line.
I looked around the web for solutions to this and found the following website here:
electronicdesign.com/Articles/ArticleID/6347/6347.html
I'm very tempted to go for this simple looking design, but It looks like they are pulling voltages off of serial pins other than the four required by the basic stamp. I have one of Parallax's USB to RS232 converters to connect to my computer but I'm not sure if it actually supplies voltage on the other unused pins.
Does anyone know if the schematic in the above website will work if I'm using the USB to RS232 converter rather than an actual serial port? If not, are there any other solutions to this problem that would work simply?
Thanks,
Jason O
For my application of the BS2, I need for the board containing the BS2 (which is running on batteries) to be gavonically isolated from the earth ground. But I also want to be able to connect it to the serial port for communications between it and my computer. The tricky part is that I'm using the same port connector to program the Stamp (all other I/O lines are dedicated to other parts of my circuit). I have already decided that I can just directly connect the stamp to a programming jack to program it, but during serial communications, I want to talk through an isolated line.
I looked around the web for solutions to this and found the following website here:
electronicdesign.com/Articles/ArticleID/6347/6347.html
I'm very tempted to go for this simple looking design, but It looks like they are pulling voltages off of serial pins other than the four required by the basic stamp. I have one of Parallax's USB to RS232 converters to connect to my computer but I'm not sure if it actually supplies voltage on the other unused pins.
Does anyone know if the schematic in the above website will work if I'm using the USB to RS232 converter rather than an actual serial port? If not, are there any other solutions to this problem that would work simply?
Thanks,
Jason O
Comments
That said, I do think that the Parallax/FTDI connector does implenent both the DTR and RTS flow control signals. If I were doing this on the 9 pin connector. It is not clear to me if both the programming and the isolated interface will use the USB adapter to the PC.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Regards,
Terry
The multi-pole switch sounds like a great idea. I just took the circuit from the website and redrew it so that a 4PDT switch can connect either the isolated side or the direct line to the DB9 connector. I attached the circuit that I came up with below. Could someone here take a look at it and let me know if I have it connected properly?
Also, I didn't short pins 1 and 2 of the DB9 connector in this diagram (I think I would have to add another switch to do that). I'm wondering how important this connection is and what it does? If it absolutely needs to be there, is there any other way I can connect those pins to each other (maybe with a diode or something) or do I need an extra switch for it?
Thanks,
Jason O
It would appear to work. Pin 1 can be safely ignored It is seldom used (except for connections to "real" modems, I think that EDN tied it to pin 6 to give it a signal "just in case". Just don't get in a hurry and move the switch during themiddle of a download...
Have fun,
Terry
Furthermore, I think it possible to program the Stamp through the isolated interface, if one were to duplicate the circuit attached to pin 3 of the DB9 (rx) and attach that in the same manner between pin 4 of the DB9 (dtr) and the Stamp (atn). Dispense with the switch!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Wouldn't the switch still be needed to isolate GND and ATN? Still, 2 poles are better than 4!
Just asking,
Terry
Using an opto-isolator for the DTR pin sounds like a good idea, but I was under the assumption that the input to the ATN pin needed to be higher than 5V in order for the EPROM to be erased (no idea where I got this notion from). SO if it's ok to run the DTR line in through the opto-isolator, then maybe I shouldn't need the direct ground connection either?
- Jason O
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Regards,
Terry
Ok, that is somewhat more reassuring. I only have one more question, and this is about the voltage levels involved in all of this. I know that the RS232 port input voltages are much higher than the 5V logic inputs that the optocouplers would use. On the BS2 module, I know that they have a setup of transistors that the serial port voltages go through and I'm wondering if these transistor would still switch on properly with the 5V logic input from the opto's? I haven't studied the circuitry on the BS2 board in-depth but I realize that they don't just map the signals directly to the microcontroller.
Thanks,
Jason O
The output tx from the Stamp is the collector of a PNP transistor, and that should be able to drive the (LED + resistor R1) in the optoisolator to nearly +5 volts . When the PNP is off, a resistor pulls down the line to the level on the rx line. That resistor is effectively the sum of the 1k resistor R2 on your circuit plus the 4.7k cross-coupling resistor inside the BS2IC. In a regular RS232-level circuit that would pull to some negative rs232 voltage, but ground is fine in this circuit.
The input rx and the atn inputs to the Stamp both consist of a 10k+10k voltage dividers into the base of NPN transistors. It takes about 0.7 volts on the base to turn on the transistors, so it takes something like 1.4 volts, make it 2 volts, at the input of the voltage dividers to register as high and turn on the transistors. The follower output from your optoisolator into R2 should come up to something above 4 volts when the optoisolator LED is on, and fall back to zero volts when the optoisolator LED is off, through R2 as pull-down resistor. So there should be plenty of leeway to hit the 2 volt threshold.
Some of the PCBs for mounting the Stamp include capacitors in the atn path (a good idea), and the isolator circuit could work with those too, if you choose to try out an isolator for ATN. There just has to be enough umph there to pass that 2 volt threshold.
Some improvement in speed might be had by fiddling with the resistor values or by choosing more efficient optoisolators, but I'd want to have a 'scope attached to observe the signals while doing the fiddling!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
I just thought that I would let you know what I ended up doing finally. I found an even better solution to the problem (and still got the full isolation that I wanted). I opted to go with Parallax's FTDI USB to RS232 IC since I can run it from the USB power directly and power the isolators at 5V TTL logic levels. I also used a really nice digital isolator IC rather than the LED counterparts, mainly because it was just plain simpler, used less power, and didn't require the extra resistors. I attached a copy of the schematic I came up with in case anyone would like to make one themselves. I'm still working on the schematic so you'll notice that the ICs, caps, and resistors aren't numbered.
God Bless,
Jason O