IR remote controlled DC motor with PIC18F4550 and CCS C

DC motor control from remote control 

This topic shows how to build a simple infra-red remote controlled DC motor using PIC18F4550 microcontroller, L293D motor driver chip and CCS PIC C compiler. This controller control motor speed and rotation direction from IR remote control uses RC-5 protocol.
Related topics:
DC motor control with PIC18F4550 and L293D – Proteus simulation
RC-5 remote control decoder with PIC18F4550 and CCS C

The RC5 has 14 bits per 1 code transmission, the 14 bits can be divided into 4 parts:

The first 2 bits are start bits and they are always logic 1.
The third bit called toggle bit, it can be logic 1 or logic 0.
The next 5 bits are address bits, each device type has its address number for example TV address number is 0, CD player address = 20 …………
And the last 6 bits are command bits, each button has its command number.
For the same device for example TV all the remote control buttons has the same address but each button has its command.
The toggle bit changes whenever a button is pressed.
The remote control used in this project is a TV remote control which has an address = 0.
In this project toggle bit is not used which means only address and command quantities are used. The following image shows the used buttons with the corresponding address and command numbers for each button.
TV RC-5 IR remote control button codes

IR remote controlled DC motor with PIC18F4550 circuit:
PIC18F4550 DC motor TV IR remote control circuit
The IR receiver is used to receive the IR signals transmitted from the remote control and convert this signals to a digital data (logic 0 and logic 1). The microcontroller PIC18F4550 reads digital data from the IR receiver. LED1 blinks when RC-5 IR protocol is received.
LED2 indicates maximum speed. LED3 and LED4 indicates motor rotation direction.
L293D chip is used as a motor driver. The nominal voltage of the motor is 12V as well as L293D VS input voltage. L293D VS voltage should be the same as the  motor voltage and L293D VSS voltage is +5V.
The PIC18F4550 microcontroller must be supplied with 5V on pins VDD and VSS.
PIC18F4550 CCP1 and CCP2 modules are used as PWM modules which allows us to control motor speed as well as direction of rotation. PWM frequency is 500Hz.

IR remote controlled DC motor with PIC18F4550 CCS C code:
PIC18F4550 Timer2 is configured to generate a PWM frequency of 500Hz and the microcontroller is configured to run with 8MHz internal oscillator.

Remote controlled DC motor with PIC18F4550 video:
The following video shows a hardware circuit of this project.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top