DC Motors are commonly used in electronics and electrical projects. It may be a line-following robot, a remote-controlled car, electronic shutters and doors, digital locks, drones, and choppers, etc; the DC motors are used in a variety of applications. A lot of these applications require remote controlling the operations of the DC motor. Here, controlling the motor refers to switching the motor on or off, changing its speed, and altering the direction of its rotation. For example, a remote-controlled car may require starting moving or halt, increase or decrease acceleration or move forward or backward by controlling the factors as mentioned above of the DC motors attached to its wheels.
This project is a simple demonstration of remote controlling a DC motor by switching it on or off and changing the direction of its rotation. The concept illustrated in the project can be used in several applications where microcontroller may or may not be in use. Any other complex project using a microcontroller can utilize this concept by altering the receiver section of this project where the DC motor circuit interfaced directly to the RF receiver here can be interfaced through a microcontroller too.
Fig. 1: Prototype of RF DC Motor Controller
The RF module used in the project is the 434 MHz module. It transmits data at a baud rate of 1Kbps to 10 Kbps and can have an operational range of up to 300 metre. Learn about the basic setup of RF transmitter and receiver. The operational range can be extended by using an antenna of standard size and increasing the transmission power of the antenna. Learn more about increasing the operational range of the RF module.
The RF module can transmit 4-bit data at once. A set of 2 bits is required as a control signal for remote operating a single DC Motor. The project shows controlling two 12V 3000RPM DC motors at the receiver section using the 4-bit control signal. The L293D IC (which can control a maximum of two DC motors) is used in the circuit.
|Sr No.||Name of the component||Required|
|1||RF TX Module (434 Mhz)||1|
|2||RF RX module(434 Mhz)||1|
|6||Resistor – 1KΩ (Quarter watt)||8|
|7||Resistor – 1MΩ (Quarter watt)||1|
|8||Resistor – 50KΩ (Quarter watt)||1|
|11||Battery – 9V||1|
|12||Battery – 12V||1|
|16||8×1 DIP Switches||2|
|17||Resistor network 8×[email protected]||2|
Fig. 2: Block Diagram of RF DC Motor Controller
The circuit has two sections – transmitter and receiver. The transmitter section is the basic setup of the RF transmitter by connecting the RF transmitter to an antenna and HT12E encoder IC. The address byte of the transmitter is set to be 0x00 by grounding all the address pins, and pin 14 is also hard-wired to ground to enable an uninterrupted transmission. The push-to-on switches are connected to the data pins of encoder IC which are connected to VCC at another terminal. By default, the encoder’s data pins are connected to ground, but on pressing a switch, the respective pin gets a HIGH input.
At the receiver side, RF receiver is configured according to its basic setup as dictated by the datasheets of RF receiver and HT12D decoder IC. The address byte of decoder IC is set to 0x00 to match with the address byte of RF transmitter.
Fig. 3: Prototype of Transmitter Side of RF DC Motor Controller
The data bits D0 to D3 of the HT12D decoder IC are connected to the L293D motor driver controller. The data bits cannot be directly interfaced to the L293D IC. The DC motors run on a high current 12V DC supply, whereas the RF receiver circuit operates on a 5V supply. A back current from the DC motor circuit can damage the data pins of the decoder IC. Therefore, the data pins are first connected to optocouplers, which stop the back current. The optocoupler is a sort of optical isolator or an optical relay. The optocoupler has an in-built IR diode at one end and a phototransistor at the other end. When current flows through the IR diode, it triggers a current in the phototransistor according to its configuration. The 4N35 optocouplers used in the circuit has six pins with following pin configuration – :
|1||IR diode’s anode||Anode|
|2||IR diode’s Cathode||Cathode|
Fig. 4: Pin Diagram of 4N25 Opto-Coupler
The data pins of the decoder IC are connected to anode pin of the optocouplers, and the cathode pin of the optocouplers are grounded. The collector of optocouplers is given VCC and output current for the L293D IC pins is drawn from the emitter pin of optocouplers. One optocoupler is used for each data pin of the decoder IC. The respective data pin statuses are reflected as it is from the emitter pins of optocouplers.
The L293D is the motor control driver IC. It has 16 pins with the following pin configuration :
|1||Enable pin of input 1 and 2 of Motor 1||Enable 1,2|
|2||Input 1 for Motor 1||Input 1|
|3||Output 1 for Motor 1||Output 1|
|6||Output 2 for Motor 1||Output 2|
|7||Input 2 for Motor 1||Input 2|
|8||Supply voltage for Motor 1 and 2||VS|
|9||Enable Pin of input 1 and 2 of motor 2||Enable 3,4|
|10||Input 1 for Motor 2||Input 3|
|11||Output 1 for Motor 2||Output 3|
|14||Output 2 for Motor 2||Output 4|
|15||Input 2 for Motor 2||Input 4|
|16||Logic Supply Voltage||VSS|
The collector pin of optocouplers interfaced to D0 and D1 are connected to Input 1 and Input 2 of the L293D IC, respectively. The motor to be controlled by D0 and D1 bits is connected between Output 1 and Output 2 pins of L293D. The collector pin of optocouplers interfaced to D2 and D3 are connected to Input 3 and Input 4 of the L293D IC, respectively. The motor to be controlled by D2 and D3 bits is connected between Output 3 and Output 4 pins of L293D. A 5V supply is given to the VSS pin, and 12V supply from another battery is given at the VS pin of the IC. The pins 4, 5, 12, and 13 are connected to ground.
How the Circuit Works
At the transmitter side, push-to-on switches are used to alter the status of encoder’s data bits. Pressing the switch triggers the respective data bit to HIGH, which otherwise by default remains LOW. The transmission is uninterrupted, and by default, 0x0 is transmitted.
At the receiver side, the data bits are received from the data pins of the decoder IC. On successful transmission of the control nibble, the respective data bit of decoder has the same status as of the respective data bit of the encoder IC, i.e. if D0 of encoder IC is switched to HIGH status, D0 of decoder IC also becomes HIGH. When a data bit of decoder IC is HIGH, current flows through the anode to the cathode of the optocoupler as the anode is connected to the data pin, and the cathode is grounded. This switches the IR LED ON and thereof, activates phototransistor. The base pin of the optocouplers is not connected. The collector pins are connected to VCC and emitter pins output to L293D pins. Thus, the phototransistor work as a diode connected between collector and emitter. On receiving infrared signals due to HIGH signal at a data pin, the collector-emitter junction gets forward biased, and a HIGH signal is output to the respective L293D pin.
The logical input pins of L293D are therefore interfaced to the data pins of decoder IC in the following manner :
|DATA PIN OF DECODER IC||L293D PIN|
The L293D IC controls the DC Motors in accordance with the following truth tables :
|PIN1/ENABLE INPUTS 1 AND 2||PIN 2/INPUT 1||PIN 7/INPUT 2||Motor 1( Connected between PIN 3 and 6 ) Function|
|HIGH||HIGH||LOW||Motor turns Anti-clockwise|
|HIGH||LOW||HIGH||Motor turns clockwise|
|PIN 9/ENABLE INPUTS 3 AND 4||PIN 10/INPUT 3||PIN 15/INPUT 4||Motor 2 (Connected between PIN 11 and 14 ) Function|
|HIGH||HIGH||LOW||Motor turns anti-clockwise|
|HIGH||LOW||HIGH||Motor turns clockwise|
The motor 1 is connected between pins 3 (output 1) and 6 (output 2) of the L293D IC. While the motor two is connected between pins 11 (output 3) and 15(output 4) of the L293D IC. The motors remain stopped until Enable pins remain LOW or Enable pins receive HIGH, but both input pins respective to the motor are either HIGH or LOW. In the circuit, Enable pins 1 and 9 are default to HIGH and default nibble transmitted on RF being 0x0, there remains LOW signal to the input pins of the L293D. Hence both the motors remain in stop condition by default.
Fig. 5: Prototype of Receiver Side of RF DC Motor Controller
In order to control motor 1, D3 and D2 bits of the transmission signal need to be changed. On pressing the switch connected to the encoder’s D3 pin, 0x8 is transmitted. This, in turn changes the status of input 2 pin of the L293D to HIGH while input 1, 3, and 4 remains LOW. Thus, the motor 1 rotates in a clockwise direction in accordance with the truth table of L293D. On pressing the switch connected to the encoder’s D2 pin, 0x4 is transmitted. This, in turn, changes the status of input 1 pin of the L293D to HIGH while input 2, 3, and 4 remains LOW. Thus, the motor 1 rotates in an anti-clockwise direction according to the truth table of L293D. The operations on motor 1 are summarized below :
|D3||D2||D1 AND D0||Data Transmitted||L293D INPUT 1||L293D Input 2||Motor 1 Function|
|0||0||0||0x0||LOW||LOW||Motor Stops (Default )|
|1||0||0||0X8||LOW||HIGH||Motor Rotates Clockwise|
|0||1||0||0X4||HIGH||LOW||Motor Rotates Anti-Clockwise|
In order to control motor 2, D1 and D0 bits of the transmission signal need to be changed. On pressing the switch connected to the encoder’s D1 pin, 0x2 is transmitted. This, in turns changes the status of input 3 pin of the L293D to HIGH while input 1, 2, and 4 remains LOW. Thus, the motor 2 rotates in an anti-clockwise direction according to the truth table of L293D. On pressing the switch connected to the encoder’s D0 pin, 0x1 is transmitted. This, in turn, changes the status of input 4 pin of the L293D to HIGH while input 1, 2, and 3 remains LOW. Thus, the motor 2 rotates in a clockwise direction according to the truth table of L293D. The operations on motor 2 are summarized below – :
|D0||D1||D2 AND D3||data transmitted||L293D Input 3||L293D Input 4||Motor 2 function|
|0||0||0||0x0||LOW||LOW||Motor Stops (default )|
|0||1||0||0X2||HIGH||LOW||Motor Rotates Anti-Clockwise|
|1||0||0||0X1||LOW||HIGH||Motor Rotates Clockwise|