Arduino DC Motor Speed & Direction Control Using Relays

by hIOTron IoT in Circuits > Arduino

11 Views, 0 Favorites, 0 Comments

Arduino DC Motor Speed & Direction Control Using Relays

Dc motor and direction control.jpg

We outlined how we can control the direction and speed of a 24v high current motor utilizing Arduino and two relays.

Supplies

Hardware Components

Arduino UNO

5v relay

Pushbutton switch 12mm

BC547

IRF540N

Potentiometer- 10k ohms

Three diodes 1N4007

Resistor 10k ohm

Connecting wires

About Project

Transistor

Here transistors are utilized to direct current from Vin pin of Arduino to relay which is managed utilized a push-button connected from digital pin to the base terminal of the transistor.

Arduino Purpose

It offers the amount of current required to turn on the relay also the transistor.

MOSFET

It is needed to handle the speed of the motor. The PWM value of voltage determines the speed of the motor. Current Calculations

The resistance of the relay coil is estimated utilizing relay which turns out to be = 400 ohms Vin pin of Arduino gives = 12v So current require to turn on the relay = 12/400 Amps = 30 mA

Working of the bidirectional motor

When no pushbutton is pressed:

In this case, no current flows to the base of the transistor, hence the transistor remains off behaves as an open switch.

When one push button is pressed:

Some current runs to the base of the transistor via a pressed push button which turns it on. Instantly current simply flows to the relay coil from Vin pin via this transistor which turns this relay (RELAY A) on and the switch of this relay is thrown to NO position. This is the clockwise motion of the motor.

When another push button is pressed:

Here other relay turns on. Now current simply flows to the relay coil from Vin pin through the transistor which turns this relay (RELAY B) on and the switch of this relay is driven to NO position. This is the anticlockwise rotation of the motor.

When both pushbuttons are pressed:

Here current moves to the base of both transistors because of which both transistors turn on (acts like a closed switch). And thus both relay is now in NO position.

Controlling the Speed of DC Motor:

MOSFET is switched on and off at high PWM frequency voltage and since the motor is attached in series with the drain of MOSFET, the PWM value of voltage defines the speed of the motor.

Internet of Things Course will give a thorough view of Customized IoT Solutions.

Run a Program

int x; int y; void setup() { pinMode(2,OUTPUT); pinMode(3,OUTPUT); pinMode(6,OUTPUT); pinMode(A0,INPUT); } void loop() { x=analogRead(A0); y=map(x,0,1023,0,255); analogWrite(6,y); digitalWrite(2,HIGH); digitalWrite(3,HIGH); }