PF

Hello everyone,
I am currently having some problem concerning programming and i wanted your help. I am using a boost converter to correct power factor and in order to trigger its mosfet i have to do some programming.
So the output of the boost is in dc voltage and is 20V. The arduino must read this value and subtract it from a reference value 25 to get an error value. I know that arduino can read only between 0-5V. This error value is then fed to a PI controller whose differential equation is y(k)=y(k-1)+0.01u(k)-0.02u(k-1), where u(k) and y(k) are the initial values and u(k-1) and y(k-1) are the previous values respectively.All this has to be programmed. Then the output of the PI controller is multiplied with a full wave rectified voltage waveform which also needs to be sensed at the input of the arduino. Afterwards, the output is added to another rectified waveform which also needs to be sensed to get the final output to go to the mosfet.

Can anyone help please?? I want the programming codes. Thanking you all in advance.

A hardware solution would be far more efficient and reliable.