# DC motor Controller Advice



## idle (Sep 1, 2015)

Hey guys,

I've been lurking on this page for probably close to 3-4 hours a day for the past week since given my senior design project for EE, an electric snowmobile. I have so far built a simple 555 timer circuit to run a (very) small DC motor, but I'm not seeing nearly enough current to run the DC motor when it comes to the actual application. I've tried my hardest to learn here, but as many of you surely know, what you are taught in school isn't always the best for applications.

So far, I've realized that 555 timers are not that accurate or efficient, and it seems that I should build a DC controller using a micro controller of some sort and digital PWM to an IGBT or MOSFET. I've been doing plenty of searching, but I though maybe someone could just suggest a few links to get me in the right direction. I'm at a bit of a dead spot, as I'm looking for some guidance to building the DC motor using a micro controller and some software. Thank you so much guys!


----------



## major (Apr 4, 2008)

Get the manual for the Curtis model 1204 DC motor controller. Study it. Appendix B gives some PWM theory. Try this, but if it doesn't work, google search for it. http://www.fsip.biz/Documents/1204_05.pdf


----------



## Duncan (Dec 8, 2008)

Hi Idle
Search for "Paul & Sabrina OpenRevolt" for an open source controller and a long long thread about designing it


----------



## bigmouse (Sep 28, 2008)

I've designed and built several iterations of both DC and AC controllers. The most important thing to get right as early as possible is the gate drive. The sooner you get gate drive figured out, the sooner you will stop blowing IGBTs/MOSFETs and the less money you'll waste on magic smoke.

This is the document that started me down the right path with that: http://www.pwrx.com/pwrx/app/bg2b_application_note.pdf

You can also find dev-boards for dedicated gate drive ICs. For a DC controller, you would only need one. Avago makes a really handy little single-channel board with a built-in power supply for their ACPL-32JT part.
http://www.avagotech.com/products/optocouplers/automotive/gate-drives/acpl-32jt-000e

You could probably ask them to send you a sample. Click the "request info" link at the top of that page and fill out the form. You just give it power and PWM and it will drive whatever power switch you connect to it.

As for generating PWM and control, you can either use a microcontroller if you're interested in learning to program one (easiest and most popular way to start these days is with Arduino). Otherwise, you can go the analog route and use a dedicated PWM controller IC. There are a ton of them out there. Make sure you find one that goes from 0-100% duty cycle. Many are designed for power supplies and max out at 50%. They should all have some sort of a current feedback by way of an error amplifier. (EDIT: Look up the MC3520. I've used it before and it's pretty straight forward. Should have all the functions you need for DC motor control built-in).

The route you take depends on what you want to learn. I would go with the Arduino myself, and implement a PI current controller to vary torque.

You'll need to measure the motor current either way. It's used to protect the motor and controller as well as control the torque being produced in a closed-loop way. For DC, a shunt and op-amp is a popular method. Hall effect sensors are more expensive, but easier to use in my opinion.

Have fun going down the rabbit hole. I started 8 years ago and never looked back.


----------



## idle (Sep 1, 2015)

bigmouse said:


> I've designed and built several iterations of both DC and AC controllers. The most important thing to get right as early as possible is the gate drive. The sooner you get gate drive figured out, the sooner you will stop blowing IGBTs/MOSFETs and the less money you'll waste on magic smoke.
> 
> This is the document that started me down the right path with that: http://www.pwrx.com/pwrx/app/bg2b_application_note.pdf
> 
> ...


Thank you for your detailed response. I'm looking over the PWRX website link right now; it's a very informative and detailed read so far.

As for the design of the controller, what did you mean by PI current controller?

Again, thank you so much for you time and response. Feel free to paste more links and information. I'm a senior with no job right now, so all my time is spent in research.


----------



## bigmouse (Sep 28, 2008)

idle said:


> As for the design of the controller, what did you mean by PI current controller?


A PI controller is a simple but effective control method. In a motor controller, it's what allows you to convert a throttle position to torque in the motor.

Torque is proportional to current, but not proportional to voltage. If you vary the duty cycle of your PWM, you're only changing the voltage. The trick is to find the right voltage that's needed to get the current and torque that you want. The voltage requirement changes with motor speed, so you need a control loop to set the voltage.

Basically, say you want 100 amps for current. You set 100A as the setpoint. If the motor current measures 40A, the error is 60A. This error is put in a formula which calculates the voltage required in an incremental way. Since 40A is less than 100A, it knows it needs to increase the voltage. It does so until 100A is reached (or until voltage maxes out).

There's a Proportional gain (P) and an Integral gain (I) in a PI controller. You can also have a Differential gain (D) to make a PID controller, but most controllers don't do this because the rate of change of the output compared to the loop frequency is relatively high (they are more often used in systems with slow-changing outputs and very steady readings (no noise).

Here's the wikipedia article: https://en.wikipedia.org/wiki/PID_controller
There are probably much better ways to learn about it than the article though. Check out YouTube for some explanations. I'm sure there are several on there that will explain it in an easy to understand way.

The article is heavy reading, but I find the psuedocode part of the page at the very bottom the most easy way to read it. Then again, I love programming.

Simply put, the proportional part takes up the bulk of the error and the integral part reduces the steady state error towards zero. Tuning is done by varying the gains. They remain constant for a given loop frequency (how often the controller runs in code). You need to tune the gains to find the compromise between overshoot and rise time. People make careers out of doing this, so don't worry if it seems daunting. Consider it a puzzle to be solved.


----------

