Weird Serial RS232 Problem

Hi,

I'm having a very bizarre problem with RS232 output.

I need to control a home theater processor with an Arduino.

The Arduino receives custom IR signals, using the IRLib.h library, and outputs RS232 signals using the standard Serial library.

For debugging, I used first the SoftwareSerial library, but it turned out that at the needed 115200 bauds rate its timing are completely off.

The regular TX Arduino pin goes to a TTL to RS232 converter. The Arduino is powered by a 12V power supply, so that it can work without having to use its USB input. The TTL converter is powered by the 5V Arduino output. I measured it, it does output the same 5V whether I use the 12V power supply or I connect the USB port to the PC, as expected.

So, I upload my sketch first with the TTL/RS232 converter not being plugged in the TX/RX pins (otherwise there is a conflict preventing the output), then connect the converter.

If I monitor the RS232 output on a PC, using the Realterm software, if works perfectly. Realterm shows that my sketch is sending the correct codes, and that the TTL converter is working fine.

Bu if I try to connect the home theater processor, the processor reacts to the RS232 commands only if the Arduino is also connected to my PC via USB.

I scoped the RS232 output with and without the USB connection.

I attach both screen captures, they are practically the same.

I also tried to plug an USB power supply to the Arduino, rather than plugin the PC, thinking that maybe the Arduino does need some power from the USB in addition to the 12V in the Power in pin, but does not help. The setup works only if the Arduino is connected to a real PC USB port.

Any idea why?

With USB.gif

Without USB.gif

What type of Arduino do you use?

If its a 32u4 based product, a while (!Serial); in setup will stop until there is a connection.

I use an Arduino Uno.

But I just found out the problem: it works when connected to the PC because the PC is connected to the mains ground, while my 12V power supply was not.

Connecting the Arduino ground to the mains ground made it work without the USB connection.