Integration of signal
Sorry, but.. Why integration? Just use a peak detector like this one:



The output will "float" to the peak value of the input signal, minus the voltage drop across the diode:



The output oscillates between 9.7V and 9.2V, which is a 5% maximum error. If you want to reduce it, sample with a sample rate not multiple of 50Hz and average the measures.

The RC constant is 500ms. This means that it will require less than a second to pass from a value to a lower one:



Here in almost 500ms it will go from 10V to 5V.

If you want to reduce the diode effect (9.7V instead of 10V) use a schottky diode. This, however, will not reduce the 9.2V effect.

You should divide by 2 the voltage; you can either


divide it before the diode (but then the diode effect will be more evident - you can however correct it in software
divide it after the circuit (In this case, replace the 500k resistor with two 250k resistors and take the voltage in the middle)


Of course 500k and 250k are not standard values, but you can use any nearby value without affecting the behavior