0% found this document useful (0 votes)
43 views6 pages

DIY - Relay Switch Motor Controller - Arduino - 4 Steps (With Pictures) - Instructables

This tutorial provides instructions for building a motor controller using an Arduino and two relay switches. It details the necessary components, wiring connections, and Arduino code to control the motor's direction. The motor will spin clockwise for one second and counter-clockwise for one second, with options for modifications.

Uploaded by

naveenamk7760
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views6 pages

DIY - Relay Switch Motor Controller - Arduino - 4 Steps (With Pictures) - Instructables

This tutorial provides instructions for building a motor controller using an Arduino and two relay switches. It details the necessary components, wiring connections, and Arduino code to control the motor's direction. The motor will spin clockwise for one second and counter-clockwise for one second, with options for modifications.

Uploaded by

naveenamk7760
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

DIY: Relay Switch Motor Controller - Arduino

By Simple-Circuits in CircuitsArduino

Introduction: DIY: Relay Switch Motor Controller - Arduino

Hello everyone,

In this tutorial, we will be building a motor controller using two relay switches and an arduino.

Components used in this project:

SainSmart UNO R3: http://www.amazon.ca/gp/product/B00E5WJSHK?psc=1&...

9v battery: http://www.amazon.ca/Tenergy-Charger-250mah-Recha... http://www.dx.com/p/dd15-dc-


9v-battery-button-pow...
M-F jumper wires: http://www.amazon.ca/Accmart-Flexible-Breadboard-...

Motor: http://www.amazon.ca/6760RPM-Rotary-Speed-bornes-...

5V relay switch: http://www.amazon.ca/SainSmart-2-CH-2-Channel-Rel...


Step 1: Connect the Motor & Power Supply

Connections:

Motor positive - Relay switch 1 COM input

Motor negative - Relay switch 2 COM input

9v battery positive - Relay switch 1 NO & Relay switch 2 NO

9v battery negative - Relay switch 1 NC & Relay switch 2 NC

Each relay switch has three inputs

NO (Normally open) ,COM (Common) and NC (Normally closed)

In this project, both wires from the motor will connect to both of the COM (middle) inputs of the relay
switches.

The positive wire from the 9v battery will connect to both of the NO (top) inputs.

The negative wire from the 9v battery will connect to both of the NC (bottom) inputs.

This external power supply (9v battery) will be used to power the motor. This can be changed to
control the speed of the motor.
Step 2: Connect the Arduino

Connection:

Arduino 5v pin - Relay module VCC pin

Arduino GND pin - Relay module GND pin

Arduino pin#7 - Relay module IN1

Arduino pin#8 - Relay module IN2

After we finish connecting the motor, all we need to do is power the relay switch module itself. using
the arduino, we can connect the wires and send signals to activate the relay switches.
Step 3: Upload the Code:

#define CW 7 //CW is defined as pin #7//

#define CCW 8 //CCW is defined as pin #8//

void setup() { //Setup runs once//

pinMode(CW, OUTPUT); //Set CW as an output//

pinMode(CCW, OUTPUT); //Set CCW as an output//

void loop() { //Loop runs forever//

digitalWrite(CW,HIGH); //Motor runs clockwise//

delay(1000); //for 1 second//

digitalWrite(CW, LOW); //Motor stops//

digitalWrite(CCW, HIGH);//Motor runs counter-clockwise//

delay(1000); //For 1 second//

digitalWrite(CCW, LOW); //Motor stops//

//end of code//

Download the code here:

https://drive.google.com/open?id=0Bwb-DkQkOX3jfkdI...
Step 4: Done!

If everything was done correctly, you should end up with a motor that spins clockwise for 1 second
and counter-clockwise for 1 second.

As always, you can modify the code and change the voltage for your own projects.

If you want to see this project in action, please click on the link below:

You might also like