DC Motor Interfacing with PIC Microcontroller | PIC18F452 | L293D
Hi..!!!
Welcome to Embedded World. Today we talk about how to interface DC Motor with PIC18F452 Microcontroller or any other micro-controller. Firstly we directly can't connect dc-motor to controller. because dc motor generates back emf, so due to back emf controller may be damage, another reason is dc motor required high voltage and high current, where controller provide maximum 5V voltage and 25mA current. so to achieve high current requirement and overcome back emf problem we used motor driver IC. (we can also used H-bridge using transistor/mosfet).
Here we used L293D driver IC. It is dual H-bridge motor driver IC i.e by using one IC we can control two DC motors in both clockwise and anti-clockwise direction. It can provide bidirectional drive current up to 600 mA at voltage range from 4.5V to 36V. while L293 provide upto 1A current. we can enable driver pair by giving logic high signal to enable pin. as shown
1) Circuit Diagram
In this example we are using only first pair of driver to drive one DC Motor. Where driver pair can be enable by giving logic high signal to driver EN pin. so in our case we give logic high to pin no 1 to enable driver. controller pins connected to IN1 and IN2. And DC Motor connected to OUT 1 and OUT 2.
2) Coding
Algorithm:
1] Declare PORT B as output PORT
2] Assign data to PORT B
3] Call Delay
4] Assign data to PORT B
5] Call Delay
6] Go to step 2
3) Simulation Result
First Motor rotates clockwise then stop then anti-clockwise. And then cycle repeat again.
4) Burn Hex File
For loading program on controller I used PICkit3 Programmer. buy it from Amazon at RS.1100.
5) Hardware Output
For hardware implementation I used my PIC Development board. you can also used your board or just making simple connection on breadboard as per circuit diagram. Here we used external power source from 12Vac adapter then further it can be converted to 5V supply using rectifier and LM7805 and then driven to PIC MCLR pin, L293D driver IC and DC_ Motor.
Download Here...!!!
You can download project hex file, proteus file, simulation, code, mikroc etc files here....
If you want to design your PIC Development Board, here its all required data, download and make your project..... ALL THE BEST !!!!
If you have any doubts, quires, suggestions for me please comment below or contact me on my number.
...Thanks For Visiting...