Use Arduino PWM to control a boost converter

Hello!
I am trying to design a boost converter. The input is variable which is around 20V. The output is stable at 50V. The current is about 4A.
And I want to use Arduino as a feedback controller to produce a PWM signal to control the MOSFET in the boost circuit.
The output of Boost circuit is connected to the analog input of Arduino. The PWM output is connected to the gate of MOSFET.
As a result, it is a closed-loop circuit.

As I imagine,
at first, I use a divided resistor to get a low voltage output from boost circuit like 5V.
Secondly, the 5V is used as the analog input of Arduino.
Then, Arduino can compare this 5V with a reference value like 4V. If the input is higher, it will reduce the duty cycle of the PWM output.
If the input is lower than reference, increase the duty cycle.

In this way, the output of Boost circuit could be stable with a variable input.

But I have some questions which are:
1.The MOSFET I have right now is IRF640. Can Arduino output connect to it directly? Or I need a drive circuit to ampify the PWM signal? Or I need buy some other MOSFET like IFLXXX?

  1. Can Arduino analog input pin read the output of Boost circuit? Cause the wave I observed in matlab seems built by high frequency sinusoid wave.

  2. Is my assumption gonna be possible?

And my board is Arduino UNO

Thanks for any help!!!

It might work, but it also might go wrong.
The voltage divider is how to read the output.
If the load is a resistive load, and uses a nice steady current, it will work.
The Arduino is fast enough to act just like an hardware control chip.
If the load is a motor or a blinking light, the sketch with the circuit could go oscillating.
Have you made a closed loop controller before ? If this is the first one you pick a difficult one.

The mosfet is a normal mosfet that needs about 9V at the gate.
Look in the datasheet at the curve for Id and Vgs (Gate-to-Source Voltage), it starts at 4V and is 'on' at 9V.
You need a logic level mosfet.

zsdzsd:
Hi,
I'm really thanks for your reply for my post.

U said that I need to get a logic level MOSFET. But it seems that most of the logic level MOSFET cannot satisfy the power requirement.

Can I add a drive circuit between the Arduino output and mosfet input?

If so, do you have any recommendation for what type drive circuit I should use

Thanks!

4A is not that much.
Sparkfun has selected very usefull mosfets, for example this one, N-Channel MOSFET 60V 30A - COM-10213 - SparkFun Electronics
The input capacitance is more than 1nF. I don't know how high the frequency will be.
You need a resistor of 100 ohm from the Arduino pin to the gate because of that capacitance.

You could lift the gate to 12V. There are even special mosfet driver chips for that, like the UCC27424.
They blast a large current into the gate, to reduce the effect of the capacitance.

But I think a logic level mosfet is easier.

Is the 4A figure the required output current , or is it the input current.
Makes a big differance to the design.