I want to build a DIY logic analyser that will feed the data to computer through UART. Because I can't power the whole circuit that I want to analyse via USB port, I need to isolate the communication somehow. So I decide to try opto-isolated UART. I bought some High Speed (up to 10MBd) TTL Compatible Optocoupler - HCPL-2631 and a logic inverter (74HCT04) since the optocoupler provides inverted signal. I wired it up according to the attached schematic.
I wrote simple UART program for the ATMega168, that just writes alphabet on the terminal screen, in order to test, if it's working. When I power the circuit shown on the image (according to the schematic) from the USB port (which means that +5V and +5C are both connected to the power source of the USB port and both GND and GNDS are connected to USB ground), everything works fine. The alphabet is displayed in the terminal window as it should. BUT when I power +5V and GND from my external power supply and +5C and GNDS from the USB port (which means that the circuits should be completely isolated), the signal is somehow corrupted and I see a mess in the terminal window.
Any suggestions why is that?
Thank you in advance.