低側(cè)電流測(cè)試
低側(cè)電流檢測(cè)可能是最常見(jiàn)的電流檢測(cè)技術(shù)。主要原因是它既不需要高性能PWM抑制電流檢測(cè)放大器(如在線檢測(cè)放大器),也不需要支持高壓的放大器(如高側(cè)放大器)。
采樣電阻始終置于低側(cè)MOSFET和地之間,確保放大器的端子上始終具有非常低的電壓。這種方法的主要缺點(diǎn)是,由于只有相應(yīng)的低側(cè)mosfet開(kāi)啟時(shí),通過(guò)采樣電阻的電流才是相電流,而我們只能在這些時(shí)刻測(cè)量到相電流。PWM頻率通常為20至50 kHz,這意味著低側(cè)MOSFET每秒開(kāi)關(guān)20000至50000次,因此PWM設(shè)置和ADC采集之間的同步非常重要。
目前這個(gè)在開(kāi)發(fā)中。
這個(gè)是高測(cè)測(cè)量一般也不用
https://www.ti.com.cn/product/cn/INA240
https://www.1cnz.cn/analog/202007151246626.html
https://zhuanlan.zhihu.com/p/401573207
https://www.sohu.com/a/439655421_468638
https://baijiahao.baidu.com/s?id=1753450617334241521&wfr=spider&for=pc
https://m.elecfans.com/article/1107269.html
https://www.1cnz.cn/d/1412716.html
// IN1 pwm1 9 27
// IN2 pwm2 6 26
// IN3 pwm3 5 25
// INH1 enable1 8 12
// INH2 enable2 7 13
// INH3 enable3 4 14
// in-line current sense - phase 1/A 35
// in-line current sense - phase 1/C 34
#include
class LowPassFilte
{
public:
LowPassFilte(float Tf); // 低通濾波器時(shí)間常量
~LowPassFilte() = default;
float operator()(float x);
float Tf; //!< 低通濾波器時(shí)間常量
protected:
unsigned long timestamp_prev; //!< 上次執(zhí)行時(shí)間戳
float y_prev; //!< 經(jīng)過(guò)上次執(zhí)行后過(guò)濾到的值
};
LowPassFilte::LowPassFilte(float time_constant)
: Tf(time_constant), y_prev(0.0f)
{
timestamp_prev = micros();
}
float LowPassFilte::operator()(float x)
{
unsigned long timestamp = micros();
float dt = (timestamp - timestamp_prev) * 1e-6f;
if (dt < 0.0f || dt > 0.5f)
dt = 1e-3f;
float alpha = Tf / (Tf + dt);
float y = alpha * y_prev + (1.0f - alpha) * x;
y_prev = y;
timestamp_prev = timestamp;
return y;
}
LowPassFilte LF_a(0.01); // 原始數(shù)據(jù)濾波器
LowPassFilte LF_b(0.01); // A相電流濾波器
LowPassFilte LF_c(0.01); // C相電流濾波器
// AS5600編碼器支持spi,iic和模擬量三種數(shù)據(jù)傳輸方式,這里用iic(同時(shí)也是最常用的方式)
// magnetic sensor instance - I2C
MagneticSensorI2C sensor = MagneticSensorI2C(AS5600_I2C);
TwoWire I2Cone = TwoWire(0);
// BLDC motor & driver instance
BLDCMotor motor = BLDCMotor(11);
BLDCDriver3PWM driver = BLDCDriver3PWM(27, 26, 25, 12, 13, 14);
InlineCurrentSense Cs_motor(0.001, 50.0, 35, 36, 34);
// voltage set point variable
float target_voltage = 5.0;
// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char *cmd)
{
command.scalar(&target_voltage, cmd);
}
void setup()
{
// initialise magnetic sensor hardware
I2Cone.begin(18, 5, 400000);
sensor.init(&I2Cone);
// link the motor to the sensor
motor.linkSensor(&sensor);
// power supply voltage
driver.voltage_power_supply = 12;
driver.init();
motor.linkDriver(&driver);
// aligning voltage
motor.voltage_sensor_align = 5;
// choose FOC modulation (optional)
motor.foc_modulation = FOCModulationType::SpaceVectorPWM;
// set motion control loop to be used
motor.controller = MotionControlType::torque;
// use monitoring with serial
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);
// initialize motor
motor.init();
// align sensor and start FOC
motor.initFOC();
// add target command T
command.add('T', doTarget, "target voltage");
Serial.println(F("Motor ready."));
Serial.println(F("Set the target voltage using serial terminal:"));
_delay(1000);
Cs_motor.init();
}
void loop()
{
// main FOC algorithm function
// the faster you run this function the better
// Arduino UNO loop ~1kHz
// Bluepill loop ~10kHz
motor.loopFOC();
// Motion control function
// velocity, position or voltage (defined in motor.controller)
// this function can be run at much lower frequency than loopFOC() function
// You can also use motor.move() and set the motor.target in the code
motor.move(target_voltage);
// Cs_motor.getPhaseCurrents();
Serial.print(LF_b((Cs_motor.getPhaseCurrents()).a));
Serial.print(",");
Serial.println(LF_c((Cs_motor.getPhaseCurrents()).c));
// Serial.print(LF_a(analogRead(35)));
// Serial.print(",");
// Serial.print(LF_b((3.3 * ((float)analogRead(35) - 1930) / 4096.0) * 20.0));
// Serial.print(",");
// Serial.println(LF_c((-3.3 * ((float)analogRead(34) - 1930) / 4096.0) * 20.0));
// user communication
command.run();
}
-
開(kāi)關(guān)
+關(guān)注
關(guān)注
19文章
3136瀏覽量
93601 -
IGBT
+關(guān)注
關(guān)注
1266文章
3790瀏覽量
248903 -
MOS
+關(guān)注
關(guān)注
32文章
1269瀏覽量
93689 -
功率器件
+關(guān)注
關(guān)注
41文章
1760瀏覽量
90417
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
評(píng)論