Programming a closed loop circuit in Arduino

Hello to all.First sorry if my English is poor. I have a question, Actually I have to control speed of AC motor by sensing voltage and current by Arduino and then switch the Mosfets. My block diagram is the same as below picture: |500x249 How could I program that. I mean my problem is that I don't know how to program a closed loop circuit. Very thank you.

For programming a closed loop, PID can be used. PID_v1.h library helps for this.

Check the link for details

Hope this helps.

I don't understand the control loop; it does not seem to make sense. Can you explain the objective and how the loop achieves the objective?

Discrete control is a bit different from continuous (analog) control. Digital computations are performed in discrete time steps, not continuously. Similarly a motor is not normally powered by a synthesized sine wave, instead the polarity of the supply voltage is continuously reversed, and eventually cut off for the fraction of a cycle, to limit the current. Controlling AC motors is difficult, instead mostly brushed or brushless DC motors are used. And in most cases you don't want to control the motor current, instead you want to control the motor speed, as measured by a rotary encoder. Cheap motor driver modules are available for DC motors, but not for mains voltage AC motors.

Are you bound to a specific motor? Tell us more about your project.

Dear leoncorleone

Use Matlab - Arduino integration tool for this.

you may easy to create closing control loop very easy.

best regards.