Measuring 230V from Raspberry Pi
The industry-standard way of doing this is to use an optically-isolated coupler. The proper industrial method is to use a modular system where you can select a module for mains power input and logic-level output.  For example this AC input, 5V logic output module from Opto22:



If you were designing your own circuit, you could do an equivalent with an opto-coupler component such as a TIL111 or one of the MOC series. An example circuit: