me435l homework 10 bidirectional motor control with h bridge l293d lea
Search for question
Question
ME435L
Homework 10 – Bidirectional Motor Control with H-Bridge (L293D)
Learning Objective: Build circuit and program L293D H-Bridge
Problem: Build the circuit given below and write a program that achieves following functionality. Button
on pin 2 is used for power on/off of the whole system. Button on pin 3 is used to change the direction.
Potentiometer is used to control the speed of the DC motor. If motor is enabled (powered on), then
motor should run in one direction until your press the button on pin 3 when it should run in opposite
direction. If button on pin 2 is pressed it should disable (power off/stop) motor. You should be able to
control the motor speed with potentiometer if motor is enabled.
Circuit:
11
DIGITAL (PWM-)
O UNO
ARDUINO
TX+1
RX+0
ON
POWER
ANALOG IN
+
ghij
9V
0
L293D
Hints:
Recall we build/program/test each individual circuit separately.
Review Lab 4 and Homework 5 for button and potentiometer programming, if needed.
Review the datasheet for L293D. Note the chip is enabled by making its pin 1 (pin 4 on Arduino) HIGH.
You have to exclusively make pin 2 on L293D (pin 5 on Arduino) and pin 7 on L293D (pin 6 on Arduino)
HIGH/LOW to change the direction of current through motor based on motor direction.
Declare global variables motorEnabled, motorDirection, motorSpeed and others as needed.
Use Bounce2 library (more on it at link given below) to remove button bounce.
Reference:
https://github.com/thomasfredericks/Bounce2
ΤΟ
defghij