100% found this document useful (1 vote)
380 views

DC Motor Interfacing With ARM MBED - MBED

This document discusses interfacing a DC motor with an ARM MBED microcontroller. It explains that a DC motor converts electrical energy to rotational motion, and its speed and direction can be controlled using varying voltage and current direction. It describes using a potentiometer for speed control, a tactile switch to change direction, and an L293D motor driver IC to drive the motor. The example code shows reading the potentiometer and tactile switch to control motor speed and direction with PWM and interrupts.

Uploaded by

Krishanu Modak
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
380 views

DC Motor Interfacing With ARM MBED - MBED

This document discusses interfacing a DC motor with an ARM MBED microcontroller. It explains that a DC motor converts electrical energy to rotational motion, and its speed and direction can be controlled using varying voltage and current direction. It describes using a potentiometer for speed control, a tactile switch to change direction, and an L293D motor driver IC to drive the motor. The example code shows reading the potentiometer and tactile switch to control motor speed and direction with PWM and interrupts.

Uploaded by

Krishanu Modak
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

DC Motor Interfacing with ARM MBED

DC Motor

DC motor converts electrical energy in the form of Direct Current into mechanical energy in the form of rotational motion of
the motor shaft.
The DC motor speed can be controlled by applying varying DC voltage; whereas the direction of rotation of motor can be
changed by reversing the direction of current through it.
For applying varying voltage, we can make use of PWM technique.
For reversing the current, we can make use of H-Bridge circuit or motor driver ICs that employ the H-Bridge technique.

For more information about DC motors and how to use them, H-Bridge circuit configurations, and PWM technique, DC
Motors refer the topic DC Motors in the sensors and modules section.

Interfacing Diagram

Interfacing DC Motor with ARM MBED

Example
Here, we are going to control the speed and rotational direction of DC motor using ARM MBED.

Here, the potentiometer is used as a means for speed control and an input from the tactile switch is used to change the direction of
motor.

The L293D motor driver IC is used to drive the DC motor.


You can refer functions required for PWM, External Interrupt, and ADC.

Program

#include "mbed.h"

#include "Motor.h"

Motor Motors(p22, p6, p7);

AnalogIn pot(p15);

DigitalOut LED_1(LED1);

InterruptIn button(p9);

float potpin;

int pin;

void flip()
{

pin = !pin;

LED_1 = !LED_1;

int main() {

button.rise(&flip);

while(1) {

if (pin == 1){

potpin = pot.read();

Motors.speed(-potpin);

else {

potpin = pot.read();

Motors.speed(potpin);

You might also like