Hey guys,
I am making a TRUE RMS voltmeter which is directly connected to mains 240V. In order to isolate the output(UART), I have used a PC817C optocoupler.
As the diagram shows, the anode of the optocoupler is connected to 5V through a resistor, and the cathode is connected to TX, on the LIVE uC. Now comes my question.
When I connect the collector of the optocoupler to the Ground of the receiver (USB to Serial converter*), and the emitter to RX, I can receive the data correctly. I don't understand how. If I reverse the connections, there is a periodic output (at the frequency of original output values) of two characters (always the same two characters) but is not my data.
I thought the output of the optocoupler has to be biased like a typical transistor. What am I missing?
*(which is basically an Arduino UNO with its RESET pulled to Ground, giving access to the USB-UART function of the onboard Atmega16U2) (if its relevant)