蓝猫淘气

BUCK circuit with voltage closed loop

 
Overview

Working conditions: The input voltage must be greater than 28V, and the resistor outside the enable pin can also be changed to achieve adjustment.
Actual circuit: To change the value of the input and output capacitors, it is best to take a larger value, and the inductor should also use a relatively large value to reduce voltage ripple.
Circuit composition: Use EG3112 as the driver chip and LM358 as the op amp of the sampling circuit.
The code part only gives the PID part. If you need other parts, you can contact
the PID module code:
//Define PID variable structure
struct _pid{
    float SetSpeed; //Define set value
    float ActualSpeed; //Define actual value
    float err; //Define deviation value
    float err_last; //Define last deviation value
    float Kp, Ki, Kd; //Define proportional, integral and differential coefficients
    float voltage; //Define voltage value (variable for controlling actuator)
    float integral; //Define integral value
}pid;
 
//Initialize variables
void PID_Init(float Kp,float Ki,float Kd,float speed)
{
    pid.SetSpeed=speed; //Set value
    pid.ActualSpeed=0.0; //Sampling value
    pid.err=0.0; //Error
    pid.err_last=0.0; //Last error
    pid.voltage=0.0; //Output value
    pid.integral=0.0; //Cumulative integral value
    pid.Kp=Kp;
    pid.Ki=Ki;
    pid.Kd=Kd;
}
 
//Position PID algorithm
 
int PID_realize(float ActualSpeed)
{
pid.ActualSpeed=ActualSpeed; //Input actual value
    pid.err=pid.SetSpeed-pid.ActualSpeed; //Calculate error
    pid.integral+=pid.err; //Integral value
    pid.voltage=pid.Kp*pid.err+pid.Ki*pid.integral+pid.Kd*(pid.err-pid.err_last);
    pid.err_last=pid.err; //Assign the last error
    return pid.voltage; 
  }
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-13 10:10:51
  • A new choice for ATM monitoring system
  • Who has the minimum system diagram of Freescale's DSP: 56F8346 chip?
  • “It will take about a hundred years”! ! ! !
  • OverviewPICAXE- The Tinkerers' Delight
  • MicroPython now supports SPI driver for external Flash
  • Why does the DCDC circuit have inductor whistling?

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号