Saikat Chakraborty
Published © MIT

DC Motor Elevator Demo

Demonstration of the application of DC Motor Control using a H-Bridge Converter.

IntermediateFull instructions provided24 hours49
DC Motor Elevator Demo

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Optocoupler, 2 Channel
Optocoupler, 2 Channel
×2
Power MOSFET N-Channel
Power MOSFET N-Channel
×4
74AC04 HEX INVERTER IC 74AC04SCX
TaydaElectronics 74AC04 HEX INVERTER IC 74AC04SCX
×1
1N4007 – High Voltage, High Current Rated Diode
1N4007 – High Voltage, High Current Rated Diode
×2
Through Hole Resistor, 470 ohm
Through Hole Resistor, 470 ohm
×1
DC Motor, Miniature
DC Motor, Miniature
×1
Battery, 3.7 V
Battery, 3.7 V
×3
Capacitor 10 µF
Capacitor 10 µF
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

H-Bridge Circuit Diagram

Controlling the H-Bridge with PWM signals from arduino.

Code

sketch_mar24a.ino

Arduino
Controlling direction of motor using Arduino
const int FWD = 0;
const int REV = 1;

const int H1 = 3;
const int H2 = 5;
const int L1 = 6;
const int L2 = 9;

const int DWELLTIME = 2000;
const int PWMSTPTIME = 10;
const int PWMMAXVAL = 255;

int direction = FWD;

void motion(int dir, int pwm)
{
  if (dir == FWD)
  {
    analogWrite(H1, pwm);
    analogWrite(H2, 0);
    analogWrite(L1, 0);
    analogWrite(L2, pwm);
  }
  else if (dir == REV)
  {
    analogWrite(H1, 0);
    analogWrite(H2, pwm);
    analogWrite(L1, pwm);
    analogWrite(L2, 0);
  }
}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(H1, OUTPUT);
  pinMode(H2, OUTPUT);
  pinMode(L1, OUTPUT);
  pinMode(L2, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  for (int pwmvalue=0; pwmvalue <= PWMMAXVAL; pwmvalue++)
  {
    motion(direction, pwmvalue);
    delay(PWMSTPTIME);
  }

  delay(DWELLTIME);

  for (int pwmvalue=PWMMAXVAL; pwmvalue >= 0; pwmvalue--)
  {
    motion(direction, pwmvalue);
    delay(PWMSTPTIME);
  }

  direction ^= 1;
}

Credits

Saikat Chakraborty
4 projects • 0 followers
Electrical Engineer specializing in signal processing with a keen interest in Computer Aided Design, Software Development and Cybersecurity.

Comments