Pages

Sunday, June 26, 2011

High current motor control using relay

Source : http://www.e-shore.com.my/
(MOSFET + Relay to drive the motor)
210820101431
Basically, the circuit is using relay (2 set of Relay for each Motor) to switch the direction of the motor and MOSFET (1 set of MOSFET for each Motor) to control the speed of the motor. I will divide the MOSFET + Relay circuit into 3 part for the description, hope that you can completely understand the schematic.

Part 1: Relay

image
This part is basically about how microcontroller output ports drive Relays. I hope you understand about how a Relay operate or you can read more about Relay here. To control a Relay from microcontroller, you need to convert the digital output signal (normally 0V for logic 0 and 5V for logic 1) from microcontroller to the coil voltage of the Relay, in this case 12V. For your information the INPUT1 and INPUT2 pin should be connected to microcontroller.
When the INPUT1 is logic 1, which is 5V, the Q1 will be turned ON, which also means RELAY1 pin will be shorted to GND. What happen here is the K1 Relay will be turned ON. The K1 Relay coil, Port 1 is actually connected to 12V by default and now Port 2 is shorted to GND (due the Logic 1 output from INPUT1) which complete the circuit and turn ON the K1 Relay.
However if the INPUT1 is logic 0, which will turn OFF the Q1 transistor, and RELAY1 pin will no longer shorted to GND. This will break the K1 Relay coil circuit and the K1 Relay will be turned OFF.
The similar description goes for INPUT2, Q2 Transistor and K2 Relay, which is another set of Relay.
image
Looking at the Relay and Motor, try to focus on how the NC (Normally Close), COM (Common), and NO (Normally Open) is connected to the Motor terminal (labeled M1 and M2). M1 and M2 is basically connected to the COM of both relay, NC of both Relay is connected to 12V and NO of both Relay is connected to MOSFET, where it will be shorted to GND when the MOSFET is turned ON (this will be discuss on the next part).
image
Looking at the diagram above, when K1 is turned OFF and K2 is turned ON, terminal 1 of Motor is connected to 12V, and terminal 2 of Motor is connected to GND. Depend on your Motor, let say, if we apply +ve at terminal 1 and –ve at terminal 2, the direction of the Motor will be Clockwise. To make it Counter-Clockwise, all you have to do is turn ON K1 Relay and turn OFF K2 Relay.
image
Now, when K1 Relay is turned ON and K2 Relay is turned OFF, terminal 1 of the motor is connected to GND and terminal 2 to the 12V, which will make the motor Counter-Clockwise.
So, whichever Relay is turned ON, that side of Motor terminal will be connected to GND, and when Relay OFF, that side of Motor terminal will be connected to 12V. What will happen if you turn ON both side of Relay? The answer is simple, both terminal of Motor will be shorted to GND, and nothing will happen, the Motor is in OFF condition or BRAKE condition. The same thing happen if you turn OFF both side of Relay.

Part 2: MOSFET

From the Part 1, you’ve already able to control the direction of the Motor or turn OFF/BRAKE the motor, now, this MOSFET part will let you control the Speed of the Motor. More information about MOSFET here.
image
The circuitry above, is basically the MOSFET Driving Circuitry, that convert the PWM output from Microcontroller at logic 5V to Logic 12V. This MOSFET Driving Circuitry also invert the PWM signal from Microcontroller. In the other words, when the output from Microcontroller is 5V, the output of MOSFET Driving Circuitry will be 0V, and when the output from Microcontroller is 0V, the output of MOSFET Driving Circuitry will be 12V. Don’t worry about the inverted signal from Microcontroller, you can re-invert the PWM output from Microcontroller in your programming to make it right. For example, let 0% PWM for full speed, 50% PWM for medium speed and 100% PWM for zero speed. This can be easily done in your coding.
There is a reason that you need all those transistor and resistor simply to drive a MOSFET. For IRF-Z48 N MOSFET, you can actually connect the PWM output from microcontroller directly to the G of the MOSFET to drive it. It will function correctly, but this will cause the internal resistance of the MOSFET to be higher compare to driving it using 12V logic. For X-Combat, the motor require very high current (up to 40A), and if we drive it directly using Microcontroller PWM output, the MOSFET will be overheated and spoiled. Depend on your application, you can also duplicate the MOSFET circuitry and connect them in parallel to get higher current output. For X-Combat robot, we use 2 set of MOSFET for each Motor.
I would like to add in something about PWM, in case you are not sure about what is PWM. Wiki for PWM, click here. PWM is basically Pulses in certain frequency, that the Pulse Width is changing. Imagine this, let say, you can now control your Motor using a push button, if you press it, the Motor will run and if you release it the Motor will turned OFF. Try to keep pressing and releasing the button in some frequency, and you will notice that the Motor is running not at full speed, probably around half speed, and maybe not so smooth. Back to PWM, the Pulses in your PWM signal is actually similar to how you press the button, but the PWM signal is able to perform very smooth, constant and higher frequency, compare to your hand. The frequency is fast enough that you will get a very nice constant speed output from your Motor instead of turning ON and OFF motor respond when you do it with your hand (pressing the button). In PWM it is not only ON and OFF, but you can also control how long it ON and how long it OFF. In one Pulse cycle, if you turn it on for 50% of the whole cycle, you are actually giving 50% of speed to the motor, and you can give any percentage you want (depend on your PWM specification), from 0% speed to 100% speed.
image
Back to the big picture of the schematic, the task of the Relay is to control the direction of the Motor, by connecting Motor terminal to either 12V or the MOSFET Circuitry. When any terminal is being connected to the MOSFET Circuitry, it is not necessary that it is shorted to GND. The MOSFET circuitry will now connect that terminal to GND in some frequency and Pulse width controlled by the PWM output from Microcontroller. So, that’s how the Relays control the direction and the MOSFET control the Speed working together to control a Motor.

Part 3: Flyback Diode

image
Wiki for Flyback Diode here. D1, D2, D4 and D5 is actually the “Flyback Diode” for the motor. Flyback Diode is a diode (Schottky type Diode) normally found in circuit that involve any inductance load, in our case here, the Motor. Motor is actually a high inductance load, that will produce a lot of electromagnetic noise that will effects our Microcontroller. Depending on your application, you will need high current Schottky Diode if you are using High Current Motor. In X-Combat we use Schottky Diode that support up to 16A.
The C1 is a Multilayer Capacitor 0.1uF to help in filter out noise.

High Current Application

Another important point you have to remember in building High Current circuit is the connection wire use in the circuitry. You have to make sure that the connection, either soldering line, or wire or connector, from the battery terminal to the Motor must be enough to support the current required for the Motor.
You can see all the “big” wire soldering line for the connection in the circuit for X-Combat.
210820101426
Connector is also important, that it support enough current for your application.
210820101428
I hope you can understand all my explanation, and feel free to leave comment if you have any doubt.

No comments:

Post a Comment