Learn interfacing of microcontroller with LCD.
Learn interfacing of L293D with microcontroller.
Learn interfacing of relay with microcontroller.
The DC Motor Controller is based on the AT89C51 micro-controller and is capable of controlling the direction of rotation of a 6V DC motor. Some of the features of this Micrco-controller based DC Motor Controller are:
1. Controlled through micro-controller AT89C51
2. Message displayed on the LCD module
3. Start, stop and change of direction of the motor controlled by push-button switches and indicated by LED
4. Changes the running mode of the motor to continuous, reversible or jogging
5. Changes the speed of the motor
6. Time settings are possible for forward and reverse running of the motor
No. of ICs used: 6
At the heart of the DC motor controller is the micro-controller AT89C51. Port pins P0.0 through P0.7 of the microcontroller (IC1) are interfaced with data pins D0 through D7 of the LCD module, respectively. Port pins P3.0, P3.1 and P3.2 control the LCD operation through enable (E), register select (RS) and read/write (R/W) pins, respectively. Contrast of the LCD is set by a preset (VR1). Port pins P1.0 through P1.7 are connected to switches S1 through S8 for performing the various operations. Power-on reset signal for the micro-controller is generated by the combination of capacitor C1 and resistor R1. Switch S9 provides manual reset to the micro-controller. A 12MHz crystal provides the basic clock frequency to the micro-controller. Capacitors C2 and C3 in the circuit provide stability to the oscillator. EA pin (pin 31) of IC1 is connected to 5V to enable internal access. Port pins P2.0 through P2.3 of the micro-controller are used for LED indication of run, stop, clockwise and anti-clockwise rotation. Port pins P2.4 through P2.6 are connected to the inputs of inverters N3, N2 and N1 of 74LS04 (IC2). The output of inverter N3 is used to trigger pin 2 of NE555 timer. Timer NE555 is configured as a monostable and its time period is decided
by preset VR2 and capacitor C4. When pin 2 of NE555 goes low, output pin 3 becomes high for the predetermined period. The output of NE555 is connected to pole P of relay RL1. Normally-open (N/O) contacts of relay RL1 are connected to N/O1 and N/C2 contacts of relay RL2. N/C1 and N/O2 contacts of RL2 are connected to ground. The outputs of inverters N2 and N1 drive relays RL1 and RL2 with the help of transistors T1 and T2, respectively. D1 and D2 act as free-wheeling diodes. Poles P1 and P2 of RL2 are connected to IN1 and IN2 pins of motor driver L293D. OUT1 and OUT2 of L293D drive motor M.
When switch S1 is pressed, the micro-controller sends low logic to port pin P2.5. The high output of inverter N2 drives transistor T1 into saturation and relay RL1 energizes. So the output of NE555 is fed to inputs IN1 and IN2 of L293D through both the contacts of relay RL2. Now at the same time, after RL1 energizes, the micro-controller starts generating PWM signal on port pin P2.4, which is fed to trigger pin 2 of NE555 through inverter N3. The base frequency of the generated PWM signal is 500 Hz, which means the time period is 2 ms (2000μs). The output pulse width varies from 500 μs to 1500 μs. The R-C time constant of the monostable multi-vibrator is kept slightly less then 500 μs to generate exactly the same inverted PWM as is generated by the micro-controller. When switch S2 is pressed, port-pin P2.5 goes high and RL1 de-energises to stop the motor. When switch S3 is pressed, relay RL2 energises. Pin IN1 of motor driver L293D receives the PWM signal and pin IN2 connects to ground. As a result, the motor rotates in one direction (say, clockwise). When switch S3 is pressed again, relay RL2 de-energises. Pin IN2 of motor driver L293D receives the PWM signal and pin IN1 connects to ground. The motor now rotates in opposite direction (anti-clockwise). When switch S4 is pressed, different modes are selected in cyclic manner as given below:
1. Continuous mode. The motor rotates continuously with the set speed in either direction
2. Reversible mode. The motor reverses automatically after the set time
3. Jogging mode. The motor rotates for the set time in either direction and then stops for a few seconds and again rotates for the set time. It is also called ‘pulse rotation’ Switches S5 and S6 are used to set the speed of the motor, either in increasing order or decreasing order, in continuous mode only. Switches S7 and S8 are used to set the time either in increasing order or decreasing order.
Brand: Kits'n'spares, Marketed by: Kits'n'spares