- Motor drivers are an indispensable part of the robotics world as most of the robots require motors to work and to run the motors efficiently the motor drivers come in play.
- They are a little current amplifier; the function of motor drivers is to take a low-current control signal and then turn it into a higher-current signal that can drive a motor.
- Low-current control signal comes from a microcontroller (Arduino Uno in my case) which can give output in the range of 0-5V at 40mA maximum which is then processed by the motor driver to give higher current output i.e. 12-24V at 2-4A.
- Motor Drivers usually have two parts
- Pulse Width Modulation (PWM) interpreter circuit to control the speed of the motor in accordance to the varying input PWM from the motor driver.
- A direction control circuit to control the direction of the motor.
Step 1: PWM INTERPRETER CIRCUIT
- IRF250N MOSFET
- 10K OHM RESISTOR
- 2A DIODE*2
- 12V BATTERY
IRF 250N is a logic level MOSFET which converts 0-5 V input at the gate to the corresponding 0-Vmax (of the battery connected).
10K OHM resistor is a pull-down resistor which holds the logic signal near zero volts when no other active device is connected.
The diodes are used as a flyback diode. A flyback diode (sometimes called a freewheeling diode) is a diode used to eliminate flyback, which is the sudden voltage spike seen across an inductive load when its supply current is suddenly reduced or interrupted.
NOTE- Since an external battery is being used it has to be common grounded with the microcontroller. This is done by connecting the negative terminal of the battery to GND of the microcontroller.
Step 2: DIRECTION CONTROL CIRCUIT
- 8 PIN RELAY (58-12-2CE OEN)
- IRF250N MOSFET
- 10K OHM RESISTOR*3
- 3mm LED *2
The MOSFET used in this circuit is same as the previous circuit i.e. IRF250N but instead of giving PWM at the Gate we are just giving Analog High and Low because we just have to switch the Relay ON and OFF.
The Relay operates at 12V but Analog High received from Arduino is max 5V so we have used the MOSFET as a Switch here.
The Relay used (58-12-2CE OEN) is a 8 pin one.
- First 2 pins are coil energizers i.e. when they are powered they switch connectivity of Common from Normally Connected (NC) to Normally Open(NO).
- Common receives input for delivering it to the output (motor).
- NC receives power from Common when the coil is not powered and NO is disconnected.
- When the coil is powered NO receives power from Common and NC gets disconnected.
We are crossing over between NO and NC which will provide us with the change of polarity.
Two LEDs are connected in parallel to the output along with 10K ohms resistance both in opposite polarity. They will act as direction notifier as one will glow when current flows in one direction and Vice -Versa.
Step 3: THE MICROCONTROLLER
The microcontroller has 2 signals to deliver
- PWM for varying the speed of the motor.
- Analog High and Low for changing the direction of the motor.
THE CODE IS PROVIDED IN THE ATTACHMENT!
The output from PWM PIN 3 is connected to the Gate of PWM interpreter circuit.
The output from PIN 11 is connected to the Gate of Relay Circuit.
NOTE - If both the circuits are using same power source then only any one of them requires to be common grounded; if 2 power source is used then both the circuits need to be common grounded.
0 and 1 for direction
0-255 for speed; 0 to stop and 255 for maximum speed.
E.g = 1 255
IT IS IMPORTANT IT NOTE THAT PWM INTERPRETER CIRCUIT IS SUFFICIENT IN ITSELF IF THE USER IS JUST WILLING TO CHANGE THE SPEED OF THE MOTOR OR TO SWITCH IT ON AND OFF WITHOUT CHANGING ITS DIRECTION.
Step 4: SYSTEM INTEGRATION
After making all the components of the motor driver it's time to integrate all three of them i.e. the PWM interpreter, relay circuit with the microcontroller.
- The output of PWM interpreter is connected to the common of the relay.
- Both the circuits are connected to the battery using a PowerBoard. A PowerBoard is a safety circuit consisting a Capacitor(used to filter the input), Diode (to check the polarity of battery) and Fuse(to limit current) to protect the circuit in extreme conditions.
PowerBoard is not needed while the motor is under no load but while using the motor driver in a robot it is recommended to use it.
- Connect Gate on PWM interpreter circuit to pwm pin 3
- Connect Gate of Relay circuit to pin 11.
Step 5: DEVELOPMENT
- Initially, I was using a transistor to switch the relay but it was unable to handle the current flowing through it so I had to switch to MOSFET.
- I had used a capacitor between source and gate of the MOSFET to ensure no current flow between them but later I realized it not needed.
I WOULD EXPRESS MY SINCERE GRATITUDE TO MR. LAKSHMAN BHASKARAN FOR HIS VALUABLE ADVICES ON THIS PROJECT.