Remote Control Handset "1"
Posted: Wed May 02, 2012 11:57 am
MINI INFRA RED REMOTE CONTROL HANDSET
A GENERAL VIEW
One of the nice peripherals included in the new range of micros recently launched from Microchip, is the Data Signal Modulator (DSM) that can provide a ready for transmission modulated signal, eliminating the need for external parts. The modulation function is executed inside the micro, where both the Carrier and the Modulator signals are mixed and then provided at its MDOUT pin. This function is useful to build remote control transmitters like this of the current project which is a mini IR remote control handset that offers the 4 basic functions: STBY, MUTE, VOL+ and VOL-. The transmission protocol that used is the Philips RC-5. Flow Code offers a ready RC-5 component that includes any necessary macro and its use is very simple: Click on it in the components bar and will drop on project panel. Make the required configuration and connections thru its properties and connections windows and you are ready! The number of parts required for a complete unit – see in photos – is impressively small. Just 14 parts (included the micro, the battery, the PCB and the plastic case) are needed to build the unit and the total cost is about 7.50 Euro.
THE CIRCUIT
A 18 pin PIC16F1827 micro is the heart of the unit, providing the modulated signal at its MDOUT pin (RB.3). A high bandwidth NPN transistor (BC547) is used to isolate the MDOUT of micro from the current that flows thru the 2 parallel connected LED. The one is a common 3mm green LED which blinks in the rate of the sequential RC5 packets that transmitted, while the other is a 940nm IR LED that transmits the RC5 encoded signal in the infrared region of spectra. In practice the green LED serves just to indicate that the transmitter is working and that the battery is in good state. Four momentary push switches (tactile type) are used to activate the 4 functions, connected at four inputs (RB.4 – RB.7) of micro. The internal “weak pull – ups” of these pins are enabled as well their IOC interrupt. When a switch is pressed drives the corresponding input in LOW state causing an "Interrupt On Change" (IOC) that is used just to wake up the micro from its SLEEP state. The SLEEP function saves the battery power which is a 3V Lithium cell. In actual measurements, the current that flows from battery during SLEEP mode is just 25μA, while during ACTIVE mode is 3.7mA average.
THE PROGRAM CODE
It has obtained with the use of Flow Code v5. The configuration settings of P16F1827 are few: INTOSC, BOR and POR resets are enabled while everything else is disabled. MCLR pin is disabled (is tied internaly to Vdd) as the micro General Reset is covered from the combination of POR and BOR resets. BOR level is set to 1.9V because the 3V battery.
The INTOSC of 16F1827 is automatically set at 500 KHz after each reset, so we have to initialize it at 16MHz which is a suitable frequency for the current project that demands a 36KHz Carrier frequency according to RC5 TX-RX protocol. As source of the Carrier frequency has been selected the CCP1 (PWM Channel 1) internal module of micro. By setting its Period Register = 110 (see in PWM compo properties window) and under the given Clock speed of 16MHz we get a period of 27.75μs which corresponds exactly to the target frequency = 36.03604 KHz. Furthermore, the Duty Cycle of PWM is set to “30” or 27% (actually between 25 – 30%). This setting offers additional saving of battery power.
The Modulation signal source is the Flow Code RC5 component (combined with the related program code) that generates the RC5 packets which comprised from the RC5 address, RC5 command and RC5 toggle bit.
The DSM module can be configured in several ways. In the current project all peripheral outputs are disabled and as Modulation input of DSM is selected the MDMIN pin (RB.2). This pin has also been selected as the TX output of RC5 component (see in RC5 connections window) and so the Modulation data are transferred internally (thru the Port RB.2 register) to the DSM. Then the Modulation data are mixed with the HIGH Carrier signal (the LOW Carrier signal is connected to Vss so is always “0”) produced by CCP1 inside the DSM and finally the mixed signal is exported to the MDOUT (RB.3) pin of micro.
A special Loop in the beginning of Flow Chart gives the possibility to select between two different TX address: “16” (RC5 preamp 1) or “19” (RC5 preamp 2). The address “16” is selected by default. To change the address in “19” we have to remove – insert the battery (causing thus a device reset) and to press within 3 seconds the MUTE switch. To recover again the address “16” we simply have to remove – insert the battery without pressing any switch.
In the MAIN program Loop we can see two branches. When the device is inactive the command “SLEEP” is continuously executed. When a switch is pressed it causes an IOC interrupt that wake up the micro from its SLEEP state. The macro “WEAK_UP” exists because the interrupt has to call a… macro and nothing more. After this, a “Switch” icon detects which switch is pressed and accordingly steers the program flow into one of the 4 branches where the variable “RC5cmd” gets the corresponding value. Then the program flow is turned into the second “Switch” icon where the TOGGLE bit is changed or keeps its previous state. It should be noted that the use of TOGGLE bit is necessary. That is because the RC5 Receivers are programmed to handle the STBY and MUTE function in a different way from the VOL+ and VOL- function. STBY and MUTE are executed once and to be executed again we have to release and press again the corresponding switch, while the VOL+ and VOL- are executed continuously as long as the corresponding switch is pressed. You can try the FCF on simulator to see how the TOGGLE bit changes its state. Select a speed of 100, press the RUN button and add in Variables window the “TOGGLE” variable. Press any switch firmly or momentary and keep an eye on variable “TOGGLE” to observe when its state is changed. In the end of branch, and inside the compo macro “RC5_TX_Packet”, the RC5addr – RC5cmd – RC5toggle variables are combined to form a RC5 packet ready for transmission.
CONSTRUCTION & CONCLUSIONS
In this project a SMD P16F1827 (SOIC wide package) is used and so a double sided PCB is necessary. After completing it, I found that inside the box could fit even a conventional PDIP package 16F1827. Though is not so difficult to solder a SOIC device as the only needed is a soldering iron equiped with fine tip and some attention. The PCB is 34mm X 61mm home made. The rest parts can be soldered very easy as they are Through Hole type (THT). To program the SMD micro its ICSP capability should be used. You can see in the left side of PCB the 5 holes (Vpp, Vdd, Vss, PGC and PGD) in which 5 wires are temporarily solderd to communicate with the EB006 programmer. (For this work I use my own made adaptor on which are mounted a 40pin ZIF socket and an ICSP header)
The plastic case is an excellent TEKO 1124.4 (ABS molded) Pocket size. Is formed from 3 separate pieces, the bottom the top and the battery cover. The three pieces can snap to each other very easily and there is no need for screws. The bottom piece provides supports and two guide pins for the mounting and the perfect alignment of the PCB. The PCB can be easily inserted or removed to - from its base. Inside the TEKO package included the 4 key caps which can fit only in tactile switches. The actuators of switches should have a height of 3.4 to 3.7 mm to fit in caps. The only modification that we have to do on the TEKO case is to open a 5mm hole for the IR LED (see in photo).
And now the question: Is it or not worthy the build of this small handset? I did enough research (though, as a DIYer I had no one reason to do this) on the web in this direction. There are enough RC5 compatible universal remote handsets offered on e-bay and other on-line shops for 5 to 7 Euro. There are also original Philips for 15 Euro. Their main disadvantages are three: a) All of them transmit the RC5 address “0” which is dedicated to TV sets. No one transmits the RC5 address “16” or “19” which are dedicated to audio preamplifiers. 2) Are cluttered from 30 to 40 buttons of which just 8 to 10 are useful to control a preamplifier. 3) In all of these is used a low quality membrane type keypad and a cheap non-epoxy PCB that can break easily under press. When a key or the PCB fails (which usually occurs very soon) the remote control handset is for the garbage.I have throw in the trash bin enough such type remote control handsets.
Looking at this small remote handset, its total cost at 7.50 Euro looks some big. Only the cost of the TEKO case is 3.56 Euro, but is of high quality made from very rugged ABS plastic (it is almost unbreakable) and can be disassembled very easily. The other benefit is that transmits the dedicated address for preamps. Its third benefit is the replaceable tactile switches that used. When a switch completes its service life can be easily replaced with a new one as its de-soldering is very easy. Taking into account the above, this "repairable" small unit can be characterized as a “lifetime” device.
In my own view, this project is not for mass production. It is for use from DIYers, hobbyists etc.
And of course is the companion of the project REMOTELY CONTROLLED MOTORIZED VOLUME POT. http://www.matrixmultimedia.com/mmforum ... =3&t=10298
I have already in process a bigger handset that will cover 15 to 20 different functions for the upgrade of multipurpose PGA2310 preamplifier.
A GENERAL VIEW
One of the nice peripherals included in the new range of micros recently launched from Microchip, is the Data Signal Modulator (DSM) that can provide a ready for transmission modulated signal, eliminating the need for external parts. The modulation function is executed inside the micro, where both the Carrier and the Modulator signals are mixed and then provided at its MDOUT pin. This function is useful to build remote control transmitters like this of the current project which is a mini IR remote control handset that offers the 4 basic functions: STBY, MUTE, VOL+ and VOL-. The transmission protocol that used is the Philips RC-5. Flow Code offers a ready RC-5 component that includes any necessary macro and its use is very simple: Click on it in the components bar and will drop on project panel. Make the required configuration and connections thru its properties and connections windows and you are ready! The number of parts required for a complete unit – see in photos – is impressively small. Just 14 parts (included the micro, the battery, the PCB and the plastic case) are needed to build the unit and the total cost is about 7.50 Euro.
THE CIRCUIT
A 18 pin PIC16F1827 micro is the heart of the unit, providing the modulated signal at its MDOUT pin (RB.3). A high bandwidth NPN transistor (BC547) is used to isolate the MDOUT of micro from the current that flows thru the 2 parallel connected LED. The one is a common 3mm green LED which blinks in the rate of the sequential RC5 packets that transmitted, while the other is a 940nm IR LED that transmits the RC5 encoded signal in the infrared region of spectra. In practice the green LED serves just to indicate that the transmitter is working and that the battery is in good state. Four momentary push switches (tactile type) are used to activate the 4 functions, connected at four inputs (RB.4 – RB.7) of micro. The internal “weak pull – ups” of these pins are enabled as well their IOC interrupt. When a switch is pressed drives the corresponding input in LOW state causing an "Interrupt On Change" (IOC) that is used just to wake up the micro from its SLEEP state. The SLEEP function saves the battery power which is a 3V Lithium cell. In actual measurements, the current that flows from battery during SLEEP mode is just 25μA, while during ACTIVE mode is 3.7mA average.
THE PROGRAM CODE
It has obtained with the use of Flow Code v5. The configuration settings of P16F1827 are few: INTOSC, BOR and POR resets are enabled while everything else is disabled. MCLR pin is disabled (is tied internaly to Vdd) as the micro General Reset is covered from the combination of POR and BOR resets. BOR level is set to 1.9V because the 3V battery.
The INTOSC of 16F1827 is automatically set at 500 KHz after each reset, so we have to initialize it at 16MHz which is a suitable frequency for the current project that demands a 36KHz Carrier frequency according to RC5 TX-RX protocol. As source of the Carrier frequency has been selected the CCP1 (PWM Channel 1) internal module of micro. By setting its Period Register = 110 (see in PWM compo properties window) and under the given Clock speed of 16MHz we get a period of 27.75μs which corresponds exactly to the target frequency = 36.03604 KHz. Furthermore, the Duty Cycle of PWM is set to “30” or 27% (actually between 25 – 30%). This setting offers additional saving of battery power.
The Modulation signal source is the Flow Code RC5 component (combined with the related program code) that generates the RC5 packets which comprised from the RC5 address, RC5 command and RC5 toggle bit.
The DSM module can be configured in several ways. In the current project all peripheral outputs are disabled and as Modulation input of DSM is selected the MDMIN pin (RB.2). This pin has also been selected as the TX output of RC5 component (see in RC5 connections window) and so the Modulation data are transferred internally (thru the Port RB.2 register) to the DSM. Then the Modulation data are mixed with the HIGH Carrier signal (the LOW Carrier signal is connected to Vss so is always “0”) produced by CCP1 inside the DSM and finally the mixed signal is exported to the MDOUT (RB.3) pin of micro.
A special Loop in the beginning of Flow Chart gives the possibility to select between two different TX address: “16” (RC5 preamp 1) or “19” (RC5 preamp 2). The address “16” is selected by default. To change the address in “19” we have to remove – insert the battery (causing thus a device reset) and to press within 3 seconds the MUTE switch. To recover again the address “16” we simply have to remove – insert the battery without pressing any switch.
In the MAIN program Loop we can see two branches. When the device is inactive the command “SLEEP” is continuously executed. When a switch is pressed it causes an IOC interrupt that wake up the micro from its SLEEP state. The macro “WEAK_UP” exists because the interrupt has to call a… macro and nothing more. After this, a “Switch” icon detects which switch is pressed and accordingly steers the program flow into one of the 4 branches where the variable “RC5cmd” gets the corresponding value. Then the program flow is turned into the second “Switch” icon where the TOGGLE bit is changed or keeps its previous state. It should be noted that the use of TOGGLE bit is necessary. That is because the RC5 Receivers are programmed to handle the STBY and MUTE function in a different way from the VOL+ and VOL- function. STBY and MUTE are executed once and to be executed again we have to release and press again the corresponding switch, while the VOL+ and VOL- are executed continuously as long as the corresponding switch is pressed. You can try the FCF on simulator to see how the TOGGLE bit changes its state. Select a speed of 100, press the RUN button and add in Variables window the “TOGGLE” variable. Press any switch firmly or momentary and keep an eye on variable “TOGGLE” to observe when its state is changed. In the end of branch, and inside the compo macro “RC5_TX_Packet”, the RC5addr – RC5cmd – RC5toggle variables are combined to form a RC5 packet ready for transmission.
CONSTRUCTION & CONCLUSIONS
In this project a SMD P16F1827 (SOIC wide package) is used and so a double sided PCB is necessary. After completing it, I found that inside the box could fit even a conventional PDIP package 16F1827. Though is not so difficult to solder a SOIC device as the only needed is a soldering iron equiped with fine tip and some attention. The PCB is 34mm X 61mm home made. The rest parts can be soldered very easy as they are Through Hole type (THT). To program the SMD micro its ICSP capability should be used. You can see in the left side of PCB the 5 holes (Vpp, Vdd, Vss, PGC and PGD) in which 5 wires are temporarily solderd to communicate with the EB006 programmer. (For this work I use my own made adaptor on which are mounted a 40pin ZIF socket and an ICSP header)
The plastic case is an excellent TEKO 1124.4 (ABS molded) Pocket size. Is formed from 3 separate pieces, the bottom the top and the battery cover. The three pieces can snap to each other very easily and there is no need for screws. The bottom piece provides supports and two guide pins for the mounting and the perfect alignment of the PCB. The PCB can be easily inserted or removed to - from its base. Inside the TEKO package included the 4 key caps which can fit only in tactile switches. The actuators of switches should have a height of 3.4 to 3.7 mm to fit in caps. The only modification that we have to do on the TEKO case is to open a 5mm hole for the IR LED (see in photo).
And now the question: Is it or not worthy the build of this small handset? I did enough research (though, as a DIYer I had no one reason to do this) on the web in this direction. There are enough RC5 compatible universal remote handsets offered on e-bay and other on-line shops for 5 to 7 Euro. There are also original Philips for 15 Euro. Their main disadvantages are three: a) All of them transmit the RC5 address “0” which is dedicated to TV sets. No one transmits the RC5 address “16” or “19” which are dedicated to audio preamplifiers. 2) Are cluttered from 30 to 40 buttons of which just 8 to 10 are useful to control a preamplifier. 3) In all of these is used a low quality membrane type keypad and a cheap non-epoxy PCB that can break easily under press. When a key or the PCB fails (which usually occurs very soon) the remote control handset is for the garbage.I have throw in the trash bin enough such type remote control handsets.
Looking at this small remote handset, its total cost at 7.50 Euro looks some big. Only the cost of the TEKO case is 3.56 Euro, but is of high quality made from very rugged ABS plastic (it is almost unbreakable) and can be disassembled very easily. The other benefit is that transmits the dedicated address for preamps. Its third benefit is the replaceable tactile switches that used. When a switch completes its service life can be easily replaced with a new one as its de-soldering is very easy. Taking into account the above, this "repairable" small unit can be characterized as a “lifetime” device.
In my own view, this project is not for mass production. It is for use from DIYers, hobbyists etc.
And of course is the companion of the project REMOTELY CONTROLLED MOTORIZED VOLUME POT. http://www.matrixmultimedia.com/mmforum ... =3&t=10298
I have already in process a bigger handset that will cover 15 to 20 different functions for the upgrade of multipurpose PGA2310 preamplifier.