Challenge

Project 1 - Controlling a DC motor using PWM and monitoring its Running status

Project:1

Overview

The system uses:

  1. L293D Motor Driver IC to control the direction and speed of the DC motor.
  2. Pulse Width Modulation (PWM) to control the motor speed.
  3. LCD Display to show the current status of the motor, including the direction and speed.

Goals

  1. Implement a system on a simulator to control a DC motor using an L293D motor driver.
  2. Control the motor speed using PWM.
  3. Display the running status of the motor on an LCD.

Key Highlights

  1. DC Motor Control:
    • L293D allows controlling the direction and speed of the motor.
  2. Speed Control Using PWM:
    • PWM signals adjust the input voltage, controlling the motor speed.
  3. LCD Status Display:
    • Display motor speed and direction on the LCD.

Deliverables

  • System implementation for controlling the DC motor using L293D.
  • PWM control of motor speed.
  • Real-time status of the motor shown on an LCD.

Expected Outcomes

  • Control of the DC motor using the L293D motor driver and PWM.
  • Monitoring and displaying the running status, including speed and direction, on the LCD.

Arduino Code Implementation

Components

  • Arduino Board: For controlling and interfacing components.
  • L293D Motor Driver IC: To drive the DC motor.
  • DC Motor: To be controlled.
  • LCD Display (16x2): To show the motor status.
  • Potentiometer: To control motor speed.

Explanation

  1. Motor Control:

    • L293D Motor Driver:
      • Pins in1 and in2 are used to control the direction.
      • Pin enA is used to control speed using PWM.
    • The motor is set to rotate in a specific direction (in1 HIGH, in2 LOW) by default.
  2. Speed Control:

    • A potentiometer is used to control the speed.
    • The analogRead(potPin) reads the value from the potentiometer, and map() scales this to a range suitable for PWM (0–255).
    • The analogWrite(enA, motorSpeed) function sets the PWM value to control motor speed.
  3. LCD Display:

    • LiquidCrystal Library: Used to control the LCD.
    • The LCD displays:
      • The current speed of the motor as a percentage (0-100%).
      • The direction of rotation (Clockwise in this example).
  4. Control Logic:

    • The motor speed is adjustable using the potentiometer.
    • The direction is currently set to clockwise (in1 HIGH, in2 LOW). This can be changed to counterclockwise by swapping these pin states (in1 LOW, in2 HIGH).
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.