PID DC motor control with current sense and limit

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
Artis
Posts: 10
Joined: Mon Jan 19, 2015 10:59 pm
Has thanked: 1 time
Been thanked: 1 time
Contact:

PID DC motor control with current sense and limit

Post by Artis »

Hello, i am starting to use Flowcode and i wonder if someone is make FC with PID control for DC motor where you can set limit for current. Current MCU will read like feedback and in flowcode programm you can set current limit witch are protect motor controler from burning. If someone have an idea have to make this FC?

Thanks Artis.

EtsDriver
Posts: 444
Joined: Tue Apr 15, 2014 4:19 pm
Location: Kajaani, Finland
Has thanked: 345 times
Been thanked: 227 times
Contact:

Re: PID DC motor control with current sense and limit

Post by EtsDriver »

Are you using any motor controller chips or etc?

If you use current shunt to monitor the motor, you have to set the program (using a serial, knob, or some other ways to control) some way to know when take a action.

I used in one desing 0.01ohm resistor and amplifier to feed 0-5VDC to my ADC input.

Take a look at this:
http://en.wikipedia.org/wiki/Shunt_(electrical)

Developing good DC-Motor driver takes time and if its application specific, and you will have to update the program if there is any problems with it later.
Ill just keep the good work up!

Artis
Posts: 10
Joined: Mon Jan 19, 2015 10:59 pm
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: PID DC motor control with current sense and limit

Post by Artis »

I am using AVR Atmega324p MCU, it makes PWM witch controls mosfets.
For current sensing i am using Current Transducer from LEM.
I almost finished with electronic and now i am starting with Flowcode programming and i am in dead end. If some one have a sample for motor control with PID control wich provide current sensing, please share.

Best wish Artis.

EtsDriver
Posts: 444
Joined: Tue Apr 15, 2014 4:19 pm
Location: Kajaani, Finland
Has thanked: 345 times
Been thanked: 227 times
Contact:

Re: PID DC motor control with current sense and limit

Post by EtsDriver »

Id share our system desing, but im not done the software, so i cannot give you the Flowchart. But basically idea is to take the currentshunt readback and make decision :
***calculate the current using I=U/R (R is high precicion current shunt resistor)

Motor startup ramp:
Set fets into way to drive <direction>:
while PWM value is not 1024 (Full Speed) AND user is pressing drive forward AND current is not over the MAX for xx seconds. (Remember the current can go too high, but it will stabilize when the motor is full speed)
then add pwm value xx


Full speed mode:
IS current OVER xxA?
If is,
IS motor Running?
if is, then STOP -->error condition one (Overcurrent).
else motor is not running: ERROR flag (error led lights up)

Motor STOP ramp
while PWM value is not 1024 (Full Speed) AND user is pressing drive forward AND current is not over the MAX for xx seconds. (Remember the current can go too high, but it will stabilize when the motor is full speed)
then remove pwm value 2*xx (we used this to make motor stop, some cases, it can blow your mosfets, but this motor was controlled by dedicated chip.)

This is all i can give, sorry.
Ill just keep the good work up!

Post Reply