top of page
Writer's pictureSanskruti Ashtikar

Motor Speed Control Circuit Using 8051 Microcontroller

Updated: Dec 5

Introduction


Motor speed control is essential in various applications, including robotics, industrial automation, and household appliances. This project demonstrates how to design a motor speed control circuit using the 8051 microcontroller and Pulse Width Modulation (PWM) technique. By adjusting the duty cycle of the PWM signal, we can control the speed of a DC motor efficiently.





Components Required


  • 8051 Microcontroller (e.g., AT89S52)

  • DC Motor

  • Motor Driver IC (e.g., L293D)

  • Potentiometer (for speed control input)

  • Resistors (10kΩ, 1kΩ)

  • Capacitors (33pF, 100μF)

  • Crystal Oscillator (11.0592 MHz)

  • Breadboard and Connecting Wires

  • Power Supply (5V for the 8051, 12V for the motor)


Circuit Diagram


The potentiometer is used to provide an analog input for speed control. This input is read by the 8051 microcontroller, which generates a PWM signal to control the motor speed via the motor driver IC.


+5V ----- +5V
          |
         10kΩ Potentiometer
        +---+
        |   |
        |   +---------- P1.0 (8051 ADC input)
        |   |
        GND
8051 Microcontroller
    VCC to +5V
    GND to Ground
    XTAL1 to 11.0592 MHz Crystal Oscillator
    XTAL2 to 11.0592 MHz Crystal Oscillator
L293D Motor Driver IC
    VCC1 to +5V (logic)
    VCC2 to +12V (motor supply)
    GND to Ground
    IN1 to P2.0 (8051 PWM output)
    IN2 to P2.1 (logic low for unidirectional control)
    EN1 to +5V (enable input)
    OUT1 to Motor Terminal 1
    OUT2 to Motor Terminal 2

Pin Connections


  • Potentiometer:

  • One terminal to +5V

  • Wiper (middle terminal) to P1.0 of the 8051 (ADC input)

  • Other terminal to Ground

  • 8051 Microcontroller:

  • VCC to +5V

  • GND to Ground

  • XTAL1 and XTAL2 connected to an 11.0592 MHz crystal oscillator with 33pF capacitors to Ground

  • L293D Motor Driver IC:

  • VCC1 to +5V (logic supply)

  • VCC2 to +12V (motor supply)

  • GND to Ground

  • IN1 connected to P2.0 of the 8051 (PWM output)

  • IN2 connected to Ground (for unidirectional control)

  • EN1 connected to +5V (enable input)

  • OUT1 and OUT2 connected to the motor terminals





Software Implementation


The code is written in C using Keil uVision IDE. It involves reading the analog input from the potentiometer, generating a corresponding PWM signal, and controlling the motor speed


#include <reg51.h>
sbit MOTOR_PIN = P2^0; // Motor control pin
unsigned int adc_value;
void delay(unsigned int time) {
    unsigned int i, j;
    for(i = 0; i < time; i++)
        for(j = 0; j < 1275; j++);
}
void pwm(unsigned int duty_cycle) {
    MOTOR_PIN = 1; // Set motor pin high
    delay(duty_cycle); // ON time
    MOTOR_PIN = 0; // Set motor pin low
    delay(255 - duty_cycle); // OFF time
}
void main() {
    while(1) {
        adc_value = P1; // Read ADC value from P1
        pwm(adc_value); // Generate PWM with duty cycle based on adc_value
    }
}




Explanation


  1. Initialization:

  2. ADC Reading: The potentiometer provides an analog input to P1.0, which is read by the 8051 microcontroller. In this example, we assume a simple method to read ADC values, though in practical scenarios, an ADC IC or module might be used with the 8051.

  3. PWM Generation:

  4. PWM Function: The pwm() function generates a PWM signal with a duty cycle proportional to the adc_value. By adjusting the duty cycle, we control the average voltage applied to the motor, thereby controlling its speed.

  5. Main Loop:

  6. Reading ADC Value: Continuously read the ADC value from the potentiometer.

  7. Generating PWM: Call the pwm() function with the read ADC value to control the motor speed.

  8. Delay Function:

  9. The delay function is used to create the PWM signal by controlling the ON and OFF times of the motor control pin.


Conclusion


This project demonstrates the use of the 8051 microcontroller to create a motor speed control circuit. By integrating a potentiometer for analog input, a motor driver IC for power control, and the PWM technique for speed regulation, the system can efficiently control the speed of a DC motor. This project is a great way to learn about analog-to-digital conversion, PWM generation, and using microcontrollers for motor control applications.


Want us to guide you through your project or make the project for you ?






Create Various Projects

Check out our Free Arduino Projects Playlist - Arduino Projects 

Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects 

Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects 

Check out our Free IoT Projects Playlist - IoT Projects 

Check out our Free Home Automation Projects Playlist - Home Automation Projects 

Check out our Free NodeMCu Projects Playlist - NodeMCu Projects 



18 views0 comments

Related Posts

See All

Comments


bottom of page