Motor Circuit Diagrams

# PWM Based DC Motor Speed Control using Microcontroller

In this project, I’ll teach you how to use an 8051 Microcontroller to generate a PWM signal as well as a PWM-based DC Motor Speed Control.

Outline

• Introduction
• PWM Based DC Motor Speed Control using Microcontroller Circuit Principle
• How to Generate PWM in 8051 Microcontroller?
• Circuit Diagram of PWM Based DC Motor Speed Control using Microcontroller
• Circuit Components
• PWM based DC Motor Speed Control using Microcontroller Circuit Design
• Code
• How to Operate the Circuit?
• Applications

## Introduction

In many situations where precision and protection are required, controlling the speed of a DC motor is critical. To regulate the speed of a DC motor, we’ll utilise a technique called PWM (Pulse Width Modulation).

Mechanical or electrical approaches can be used to control the speed of a DC motor, but they take a lot of hardware to implement, whereas a Microcontroller-based system makes it simple to control the speed of a DC motor.

Previously, we saw how to control the speed of a DC motor without using a microcontroller by using PWM. We repeat the experiment with a microcontroller here.

To do so, we’ll utilise an 8051 controller to generate PWM waves. We can regulate the speed of a DC motor by adjusting the width of this PWM pulse. The timers in the 8051 microcontroller are utilised to generate the PWM wave.

In this tutorial, we’ll look at how to use timers in an 8051 microcontroller to generate a PWM signal, as well as how to use that signal to control the speed of a DC motor.

## PWM Based DC Motor Speed Control using Microcontroller Circuit Principle

The 8051 microcontroller is at the heart of this project. If you’ve worked with an 8051 Microcontroller before, you’ll recall that it lacks a specific PWM circuitry for enabling PWM Mode. So, in order to generate a PWM signal, we used Timers to turn on and off the I/O pins.

To generate the PWM signal in this project, I’ll utilise Timer0 and Timer Interrupt on an 8051 Microcontroller.

## How to Generate PWM in 8051 Microcontroller?

Most current microcontrollers, such as AVR (Arduino), ARM, PIC, and others, include dedicated PWM hardware and pins that enable PWM mode to be activated instantaneously. This feature is not available on 8051 microcontrollers. So, how do you programme an 8051 microcontroller to generate PWM?

Timers and interrupts on the 8051 Microcontroller are required for this. The 8051’s Timer0 has been set to Mode0. We can keep the signal’s period consistent by carefully tweaking the High and Low values.

## Circuit Diagram of PWM Based DC Motor Speed Control using Microcontroller

### Circuit Components

• 8051 Microcontroller
• 11.0592 MHz Crystal
• Capacitors – 33pF x 2, 10µF
• Resistors – 1KΩ x 4, 10KΩ x 2
• 12V DC motor
• L298N Motor Driver
• Push Buttons x 5
• 1KΩ x 8 Pull-up Resistor Pack
• Serial cable
• Connecting wires

## PWM based DC Motor Speed Control using Microcontroller Circuit Design

One 8051 microcontroller (with with supporting circuitry for the oscillator and reset), an L298N Motor Driver Module, a DC Motor, and a few push buttons make up the circuit.

The OUT1 and OUT2 Pins of the L298N Motor Driver Module are linked to a 12V DC Motor. The motor driver’s IN1 and IN2 pins are linked to +5V (VCC) and GND, respectively. The Motor driver’s EN1 pin is connected to Port0 Pin P0.0.

Port0 Pins P0.4, P0.5, P0.6, and P0.7 are connected to four Push Buttons.

Pull-up and pull-down setups are the two most common ways to connect switches to the microcontroller.

Pull-up setup: The microcontroller pin is pulled HIGH to LOGIC 1 and the button is linked to GND in a pull-up configuration. When the button is pressed, LOGIC 0 is sent to the microcontroller pin.

Pull-down setup: The microcontroller pin is pulled down to LOGIC 0 and the button is linked to VCC in a pull-down configuration. When the button is pressed, LOGIC 1 is sent to the microcontroller pin.

We use a pull-up design in our circuit. To determine whether the button is pressed or not, we must look for logic 0.

## How to Operate the Circuit?

1. Connect the development board to a 12V battery or an adaptor.
2. Turn on the power.
3. With the help of a programmer, burn the hex file to the 8051 controller.
4. As shown in the circuit diagram, make the appropriate connections.
5. Now turn on the power and turn on switch 1. The beginnings may be seen revolving, but they are barely at 40% capacity.
6. When switch 2 is pressed, the motor runs at a slightly higher than half-speed (60 percent duty cycle).
7. The motor will rotate at maximum speed if switch 3 is pressed (100 percent duty cycle).
8. Press switch 4 to turn off the motor.

• Using this PWM method, we can save the power.

## Applications

• Used in industries to control the speed of motors.
• Used in shopping malls.
• We can use this concept to control the light intensity.

Check Also
Close

Close
Close