If you ever wondered how the Tesla proprietary charging port is built and how it works, search no more, as here is one of the best videos on this topic, provided by Ingineerix.
What we see above is the entire charging port, taken from a Tesla Model 3 (U.S. version) - it's basically the same in the Tesla Model Y. The European one is different, because it uses a CCS 2 Combo-compatible charging inlet.
Tesla developed its proprietary charging connector (specific inlet and the plug) for both AC charging and DC fast charging in the early days for the Tesla Model S, when there was nothing aside from the AC SAE J1772 and the clunky CHAdeMO for DC charging.
The manufacturer managed to create a very elegant, compact and easy to use solution for AC and DC charging, which turned out to be future-proof for charging at up to 250 kW (probably it might go even higher in the future).
The beautiful design is a shame for the entire automotive industry, which required years to agree and develop a DC charging standard.
The Tesla charging port is located on the driver's side rear end, in the light area. It has many smart solutions, including an inductive sensor (press to open the flap), detection of the flap position, motor to open and close the flap and an LED for status, as well as an actuator to lock the plug inside the inlet (for general safety and prevention from disconnecting when charging). There are also temperature sensors.
Inside the inlet, we can see two large current pins, a medium pin for ground pin (connected to the car body), and two additional signal pins (proximity and pilot).
To charge on AC, using a SAE J1772 plug, there is a need to use an adapter - Tesla provides those, and according to Ingineerix, it's just a mechanical adapter, as the Tesla charging inlet is functionally compatible with the SAE J1772.
The proximity line is used to detect whether the plug is latched securely, while the pilot line is used to provide communication. The state is determined through voltage (-12 V to +12 V), while acceptable current is determined through a 1 kHz square wave (duty cycle). That's in the AC charging. Tesla uses the pilot line for communication also with a Supercharger (using CAN signal).
An interesting thing is that in newer cars (Model 3/Y as well as the refreshed Model S/X), the circuit board in the charging port is ready to handle CCS charging standard with the use of a Power Line Communication (PLC) chip. Tesla most likely uses it globally now, but in the U.S. it's not yet utilized (we guess that it will be activated soon, to use the newly developed CCS1 adapter).
For now the Tesla charging system appears to not be designed to support bi-directional charging (power export feature).