Spread the love

motor interfacing with LPC2148 ___________________________________________________________________________________________________

  • What is motor? – A motor is an electric machine that converts electrical energy into mechanical energy. Motor has following parts:

dc_motor_diagram (1)

  1. Rotor –In an electric motor the moving part is the rotor which turns the shaft to deliver the mechanical power. The rotor usually has conductors laid into it which carry currents that interact with the magnetic field of the stator to generate the forces that turn the shaft. However, some rotors carry permanent magnets, and the stator holds the conductors.
  2. Stator –The stationary part is the stator, usually has either windings or permanent magnets. The stator is the stationary part of the motor’s electromagnetic circuit. The stator core is made up of many thin metal sheets, called laminations. Laminations are used to reduce energy loses that would result if a solid core were used.
  3. Windings-Windings are wires that are laid in coils, usually wrapped around a laminated soft iron magnetic core so as to form magnetic poles when energized with current.
  4. Commutator –commutator is a mechanism used to switch the input of certain AC and DC machines consisting of slip ring segments insulated from each other and from the electric motor’s shaft. The motor’s armature current is supplied through the stationary brushes in contact with the revolving commutator, which causes required current reversal and applies power to the machine in an optimal manner as the rotor rotates from pole to pole.

dc-electric-motors-665-4779229

  • Types of motor –There are many confusion arises when motors categorized, but mainly two types that is AC & DC. Here we only interface simple DC motor, geared DC motor and stepper motor as you can see on above pics.
  • Operation – we can’t direct interface any motors with microcontroller because
  1. Low voltage compatibility – microcontroller pin produced very low voltage about 5V and at this voltage motor not drive properly. To operate motor, at least 9V required.
  2. Low current compatibility – microcontroller pin produced very low current about 1.3mA(AT89c51)  and at this current rating motor not drive. To operate motor, at least 300mA current required.
  3. Back EMF- motor produced back current due to induced EMF which is harmful for microcontroller and cause of this microcontroller pin may be damaged.

Solution is L293D Dual H-Bridge IC, this IC produce 600mA to 700mA current with voltage range of 9V to 48V which is enough to drive small electronics motors. The circuit diagram of how to interface motor using this IC is shown in side TAB(circuit diagram). 73451_SN_6100_Light_2013

  • Applications – Different motors are used according to its characteristics and required parameters and its application as diverse as industrial fans, blowers and pumps, machine tools, household appliances, power tools, and disk drives.

Click Here : Interfacing of simple DC & geared DC motor

Click Here : Interfacing of stepper motor and program point of view understanding

1. Circuit Diagram Of GEAR MOTOR interfacing With LPC2148

Circuit Diagram Of GEAR MOTOR interfacing With LPC2148

2. Circuit Diagram Of STEPPER MOTOR Interfacing With LPC2148

Circuit Diagram Of STEPPER MOTOR Interfacing With LPC2148   _______________________________________________________________________________________________________

 

1. Program of GEAR MOTOR interfacing With LPC2148

/******************************************************
www.firmcodes.com
DEVELOPED BY:- FIRMWARE DEVELOPER
WHAT PROGRAM DO:- PROGRAM CONTROL GEAR MOTOR USING ARM7(LPC21XX)
******************************************************/

#include<lpc21xx.h>

#define left (IO0PIN&(1<<4))
#define right (IO0PIN&(1<<5))
#define forward (IO0PIN&(1<<6))
#define backward (IO0PIN&(1<<7))

int main()
   {
        PINSEL0=0X00000000;
        PINSEL1=0X00000000;
        IO0DIR=0XFFFFFF0F;
        IO0CLR|=(1<<25)|(1<<26)|(1<<27)|(1<<28);
        while(1)
          {
                if(left==0)
                  {
                        IO0CLR|=(1<<25)|(1<<26)|(1<<27)|(1<<28);
                        IO0SET|=(1<<25);
                        
                   }
                else if(right==0)
                  {
                        IO0CLR|=(1<<25)|(1<<26)|(1<<27)|(1<<28);
                        IO0SET|=(1<<27);
                  }
                else if(forward==0)
                  {
                        IO0CLR|=(1<<25)|(1<<26)|(1<<27)|(1<<28);
                        IO0SET|=(1<<25)|(1<<27);
                  }
                else if(backward==0)
                  {
                        IO0CLR|=(1<<25)|(1<<26)|(1<<27)|(1<<28);
                        IO0SET|=(1<<26)|(1<<28);
                  }
          }
   }

PROTEUS File for SIMULATION(Password Of RAR file is :-firmcodes.com)

download (1)________________________________________________________________________________________________

2. Program of STEPPER MOTOR Interfacing With LPC2148

/******************************************************
www.firmcodes.com
DEVELOPED BY:- FIRMWARE DEVELOPER
WHAT PROGRAM DO:- PROGRAM TO CONTROL STEPPER MOTOR
USING SWITCH CONNECTED WITH ARM7(LPC21XX)
******************************************************/

#include<lpc21xx.h>

#define one (IO0PIN&(1<<4))
#define two (IO0PIN&(1<<5))
#define three (IO0PIN&(1<<6))
#define four (IO0PIN&(1<<7))

int main()
   {
        PINSEL0=0X00000000;
        PINSEL1=0X00000000;
        IO0DIR=0XFFFFFF0F;
        IO0CLR|=(1<<25)|(1<<26)|(1<<27)|(1<<28);
        while(1)
          {
                if(one==0)
                  {
                        IO0CLR|=(1<<25)|(1<<26)|(1<<27)|(1<<28);
                        IO0SET|=(1<<25);
                        
                  }
                else if(two==0)
                  {
                        IO0CLR|=(1<<25)|(1<<26)|(1<<27)|(1<<28);
                        IO0SET|=(1<<26);
                  }
                else if(three==0)
                  {
                        IO0CLR|=(1<<25)|(1<<26)|(1<<27)|(1<<28);
                        IO0SET|=(1<<27);
                  }
                else if(four==0)
                  {
                        IO0CLR|=(1<<25)|(1<<26)|(1<<27)|(1<<28);
                        IO0SET|=(1<<28);
                  }
          }
  }

PROTEUS File for SIMULATION(Password Of RAR file is :-firmcodes.com)

download (1)__________________________________________________________________________________________________

Content for the tab VIDEO