1
\$\begingroup\$

I'm trying to make a USB to 20mA loop converter to connect to Siemens S5 PLC. I asked a question about selecting a good optocoupler to convert the signals here @Marko Buršič helped me with a schematic of a RS232 to S5 converter I used that circuit and replaced the Max232 chip with a CH340 (uart to USB) chip. In software when I initiate a connection to the PLC it begins to transfer and transfer some of data correctly but after a few seconds it losses its connection. I used a logic analyzer to capture the signals at the CH340 pins and it shows that in the middle of the connection it losses the connection. You can see this capture here

How can I find where the problem comes from?

PS:I used Marco's schematic and modified it to resemble my circuit.Thanks Marco Sorry I know it's shame that you draw the schematic for me.

enter image description here

I am using 4N25 instead of 4N37.

I used a 1.5Mohm instead of 220Kohm resistor on base of the optocoupler.

I don't have LEDs on signal lines of PLC.

I used pin1 of PLC as The picture below it is also connected to PLC ground. enter image description here

PS2: I uploaded a screenshot of the error shown on S5W When I tried to connect to PLC.

enter image description here

PS3: Today I find my RS232 to Siemens S5 cable and captured the(Tx and RX of Max232 IC on this cable) signals during connection. I compared these signals with my prototype of USB version cable. At the beginning all the signals are the same but at the middle of the connection the signals from PC to PLC differs from when the signals on RS232 cable. I upload a picture of the moment that these signals differ(before this time all the transactions are the same). How can this problem arise?

enter image description here

Please Help me this cable is driving me crazy!

\$\endgroup\$
  • \$\begingroup\$ @Marko Buršič Marko Would you please help me with the new problem? \$\endgroup\$ – Masoud Sep 3 '17 at 11:19
  • 1
    \$\begingroup\$ Draw a schematics of the converter and post it. You can also draw it by hand and post a scan. \$\endgroup\$ – Marko Buršič Sep 3 '17 at 12:01
  • 1
    \$\begingroup\$ We are no psychics and require full schematics. But you probably need an oscilloscope. \$\endgroup\$ – Turbo J Sep 3 '17 at 12:02
  • 1
    \$\begingroup\$ @Masoud: You need to post the schematics and images in your question - not as links otherwise the question becomes useless when the links die. Also, the easier you make it for your readers the more likely you are to get answers. \$\endgroup\$ – Transistor Sep 3 '17 at 12:31
  • \$\begingroup\$ Pin 1 is reserved for cable shield, not the same ground for signals. \$\endgroup\$ – Marko Buršič Sep 3 '17 at 13:58
1
\$\begingroup\$

Once again:

schematic

simulate this circuit – Schematic created using CircuitLab

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thanks I used your schematic to draw my real circuit. Would you please give me you opinion? \$\endgroup\$ – Masoud Sep 3 '17 at 13:37
  • 1
    \$\begingroup\$ Thanks, Today I found an other USB to UART converter of CP2102 chip and with your circuit it works fine. My problem was not a hardware bug but a bug in the driver of CH340G. Please be aware of this rubbish Chinese chips. \$\endgroup\$ – Masoud Sep 16 '17 at 8:06
  • \$\begingroup\$ @Masoud Thank you for your feedback. Keep informing, I saw many new converters using CH340G. Luckily, I have only FTDI and CP210x in my devices. \$\endgroup\$ – Marko Buršič Sep 16 '17 at 15:26
  • \$\begingroup\$ Thanks for your kind suggestions Marko Without your help I couldn't solve my problem. Today I tried this circuit with a USB to UART converter with PL2303TA chip inside and it had the same problem as the CH340G chips. \$\endgroup\$ – Masoud Sep 18 '17 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.