Create a galvanic isolation between 2 circuits with an optocoupler
What's an optocoupler? Well, on one side, we do have a input circuit is made with a Light Emitter Diode producing light when a courant is walking through the diode. Face to the diode, we do have a Photo-Sensitive transistor allowing the current to flow through it when it is excited with light.
Once the photo-transistor commuted, the current flow from the collector to the emiter. Since it is a transistor, there is also a voltage lost Vce(sat) between the emiter-collector (something about 0.25V for this optocoupler). This transistor works as an "open-collector transistor", it connect the load to the ground.
Remember, it is necessary to place a resistor on serie with the LED in order to limit the current in the LED. That diode has a Forward Voltage (VF) of about 1.25V and a max current of 60mA.
Here is a typical wiring (extracted from the test sample)...
And another sample like this one using another optocoupler (the MCT2E)...