In the need of controlling a 7A 20Volt DC Motor i designed a speed controller with some cheap components. The circuit is a digital circuit and works with Pulse Width Modulation (PWM) which is one of the best ways to control a dc motor. This circuit can drive up to 33A 10V DC motor with a big heat sink placed on the switching mosfet.

Summarily i used in this circuit, the AVR ATtiny13 to control the PWM , a n-mosfet IRF540N for switching the motor and a Rotary Encoder to adjust the PWM Duty Cycle.

Note. The same circuit can be used as a light dimmer for LEDs.

The circuit consists of:

The Power Supply.

It is a basic LM7805 power supply which adjusts the voltage at 5V for powering the ATtiny13 and the LEDs. Capacitors before the LM7805 C10, C7 and after C8, C11 have been used for noise filtering. Diode D1 1N4001 is there to protect the circuit from inverting voltages.

The main circuit.

The main circuit can be separated in 4 sub circuits to be more understandable.

   The LEDs

3 Leds have been used for indicating PWM Duty Cycle value: Minimum (LED3), Maximum (LED2) and the Current Value (LED1). LED2 and LED3 are connected directly to the ATtiny13 I/O. LED1 which indicates the current PWM Duty Cycle value is driven by the transistor T1 BC337 triggered by the PWM output. R1 R3 and R4 are current limiting resistors for LEDs. R2 Limits the current draw to the BC337 base.

   The Rotary Encoder

This is the Rotary Encoder connected with the appropriate components to work properly. R6 and R5 are pull up resistors which "pulls" A and B pins to VCC. Pin C is directly connected to GND. C4 and C3 are decoupling capacitors which are appropriate for noise filtering. If you don't place them the noise will be not filtered and the rotary probably will not work.

   The Motor Switcher

For Motor Switching i have used a n-mosfet IRF540N which can Continuous Drain Current, VGS @ 10V 23-33A depending on the temperature (25C-100C). Diode D2 has been placed for inductor inverting voltages. Capacitor C1 is there to filter the noise provided from the motor. If you don't place this capacitor you may have noise at the rotary encoder and it will not work properly.

Make sure you have placed a heat sink on the IRF540N because at high currents it is getting realy hot!

Here you can find photos of the test circuit i built.

DC Motor Speed Controller DC Motor Speed Controller

 

The code and the Circuit Scheme can be found:

DOWNLOAD HERE

Related Posts

18 thoughts on “DC Motor Speed Controller

  1. I would suggest you to put a buffer and a small current limiting resistor in the gate of that MOSFET. I cannot get why motor injects noise into the rotary encoder circuit btw.

    1. MOSFET GATE does not draw current (it is very small) so there is no need of current limiting resistor

      1. Actually, the gate is a capacitive load. So it will draw as much as current it can, but degrading very very fast. A small current limiting resistor with small wattage not only limit the current to the maximum value that microcontroller source, it may blow up like a fuse in case MOSFET is damaged. In addition to the buffer, this will be extra safety. I have read about it in: http://www.4qdtec.com/mostest.html. Go down and read "Dead MOSFETs". Well maybe it is an overkill 🙂 Nice project by the way! You have put a lot of thought in its functions, that's great!

          1. Had you made any improvements according to what Abdullah said? I would be interesting to see them.

  2. I have few question:
    *thik wires is needed just at the output of circuit right? becuse high current
    *if I want to control a simple toy DC motor I must make changes in the circuit like removing the FET amplifier and D2 .

    1. Thick wires is needed where high current flows. No you don't have to make any changes, it will work as it is, but if you want you can replace the FET with a smaller one but there is no reason. D2 must be there for reverse currents produced by the motor on start stop or speed change. 

       

      For me don't change anything. Only if for some reason you can't find this specific FET replace it with another which meets your needs

  3. Thanks for such a nice thinking.The ckt. is very handy,chiper and looking impressive as well.Sir kindly suggest me that what we have to change or modification in the circuit if we use the same circuit to very the180vdc to vary the rpm  (180v voltage input type motor) of 2 hp motor.
    plz help me sir.
    thanks very much
     

  4. Does the device increase the output current? For example if the input adapter has 12V 2A, can it supply 12V 5A DC motor?

    1. No no… 🙂 there isn't any device that can increase the output current without reducing the output voltage 

  5. Hi What is the PWM frequency? as you may know different types of motor require different pwm freqencies. Also if the frequency is too low it can damage the motor over time. If the frequency is selected properly a good battery saving can be made. I have developed a precision pwm motor speed controller using an 8 pin pic using a standard 10k potentiometer ;o)

  6. Hi, sorry for my bad english

    I'm interested in this construction but I have a problem
    When you burn main.hex to the processor and turn it on
    so only shines min. and max. LED and motor does not rotate
    You know what might be the problem?

Leave a Reply

Your email address will not be published. Required fields are marked *