1
\$\begingroup\$

We are attempting to make an balancing system (with a reaction wheel) with current and angle PID control.

The whole circuit consists of a DC motor, a power supply, a current sensor, and an MPU6050 (for angle). The process of the system is that the angle PID control determines the amount of required current (in the form of duty cycle for PWM in an Arduino) and it passes current PID control to generate the amount of required torque (to keep it from over-current).

I did simulated parts of the entire system in Simulink and Matlab, but implementation matters.

enter image description here

Now I am working on the current part. First, I installed a current sensor (INA260) in the DC motor's + line, but the problem is that the current data should be continuous. The motor is controlled by PWM in the motor driver and so the data has much noise becayse of the PWM signals (I checked it by plotting on a PC).

I previously used an ACS758 analog current sensor but I failed to manage this problem then as well. As far as I know, using filters for the current signal could generate some delay in the system but I do not know some good way to get data together without a filter.

And how can I do current PI control? Is there any good solution for that?

enter image description here

  • PWM setting = 3000 Hz
  • MCU = Arduino Uno
  • MPU6050 (angle sensor)
  • MD30C (motor driver)
  • SPG300 (300 W DC motor)
  • INA260 (current sensor/shunt resister based/I2C/up to 15 A)
  • ACS758 (current sensor/Hall sensor/analog/up to 15 A))

Collected Current Signal:

enter image description here

\$\endgroup\$
1
  • \$\begingroup\$ your INA can't even do 1000 samples a second. figure out how many it can do, then you have a ballpark target for your filter. even at "just" 3k, you should have plenty of time to filter without dropping sample rate or bluring useable info. \$\endgroup\$
    – dandavis
    Jul 19, 2021 at 18:56

2 Answers 2

1
\$\begingroup\$

This is a year old question, and we have not heard back from the OP, but I thought I might make some suggestions in case someone else has a similar problem.

You can effectively eliminate noise on the current signal by sampling it right after the PWM signal turns ON. At least this should give a consistent reading proportional to current. And you could sample the 3 kHz PWM at perhaps 10 to 20 samples per second, and perform a quick true RMS calculation.

A Hall effect sensor is a good way to read motor current, but there are also high side current shunt sensors like the HV7800 and INA195 that are inexpensive and fast enough.

\$\endgroup\$
0
\$\begingroup\$

Analog low pass filter is mandatory for the ADC anti aliasing. You should increase the PWM frequency, use enough high sampling rate for the ADC with an analog LPF with a cut-off 1/3 x ADC sampling freq. Then process everything in the MCU using a digital LPF FIR filter. Of course there will be a slight delay that will limit the dynamics of the system, but not so much if done properly.

I guess you would need an MCU with enough resources (computation speed).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.