EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / Interface 8051 to a 12V dc motor

Interface 8051 to a 12V dc motor

|

Microcontroller › 8051 › Interface 8051 to a 12V dc motor

  • This topic has 13 replies, 14 voices, and was last updated 9 years, 4 months ago by amol ghodke.
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • October 14, 2010 at 1:01 pm #435
    kapil
    Participant

    Can anybody provide me details of connecting 8051 to a dc motor with code and diagram.

    Thanks,

    rahul

    October 20, 2010 at 4:41 am #5100
    Anonymous
    Guest

    use L293D to interface 12V motor to microcontroller. control signals for the driver can be given in the code.

    October 20, 2010 at 5:36 am #5103
    dagakshay
    Participant

    you can use any motordriver Ckt (eg: H-bridge using TIP transistors, relays, l293d or l298….)

    there are no of reasons that the o/p of microcontroller cant be feed directly to motors, for simply understanding that you can say microcontroller can’t provide that much of current to drive a motor.

    February 3, 2012 at 8:19 am #7105
    praveen kumar
    Participant

    i need l293d usage to at89s51….can any body plz mail me..

    February 9, 2012 at 7:09 pm #7128
    mother lives forever
    Participant

    can anyone gives me the descripription of interfacing dc motor with 8051….i need the code there plzzzzzzz

     

    February 9, 2012 at 7:50 pm #7129
    Syed Aameer
    Participant

    give the ports output to h bridge(L293d).for pin number 2,7,10,15(if you are using 2 motors).then connect motors to pin number 3,6,11,14 respectively.

    In program if you give 00 or 11 off state

                                      10           one direction

                                       01          opposite direction (*for each motor )

     Repeat the above for other motor too……..

    February 10, 2012 at 11:43 pm #7147
    Dexter
    Participant

    this may help u

    wysiwyg_imageupload:3746:

    March 25, 2012 at 8:27 pm #7329
    BILAL sadiq
    Participant

    hi every one can some one help me please
    i do not know how to connect 12V supply for my dc motor with 5v microcontroller 8051 ,,,i mean to say in hardware what should i do ???? should i use LM7812 or how ,,,,,please do help me ,,,,,what and how i manage to run a 12V dc motor with 8051 microcontroller,,,i know the theory(about L293D) but on hardware how can i get 12 V ???
    please help me and especially guide me please 
    waiting for nice advices and help …
    thanks

    March 31, 2012 at 9:50 am #7366
    anurudh tiwari
    Participant

    HERE THE FULL DETAIL OF THE 12V DC INTERFACING WITH THE HELP OF THE L293D IC

     

     

    ..L293D Dual H-Bridge Motor Driver


    L293D is a dual H–Bridge motor driver, So with one IC we can interface two DC motors which can be controlled in bothclockwise and counter clockwise direction and if you have motor with fix direction of motion the you can make use of all thefour I/Os to connect up to four DC motors. L293D has output current of 600mA and peak output current of 1.2A perchannel. Moreover for protection of circuit from back EMF ouput diodes are included within the IC. The output supply (VCC2)has a wide range from 4.5V to 36V, which has made L293D a best choice for DC motor driver.

    A simple schematic for interfacing a DC motor using L293D is shown below.

     

     

    wysiwyg_imageupload:4333:

     

     

    As you can see in the circuit, three pins are needed for interfacing a DC motor (A, B, Enable). If you want the o/p to beenabled completely then you can connect Enable to VCC and only 2 pins needed from controller to make the motor work.


    As per the truth mentioned in the image above its fairly simple to program the microcontroller. Its also clear from the truthtable of BJT circuit and L293D the programming will be same for both of them, just keeping in mind the allowed combinationsof A and B. We will discuss about programming in C as well as assembly for running motor with the help of a microcontroller.



     
    March 31, 2012 at 6:21 pm #7369
    tarun
    Participant

    wysiwyg_imageupload:4364:

    #include<reg51.h>

    sbit enable1=P1^0;
    sbit enable2=P1^2;
    sbit mtr1_1=P1^1;
    sbit mtr1_2=P1^7;
    sbit mtr2_1=P1^3;
    sbit mtr2_2=P1^6;
    sbit sw1=P2^2;
    sbit sw2=P2^3;
    sbit sw3=P2^4;
    sbit sw4=P2^5;
    void delay(void);
    void main()
    {
    P1=0x00;
    P2=0xff;
    while(1)
    {
    enable1=0x00;
    enable2=0x00;
    delay();
    if(sw1==0x00)
    {
    enable1=0x01;
    enable2=0x01;
    delay();
    mtr1_1=0x01;
    mtr1_2=0x00;
    mtr2_1=0x01;
    mtr2_2=0x00;
    }
    else if(sw2==0x00)
    {
    enable1=0x01;
    enable2=0x01;
    delay();
    mtr1_1=0x00;
    mtr1_2=0x01;
    mtr2_1=0x00;
    mtr2_2=0x01;
    }
    else if(sw3==0x00)
    {
    enable1=0x01;
    enable2=0x01;
    delay();
    mtr1_1=0x01;
    mtr1_2=0x00;
    mtr2_1=0x00;
    mtr2_2=0x01;
    }
    else if(sw4==0x00)
    {
    enable1=0x01;
    enable2=0x01;
    delay();
    mtr1_1=0x00;
    mtr1_2=0x01;
    mtr2_1=0x01;
    mtr2_2=0x00;
    }
    else if(sw1==0x0f&&sw2==0x0f&&sw3==0x0f&&sw4==0x0f)
    {
    enable1=0x00;
    enable2=0x00;
    delay();
    }
    }
    }
    void delay()
    {
    int i,j;
    for(i=1;i<=2;i++)
    for(j=1;j<=500;j++);
    }
    March 31, 2012 at 6:24 pm #7370
    Dinesh Kumawat
    Participant

     

    /*Connections:
     
    1. Connect P2.0 to E1 pin of L293D Section on the kit
    2. Connect P2.1 to I1 pin of L293D Section on the kit
    3. Connect P2.2 to I2 pin of L293D Section on the kit
    4. Connect VS pin of L293D section to Vcc Pin. The Vcc pin is the 1st pin on the 6 pin header (marked as ISP) just above the 89V51RD2 IC. This provides 5V to the DC Motor. In case your DC motor requires higher voltage (max 12V) then connect external DC power source to VS & GND pins of L293D section.*/
     
     
     
     
    #include <REG52.H>                /* special function register declarations   */
                                      /* for the intended 8051 derivative         */
     
    #include <stdio.h>                /* prototype declarations for I/O functions */
     
     
    //L293D Pin Defines 
     
    sbit E1 = P2^0;
    sbit I1 = P2^1;
    sbit I2 = P2^2;
     
    void MSdelay(unsigned int rtime)
    {
    unsigned int r,s;
    for(r=0;r<rtime;r++)
    for(s=0;s<1275;s++);
    }
     
     
      
    void main (void) {
    E1 = 1; //Set E1 pin High to Enable Channel of L293D
     
    while(1) //End less while so that program never ends  
    {
    //Rotate in One Direction
    I1 = 0;
    I2 = 1;
    MSdelay(500);
     
    //Rotate in Other Direction
    I1 = 1;
    I2 = 0;
    MSdelay(500);
    }
    }
     
     
     
    April 27, 2012 at 3:02 pm #7557
    Meghana
    Participant

    can anyone please tell me give the circuit for driver of stepper motor of specification 1mA. this motor is interfaced with FPGAn not with microcontroller.

    October 10, 2013 at 1:11 pm #10521
    vinoth kumar
    Participant

    use L293D to interface 5V motor relay control the direction to microcontroller. control signals for the driver can be given in the code.

    February 9, 2016 at 10:14 am #13698
    amol ghodke
    Participant

    can u give me c code for controlling of dc motor with 8051 using 7 switch array

  • Author
    Posts
Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Simple LED Analog Clock Idea June 22, 2025
  • Fun with AI and swordfish basic June 22, 2025
  • Is AI making embedded software developers more productive? June 22, 2025
  • Can I make two inputs from one?? June 21, 2025
  • Behlke swich June 21, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise