Close

Arduino Workshop-Simple Motor Control

mr-sarful-hassanMr. Sarful hassan wrote 06/15/2020 at 13:46 • 6 min read • Like
This tutorial we are going to Arduino Simple Motor Control, in one direction, using a power transistor, diode, and external power supply to power the motor and a potentiometer to control the speed. Any suitable NPN power transistor designed for high current loads can replace the TIP120 transistor. However, I would highly recommend you use a power Darlington-type transistor. Make sure you choose a transistor that can handle the voltage and current your motor will draw. It may be necessary to fit a heat sink to the transistor if it is pulling more than about an amp. The external power supply can be a set of batteries or a “wall wart”-style external DC power supply. The power source must have enough voltage and current to drive the motor. The voltage must not exceed that required by the motor. For my testing purposes, I used a DC power supply that provided 5V at 500mA. This was enough for the 5V DC motor I was using. If you use a power supply with voltage higher than the motor can take, you may damage it permanently

Required Component of Arduino Simple Motor Control :

1.Arduino 2.Potentiometer 3.DC Motor 4. 1N4001 Diode with TIP120 Transistor 5. Resistors 6. connecting wire 7. Breadboard 8.LiPo Battery

This book will help you to gain more knowledge about Arduino

Beginning Arduino

Circuit diagram of Arduino Simple Motor Control:

First, make sure your Arduino is powered off by unplugging it from the USB cable. Now, take the required parts and connect them up  It is essential for this project that you check and double-check all of your connections are as they should be before supplying power to the circuit, as failure to do so may result in damage to your components or even your Arduino. The diode, in particular, is essential to protect the Arduino from back EMF, which we will explain later. First, make sure your Arduino is powered off by unplugging it from the USB cable. Now, take the required parts and connect them up as in Figure 5-1. It is essential for this project that you check and double check all of your connections are as they should be before supplying power to the circuit, as failure to do so may result in damage to your components or even your Arduino. The diode, in particular, is essential to protect the Arduino from back EMF, which we will explain later.

Code Arduino of  Simple Motor Control:

int potPin = 0; // Analog in 0 connected to the
potentiometer
int transistorPin = 9; // PWM Pin 9 connected to the base of
the transistor
int potValue = 0; // value returned from the potentiometer
void setup() {
// set the transistor pin as output:
pinMode(transistorPin, OUTPUT);
}
void loop() {
// read the potentiometer, convert it to 0 - 255:
potValue = analogRead(potPin) / 4;
// use that to control the transistor:
analogWrite(transistorPin, potValue);
}
Before uploading your code, disconnect the external power supply to the motor and ensure the potentiometer is turned fully counterclockwise. Now upload the code to the Arduino. Once the code is uploaded, connect the external power supply. You can now turn the potentiometer to control the speed of the motor

All Arduino tutorial available Click here ALL ARDUINO TUTORIAL 

Like

Discussions