Motorized Colorful Wheel Using Arduino | Arduino Project

by | Apr 15, 2022 | Arduino, Coding

Introduction

In this Arduino project tutorial, we will create a Motorized colorful wheel using Arduino. On clicking the button, one colourful wheel will spin. The wheel can be on any vehicle or any of your mind’s wonderful creations!

Supplies

In order to make a Motorized colorful wheel, we will require the following components:

Components

  • Arduino Uno R3
  • 1 DC motor
  • 1 nMOS Transistor(MOSFET)
  • One 9V Battery
  • 1 Push Button
  • 1 Diode
  • 1 Small BreadBoard
  • 1 Resistor
  • Connecting wires

Circuit Diagram

Steps To Make A Motorized Colorful Wheel Using Arduino

Step 1: Gather all the components on the Digital Board or Physical Table.

Step 2: Plug the PushButton & Transistor on the BreadBoard.

PushButton:

Step 3: Connect the first Terminal of it to the Ground(GND) pin of the Arduino using a black coloured wire thru a resistor.

Step 4: Connect the second terminal of it to the 2 number pin of the Arduino on the Digital side.

Step 5: Connect the third terminal of it to the 5V power supply pin of the Arduino Uno.

Transistor:

Step 6: Connect the Gate terminal of it to the 3 number pin of the Arduino.

Step 7: Connect the Drain Terminal of the transistor to the Anode terminal of the Diode, as shown in the figure.

Step 8: Connect the source terminal of the transistor to the GND pin of the Arduino, as shown in the figure.

DC Motor:

Step 9: Connect the first terminal of it to the Anode of the Diode.

Step 10: Connect the second terminal of it to the Positive Terminal of the Battery.

Battery:

Step 11: Connect the Negative terminal of the battery to the GND pin of the Arduino.

Step 12: Connect the Positive terminal of the battery to the cathode terminal of the diode.

Source Code

const int button = 2;

const int motor = 3;

int state = 0;

void setup()

{

pinMode(motor, OUTPUT);

pinMode(button, INPUT);

}

void loop()

{

state = digitalRead(button);




if (state == HIGH)

{

digitalWrite(motor, HIGH);

}

else

{

digitalWrite(motor, LOW);

}

}

Explanation of the Code

In the beginning, we have initialised two variables to the integers, which represent the pin number to which the PushButton and Motor are connected in Arduino.

After it, we have initialised one variable, namely state, to 0, which represents the state of the button, whether pushed or not.

After that, we have a setup function called only once on every reset.

In the setup function, we have configured the motor and button pin for output and input purposes, respectively.

In the loop function, which keeps on looping, we are reading the value of the button and storing it in the state variable.

After it, we are using the if-else statement, which says that if the button is pressed, give power to the motor; else, don’t give high power to it.

Output

We will get the following output on the successful completion of this  Motorized colorful wheel using Arduino project.

Till we click the button, the wheel will keep on spinning.

Motorized Colorful Wheel Using Arduino

 

You May Also Like To Create…

0 Comments

Submit a Comment

Your email address will not be published.