Programmable IR remote control using PIC16LF877

Summary of Programmable IR remote control using PIC16LF877


This article describes a multiprotocol infrared remote control built around a PIC16LF877-04/L microcontroller. It replaces up to six existing remotes, supports protocols like NEC and RC5, and features manual learning capabilities. The device includes an LED or optional Nokia 3310 LCD display, runs on two AAA batteries with ultra-low power consumption in sleep mode, and stores all data in an external EEPROM.

Parts used in the Multiprotocol Infrared Remote Control:

  • PIC16LF877-04/L (4Mhz PLCC Package)
  • 24LC256 EEPROM
  • 74HC148 encoder (SMD)
  • Nokia 3310 graphic LCD (LPH-7779) - Optional
  • IR LED
  • 5 optional LEDs
  • TSOP34836 IR receiver
  • BC639 transistor

NEC-SIRCS-JAPAN-RC5-SAMSUNG compatible, multiprotocol infrared remote control.

Replaces up to 6 existing remote controls into one.

With manual learning function, LED display and/or LCD. 2V6-3V2, low power (sleep function)

More protocols will be added later if needed (DENON, DAEWOO, MOTOROLA, RECS80.)

Components: PIC16LF877-04/L (4Mhz PLCC Package), 24LC256 EEPROM (low power), 74HC148 encoder (SMD), optional Nokia 3310 graphic LCD (LPH-7779), IR LED, 5 optional LEDs, TSOP34836 IR receiver (low voltage)

All parts are available in our online shop

Schematic & pcb (Eagle 4.11e), source code (CCS) and hex file available.

More pictures.

Circuit explanation:

 IR remote

The main component is of course the PIC16LF877-04/L processor. Its 8K program ROM handles all inputs, outputs, timings and so on. There are six modes: SLEEP, IDLE, TRANSMIT, RECEIVE, BACKUP & RESTORE.

There are two displays available: LED and/or LCD. So you can choose freely which one suits you best. Naturally, the Nokia LCD gives us much more details as we will see further on.

Power consumption is only a couple of microamps in sleep mode !!The circuit is powered by two AAA batteries (HR03) These may be rechargeable types. The voltage can drop as low as 2,5V. The battery life is several months (although NI-Mh batteries lose 1% of their power each day!)

Sleep mode is activated automatically after 20 seconds of inactivity (no button pressed in idle mode.)

mode

consumption at 2V6 with Low Current-LEDs consumption at 2V6 with NOKIA LCD
sleep 1,2 to 2 µA (!) 1,2 to 2 µA (!)
idle 1,3 to 1,5 mA 1,3 to 1,5 mA
transmitting IR 11 to 17 mA 9 to 13 mA
receiving IR 2 to 10 mA 2 to 2,2 mA
backup or restore 5 mA 2,7 mA
 

All user data is stored in the 24LC256 i²c EEPROM. It contains 32768 bytes (8 pages of 4096 bytes.) That’s plenty! Pages 0 to 5 (0x0xxx to 0x5xxx) each contain data from the six devices (Aux, TV, Hifi, CD, DVD, Video) we are able to use. Page 6 is unused, page 7 stores all configuration data (f.e. which key is assigned to “PROGRAM” or to the device “DVD”…)

A maximum of 32 keys (4 columns by 8 rows) are supported. We have six fixed DEVICE SELECT keys (Aux, TV, Hifi, CD, DVD, Video), 1 fixed PROGRAM key , 1 fixed ENTER key. These eight fixed keys have to be programmed at the first power up (LCD shows “key init” “Program key?”, LEDs show “01000”) See more below. There are a maximum of 24 free COMMAND keys for each one of the six devices. Each free command key is protocol-free, this way we can mix protocols inside each device page.

RB4..7 are outputs to the four key columns. RB1..3 are inputs coming from the 8-bit HC148 encoder.

Whilst in sleep mode, pressing one of the keys on the key-matrix awakes the processor. The HC148, GS output which goes to to the PIC interrupt INT/RB0, goes low each time a key is pressed.

Also nice: the last device selected is stored in EEPROM. So, even unpowered, the circuit will keep all settings & data safe. You can even make a complete backup or restore of all data 😉

The IR receiver TSOP34836 (output comes low when a IR burst of around 36KHz detected) is powered only in program mode. The receiver takes only 0,7 mA but it’s still worth disabling while unneeded. More details about protocols & waveforms below.

For IR transmitting, there is of course an IR LED. It is boosted by a BC639. When enabled, it sends out  a burst of 37,1 kHz generated by the processor.

But, as you have guessed, all the rest is program code. More info under “source code explanation” below.

 

For more detail: Programmable IR remote control using PIC16LF877

Quick Solutions to Questions related to Multiprotocol Infrared Remote Control:

  • How many existing remote controls can this device replace?
    It replaces up to 6 existing remote controls into one.
  • What is the power consumption in sleep mode?
    Power consumption is only 1.2 to 2 µA in sleep mode.
  • Can the battery voltage drop below 2.6V?
    Yes, the circuit is powered by two AAA batteries where the voltage can drop as low as 2.5V.
  • Does the device store the last selected device after being unpowered?
    Yes, the last device selected is stored in EEPROM so settings remain safe even when unpowered.
  • What triggers the processor to wake from sleep mode?
    Pressing one of the keys on the key-matrix awakes the processor while in sleep mode.
  • Is the IR receiver powered continuously?
    No, the TSOP34836 IR receiver is powered only in program mode to save energy.
  • How many command keys are supported for each device?
    A maximum of 24 free COMMAND keys are supported for each of the six devices.
  • Which specific protocol is mentioned as compatible in the title?
    The device is compatible with NEC-SIRCS-JAPAN-RC5-SAMSUNG protocols.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter