Can we apply 220V mains to uConroller ADC pins over high ohm resistor .(transformerless measurement).
I think that it can be. But i need your experience.
Best Regards
If you only need to detect presence of 230 volts you could feed it to an optocoupler and detect with the mirocontroller if you get a 50 or 60 Hz signal (zero crossing).
It is also possible to use rectifier resistors capacitor and protection diode and directly connect the result to an adc input. But you must beware that you are no more isolated from mains which is a very dangerous condition !!
No aim is measurement...yes i agrre with you diode and capacitors should be.... I dont want to use an optocoupler because every optocoupler has different led diode parameters(voltage current). So each opto will be need calibration. I had seen a zero crossing circuit in microchip datasheets but i want to inform some knowledge (experience) before apply that circuit.
Regards.
Alost any opto-coupler can be used in applications like this and there is NO calibration involved whatsoever..
For safety reason and for isolation consider the use of opto..
ofcourse you can use for main voltage monitoring, a divider and you have also to add a continious component at 1/2FS to perform the correct measurements, but the better way is to use a trensformer or an optocoupler for safety reasons as IanP said.
approximately all of the small offline UPSs(for 1 pc) use non isolated main voltage measurement.
a rectifier and one or two rc filter(with voltage divider via resistors).
also you can use a voltage follover to input mcu.
i don't think you will face any problem.