handsontechnology support open source hardware(oshw ...the elektor electronicswebsite or...

14
HandsOn Tech provides a multimedia and interactive platform for everyone interested in electronics. From beginner to diehard, from student to lecturer… Information, education, inspiration and entertainment. Analog and digital; practical and theoretical; software HandsOn Technology support Open Source Hardware(OSHW) Development Platform. and hardware… Learn : Design : Share www.handsontec.com

Upload: others

Post on 31-Mar-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: HandsOnTechnology support Open Source Hardware(OSHW ...the Elektor Electronicswebsite or alternatively can be ordered (at nom-inal cost) on diskette 010029-11. If you are planing to

HandsOn Tech provides a multimedia and interactive platform foreveryone interested in electronics. From beginner to diehard, fromstudent to lecturer… Information, education, inspiration andentertainment. Analog and digital; practical and theoretical; software

HandsOn Technology support Open SourceHardware(OSHW) Development Platform.

and hardware…

( ) p

Learn : Design : Sharewww.handsontec.com

Page 2: HandsOnTechnology support Open Source Hardware(OSHW ...the Elektor Electronicswebsite or alternatively can be ordered (at nom-inal cost) on diskette 010029-11. If you are planing to

It’s a rare piece of entertainment equipmentthat does not come with its own remote con-troller. After a few years it’s easy to accumu-late a drawer-full of (functional) controllersbelonging to equipment long since consignedto showrooms at your local householdamenity tip.

Equipment manufacturers tend to use dif-ferent controller protocols so it is rare to findby chance a controller from one manufacturerable to control equipment from another. All ofthe protocols used should however complywith one of the eight industry standards.

Many electronics enthusiasts can proba-

bly think of lots of applications for adiscarded remote controller. Forexample using the well-documentedRC5 or RECS80 protocol from Philipsa simple receiver/decoder can bebuilt using the SAA3009 or SAA3049IC from Philips if only you knewdetails of the controller coding. Sim-ilarly if you are looking for a secondcontroller for a piece of equipment itsnot practical to lug a portable oscil-loscope to the local car boot sale toanalyse each controller on offer.

This device offers the ideal solu-

tion. The chief design criteria for theIR analyser was to produce a neat,portable unit that would quicklyenable a check to be made of theoutput signal of an unknown remotecontroller. A microcontroller decodesthe IR message and displays theimportant information on an LCD. Inuse the unknown IR controllershould be placed close to theanalyser’s receiver IC before a com-mand key is pressed. The microcon-troller will decode the message anddisplay information indicating the

TEST&MEASUREMENT

26 Elektor Electronics 10/2001

IR Code Analyseridentify remote control codes!

Point any IR remote controller at this nifty device and its in-built micro-controller will quickly analyse the signal and reveal which of eight stan-dard control protocols the controller is using.

Microcontroller– 4 KByte ROM

– 128 Byte RAM

– 32 Byte EEPROM for user code

– 2.7 to 6 V Supply voltage

– Two 16 Bit Timer/Counter

– Integrated reset

– Internal RC Oscillator

(selectable)

– 20 mA drive current

from all the port pins

– Maximum 18 I/O-Pins,

when the internal reset and RC

oscillator is used.

– 2 analogue comparators

– I2C interface

– Full duplex UART

– Serial In-circuit Programmable

Page 3: HandsOnTechnology support Open Source Hardware(OSHW ...the Elektor Electronicswebsite or alternatively can be ordered (at nom-inal cost) on diskette 010029-11. If you are planing to

ted so it’s a good idea to carry a few spareswith you.

Some of the more modern remote con-trollers will send out two messages each timea key is pressed. The first message is in oneformat while the second message containsthe same information in a different format.The analyser will only display the last mes-sage format sent.

HardwareThere are no surprises in the circuit diagram ofthe IC code analyser shown in Figure 3.

The infra red signal is detected by IC2. Infi-neon have ceased production of their receiverIC but any one of the compatible devicesspecified in the parts list would be suitable.This device contains a highly sensitive infrared receiver, amplifier, filter and demodulatortuned to an IR carrier frequency of 36 kHz. Adata sheet for this device can be downloaded from:(www.infineon.com/cmc_upload/0/000/008/562/sfh5110.pdf).The inverted demodulated received signal isconnected directly to an input port of themicrocontroller IC1. IC2 is relatively sensitiveto supply rail disturbances so R2 and C2 areused to form a low pass filter, decoupling anyinterference.

The core of the microcontroller is based onthe Intel 51 architecture that lends itself tosimple low-cost program development byusing any of the available Shareware devel-opment tools. The 87LPC764 is produced byPhilips and is described as a Low power, lowprice, low pin count microcontroller. Decoding

protocol used and the commandsent. A good source of detailed infor-mation about the different IR proto-col formats can be found in theMarch and April 2001 edition of Elek-tor Electronics.

This analyser is only suitable fordecoding modulated signals in therange of 30 - 40 kHz. Fortunately allthe common control protocols usethis frequency range.

Some (older) controllers use flashmode where the message informa-tion is conveyed by switching on thesender diode for a short periodrather than modulating it at 36 kHz(see Figure 1). The analyser’s IRreceiver chip will only respond tomodulated signals so that flashmode messages will be ignored.

OperationOnce the analyser is switched on themessage ‘CODE ANALYSER VER 1‘will be displayed and then ‘WAIT-ING...‘ indicating that the analyser isready and waiting to receive an IRcontroller message. As soon as amessage is received the analyserwill display the type of coding sentby the controller and pressing push-button S1 will display further infor-mation about the received message.

1. Key press: AddressThis hexadecimal value indicates thetype of equipment that the controllerwas originally designed to control.As an example, if the controller usesRC5 protocol format and the address0 is displayed this indicates thatcontroller will control a TV. Somemanufacturers do not use theaddress field in the message so inthis case two lines (—) will be

shown on the display.

2. Key press: CommandThis hexadecimal value indicates thetype of command that was sent inthe message. A 10hex (16dec) forexample in RC5 coding indicatesthat the command will increase vol-ume of the controlled equipment.

3. Key press: Complete codeThe contents of the entire messageare displayed in hexadecimal. Thehex value assumes that the data issent in the order Bit 7 to Bit 0. Somemanufacturers (e.g. Sony) howeverreverse the bit order. In this case thevalues are corrected before display.

4. Key press: Type of CodeThis displays the protocol type of thelast received message e.g. RC5,SIRCS or RECS80.

When the display showsUNKNOWN this indicates that thereceived message does not conformto any of the eight standard proto-cols. It could also indicate howeverthat the signal was too weak or toodistorted. The IR receiver IC2 is opti-mised for reception of a 36 kHz mod-ulated signal so its sensitivity tosome signal protocols at theextremes of the 30-40 kHz band willbe greatly reduced (see Figure 2 ).Always place the output diode of thehandheld controller as close as pos-sible to IC2 of the analyser to ensurea good signal. LED D2 will blink toindicate signal reception irrespectiveof the type of protocol so it gives agood indication that the controller issending out a signal. If the diodedoes not blink try a new set of bat-teries in the controller. Items at carboot sales rarely have batteries fit-

TEST&MEASUREMENT

2710/2001 Elektor Electronics

Figure 1. Flash mode signal (a) modulated mode signal at 36 kHz (b).

Figure 2. The sensitivity of the IR receiver fallsoff sharply either side of its centre frequency.

Page 4: HandsOnTechnology support Open Source Hardware(OSHW ...the Elektor Electronicswebsite or alternatively can be ordered (at nom-inal cost) on diskette 010029-11. If you are planing to

the IR message is relatively processor inten-sive so a clock rate of 6 MHz is used for themicrocontroller giving a machine cycle of

1 µs. The main features of thisprocessor are summarised under theheading ‘microcontroller’.

Power for the analyser is providedby a 9 V battery and zener diode D1regulates this on-board to 5 V. Resis-tor R1 limits the supply current andoverall consumption is approxi-mately 20 mA.

DisplayThe display is a standard 1x16 LCD(indicating 1 row of 16 characters).This display is a standard item frommany manufacturers. It has a built-in controller using a standard com-mand set. All of the compatible dis-plays mentioned in the parts listhave identical pin-outs, RAMaddresses and multiplex rate. Theinformation generated by thisanalyser could be displayed on a fourline LCD but to reduce costs it wasdecided to employ a single line dis-play and use a pushbutton to togglethrough the information. The displaycontrol software is simplified byusing eight controller port pins. P1 isa variable resistor, allowing adjust-ment of the display contrast.

SoftwareAll the relevant data for the follow-ing protocols are integrated into thesoftware so that they can bematched to the incoming signal:

JAPANESE NEC RC5 RECS80SIRCS DENON DAEWOOMOTOROLA The software starts its analysis ofthe incoming signal by measuringthe first low-phase. Almost all of theprotocol formats have differentlength start bits so this simplifies theidentification process. All of theincoming signal time measurementsare made using the microcontrollerstimer, this gives a maximum resolu-tion of 1 ms with the 6 MHz clockfrequency. After the start bit thatusually consists of a low followed bya high of predefined length themicrocontroller decides how theincoming data will be stored in theinternal registers. The messagelength will depend on the type ofprotocol and can be from 11 bits forRCS80 protocol up to 48 bits forJapanese coding. The timing toler-ance of the message length is takeninto account and the length of eachbit is measured and compared to itslimit values.

The Software, including source

TEST&MEASUREMENT

28 Elektor Electronics 10/2001

87LPC764

IC1

P0.0

P0.1

P0.2

P0.3

P0.4

P0.5

P0.6

P0.7P1.7

P1.6

P1.5

P1.4(INT1)

P1.3(INT0)

P1.2

P1.1

P1.0

X1 X2

15

20

19

18

17

16

14

13

10

11

12

6 75

1

2

3

4

8

9

+5V

SFH505A

IC2 1

3

2

S1X1

6MHzC3

15p

C4

15p

R21

00

ΩR4

10

0k

R3

1k2

R1

220Ω

K1

D2C2

100µ 16V

P1

10kD1

5V1

C1

10µ16V

SFH505A

12

3

0

+

VSS

VDD

Vo

RS

R/W

E

D0

D1

D2

D3

D4

D5

D6

D7

010029 - 11

Dot Matrix Display 1 x 16

9V

20mA

Figure 3. Only two IC’s are used in the analyser circuit diagram.

Figure 4. An NEC coded signal (used by Harman/Kardon or Yamaha).

Page 5: HandsOnTechnology support Open Source Hardware(OSHW ...the Elektor Electronicswebsite or alternatively can be ordered (at nom-inal cost) on diskette 010029-11. If you are planing to

dated (just double-check the pin-outs).The LCD is connected to the PCB via a

short length of ribbon cable. The displaysgiven in the parts list have a 1:1 pin to pincompatibility with the PCB layout. Othertypes of displays can be used but you willneed to study the corresponding data sheetto ensure correct signal connections. Oncethe circuit has been given a functional test itcan be mounted together with the 9 V batteryin a suitable case. If a transparent case isused it will only be necessary to drill twoholes in the case, one for the on/off switchand one for the mode switch. The display willbe visible through the case.

(010029-1)

code is available free of charge fromthe Elektor Electronics website oralternatively can be ordered (at nom-inal cost) on diskette 010029-11. Ifyou are planing to modify or cus-tomise the software it should benoted that the pulse width of thereceived IR signals varies quite sub-stantially with received signalstrength so the decoding softwareshould be correspondingly tolerant.The following table gives a practicalexample of pulse tolerances for thesignal shown in Figure 4 (NEC codefrom Harman/Kardon or Yamaha):

1. Low phase: 8700 - 9200 ms1. High phase: 4352 - 4607 msSecond low phase: 400 - 767msGap between low phases:

0-Bit: 400 - 767 ms1-Bit: >767 ms

The relatively large tolerances oftencorrespond to the high byte value ofthe 16 bit timing counter so that thehex calculations can be simplified byignoring the least significant eightbits of the timing counter.

ConstructionThe PCB layout is shown in Figure 5.The board shown is unfortunatelynot available ready-made throughour Readers Services, so you have tomake it yourself. Microcontroller IC1is fitted to the PCB using a 20 pinDIP socket. The IR receiver (IC2)shown is the Infineon type but othercompatible types given in the partslist can be fitted. The compatibletypes have similar performance butnot identical pin-outs so extramounting pads on the PCB enablethese other types to be accommo-

TEST&MEASUREMENT

2910/2001 Elektor Electronics

Figure 5. The crystal needs to be mounted flat on the PCB (board not available ready-made).

010029-1(C) ELEKTOR

C1

C2C3C4

D1

D2

H1

H2

IC1

IC2

K1

P1

R1

R2

R3

R4

S1

X1

010029-1

0

+9V

010029-1(C) ELEKTOR

COMPONENTS LIST

Resistors:R1,R2 = 220ΩR3 = 1kΩ2R4 = 100kΩP1 = 10kΩ preset H

Capacitors:C1 = 10µF 16V radialC2 = 100µF 16V radialC3,C4 = 15pF

Semiconductors:D1 = zener diode 5V1, 1 WD2 = LED, high-efficiency, redIC1 = 87LPC764 (programmed,

order code 010029-41)IC2 = SFH505A (TSOP1736,

SFH5110-36, PIC26043SM,IS1U60, TFMS5360)

Miscellaneous:K1 = 14-way flatcableS1 = push-button, 1 make contactX1 = 6MHz quartz crystalDot matrix display, 1 x 16 charac-

ters (MCC161A1-4, MCC161A2-3(Truly), LM161556 (Sharp)

9V battery with clipEnclosure (Heddic 222)On/off switch

Page 6: HandsOnTechnology support Open Source Hardware(OSHW ...the Elektor Electronicswebsite or alternatively can be ordered (at nom-inal cost) on diskette 010029-11. If you are planing to

Its almost impossible to buy a TV today thatdoesn’t have a IR remote controller and itsonly when we temporarily mislay this devicethat we realise how useful they are. Back in1975 when the first remote controllersappeared they used ultra sonic signals tosend the control information, these were latersuperseded by the controllers that we arefamiliar with today using infra red. The infrared devices offer lower production costs, wideoperating range and good communicationsecurity. A look inside a typical remote con-troller will show that it consists of only oneIC. The IC interprets each key press andsends a coded data signal to the transmitterIR diode. A simple resonator is also used tosupply a stable clock. On the receiving sidein the equipment being controlled we find aIR detector and demodulator which is nor-mally integrated into the same device. TheSFH505-xx family of devices from Siemenscontains the receiver, demodulator and out-put driver so that the received data can beconnected directly to a micro controller orcontrol decoder. Unfortunately the actual con-trol protocol used by each manufacturer aremostly incompatible.The IR message transmitted by the controller

is subject to interference from otherIR sources in the vicinity. Theseinclude heaters, incandescent lampsand other heat generators. One stan-dard method of rejecting thisunwanted interference is to modulateeach transmitted bit with a stablecarrier frequency in the range of 30 to40 kHz. Another method is the so-called flash mode, this technique isemployed by the Plessey MV500 chip(described in the February 1991 edi-tion of Elektor Electronics). Thismethod outputs data in the form of17 µs short flashes of IR light fol-lowed by different off periods. Nokiaalso use this method with theirIRT1250 IC. This system has howevernot gained wide acceptance and thevast majority of remote controllersuse the modulation technique.

The accompanying oscilloscopepictures show each of the describedtransmission formats received by theTemic TFMS5360 receiver IC. Thisdevice is optimised for reception of asignal modulated at 36 KHz but canalso detect other frequencies albeit

with a reduced range. In the upperhalf of the picture a single telegramis shown and in the lower half a con-tinuous key-press is shown. The out-put of the IC goes low when themodulated signal is detected.

It is important to note that theequipment manufacturer is entirelyat liberty to choose a transmitterclock frequency and as such the tim-ing given here may not be accurateunder all conditions. The timings ofpulse lengths may also be affectedby the sample clock in theTFMS5360 and could have an error of±160 µs (Temic data sheet).

The communications formatsdescribed are the most popular butit does not represent all the possibleformats that you are likely to find.Many firms have devised their owncontrol format, sometimes in order toreduce costs or sometimes to incor-porate different control features thatare not catered for with the existingstandards. If you use a mask pro-grammable micro controller for cod-ing and decoding you will be com-

GENERALINTEREST

50 Elektor Electronics 3/2001

IR Remote ControlCodes (1)formats, protocols and(in)compatibilityBy A.N. Other

There are so many different remotecontrol message formats currently inuse that it can all be a bit confusing. If you are experimenting with remotecontroller IC’s then its important to know the different control protocolsused by each manufacturer. This article seeks to describe the most pop-ular protocols in current use.

Page 7: HandsOnTechnology support Open Source Hardware(OSHW ...the Elektor Electronicswebsite or alternatively can be ordered (at nom-inal cost) on diskette 010029-11. If you are planing to

pletely at liberty to devise your ownprotocol which may be more suitedto your own particular hardware ofsoftware. This method also ensuresthat a manufacturer will not need toworry about licencing fees or possi-ble patent infringement.

Some modern remote IR con-trollers transmit the message a num-ber of times using different messageformats. For example the controllerwill first send out the Japanese codeand then 50 ms later sends out thesame command but this time usingRC 5 code. The advantage here for

the equipment manufacturer is thatfor future equipment developmentyou need not wait for a chip manu-facturer to produce a controller usinga particular IR coding standard. It isnow possible to select the best orcheapest integrated equipment con-troller and be sure that the IR remotecontroller will produce compatiblecontrol signals.

So which manufacturer and whichcoding system? This articledescribes some of the most popularIR coding standards currently in use.

(010023-1)

GENERALINTEREST

513/2001 Elektor Electronics

Code Manufacturer

RECS80 Thomson, Nordmende

NEC Harman/Kardon, Yamaha,

Canon

DENON Denon

SIRCS Sony

RC5 Loewe, Philips, Grundig,

Marantz

MOTOROLA Grundig, Kathrein

JAPAN Panasonic, Loewe

SAMSUNG Samsung

DAEWOO Daewoo

The most widely used coding method for IR control in Europeis the RC 5 code. This was originally developed by Philips andhas the capacity to send 2048 different commands. 32 address-able groups each with 64 commands. Each piece of equipmenthas its own address so that for example adjusting the volumeof your audio system will not affect the sound level of your TV.One complete message has a length of 14 bits and is com-posed of the following bits:

– 2 Start bits to control the AGC levels (Auto gain control) inthe receiver IC.

– 1 Toggle bit indicates that a new key is pressed.– 5 System address bits– 6 command bits

The toggle bit changes its value every time a new key ispressed and is used to tell the difference between pressingthe key again and holding the key down. The five address bitsfollow the toggle bit and indicate which piece of equipment isbeing controlled. Lastly the six command bits contain the con-trol information.

RC5 code employs biphase encoding, One bit of data is rep-resented by two half bits. A Low/High combination of thesebits indicates a data ‘1‘ whereas a High/Low combination indi-cates a data ‘0‘ The length of each bit is 1.778 ms, and a com-plete message is 24.889 ms long.

The RC5 code is probably the best documented protocol forIR control and particularly interesting are the two free systemaddresses 7 and 13 these are not allocated to any particularequipment type but are reserved for experimental purposes.Typical IC’s used for this message format are:

Transmitter:SAA3006, SAA3010 (Philips)HT6230 (Holtek)

Receiver:SAA3009, SAA3049 (Philips)

Table 1 shows in decimal the correspondence between theequipment and command codes used for this format.

Figure 1. RC5 code at the output of the receiver IC TFMS5360.

1 1 1 1 11 1 0

command

010023 - 12

address (bit 4 … bit 0)

24.889ms

113.778ms

start bits toggle bit

0 0 0 0 0 0

1778us

"1""0"889us

Figure 2. RC5 code message format (Address 1, command 28shown).

RC5 Code

Page 8: HandsOnTechnology support Open Source Hardware(OSHW ...the Elektor Electronicswebsite or alternatively can be ordered (at nom-inal cost) on diskette 010029-11. If you are planing to

GENERALINTEREST

52 Elektor Electronics 3/2001

The RC5 codes:Address Equipment0 . . . . . . . . . . . . . . . . .TV11 . . . . . . . . . . . . . . . . .TV22 . . . . . . . . . . . . . . . . .Videotext3 . . . . . . . . . . . . . . . . .Expansion for TV1 and TV24 . . . . . . . . . . . . . . . . .Laser Vision Player5 . . . . . . . . . . . . . . . . .Video recorder1 (VCR1)6 . . . . . . . . . . . . . . . . .Video recorder2 (VCR2)7 . . . . . . . . . . . . . . . . .Reserved8 . . . . . . . . . . . . . . . . .SAT19 . . . . . . . . . . . . . . . . .Expansion for VCR1 and VCR210 . . . . . . . . . . . . . . . .SAT211 . . . . . . . . . . . . . . . .Reserved12 . . . . . . . . . . . . . . . .CD Video13 . . . . . . . . . . . . . . . .Reserved14 . . . . . . . . . . . . . . . .CD Photo15 . . . . . . . . . . . . . . . .Reserved16 . . . . . . . . . . . . . . . .Audio preamplifier117 . . . . . . . . . . . . . . . .Tuner18 . . . . . . . . . . . . . . . .Analogue cassette recorder19 . . . . . . . . . . . . . . . .Audio preamplifier220 . . . . . . . . . . . . . . . .CD21 . . . . . . . . . . . . . . . .Audio Rack or Aufnahmegerät22 . . . . . . . . . . . . . . . .Audio Satellite receiver23 . . . . . . . . . . . . . . . .DCC Recorder24 . . . . . . . . . . . . . . . .Reserved25 . . . . . . . . . . . . . . . .Reserved26 . . . . . . . . . . . . . . . .writable CD27...31 . . . . . . . . . . . . .Reserved

keycodes:Code Key Function0 . . . . . . . . . . . . . . . . .01 . . . . . . . . . . . . . . . . .12 . . . . . . . . . . . . . . . . .23 . . . . . . . . . . . . . . . . .34 . . . . . . . . . . . . . . . . .45 . . . . . . . . . . . . . . . . .56 . . . . . . . . . . . . . . . . .67 . . . . . . . . . . . . . . . . .78 . . . . . . . . . . . . . . . . .89 . . . . . . . . . . . . . . . . .916 . . . . . . . . . . . . . . . .Volume +17 . . . . . . . . . . . . . . . .Volume –18 . . . . . . . . . . . . . . . .Brightness +19 . . . . . . . . . . . . . . . .Brightness –20 . . . . . . . . . . . . . . . .Colour saturation +21 . . . . . . . . . . . . . . . .Colour saturation –22 . . . . . . . . . . . . . . . .Bass +23 . . . . . . . . . . . . . . . .Bass –24 . . . . . . . . . . . . . . . .Treble +25 . . . . . . . . . . . . . . . .Treble –26 . . . . . . . . . . . . . . . .Balance right27 . . . . . . . . . . . . . . . .Balance left63 . . . . . . . . . . . . . . . .System select71 . . . . . . . . . . . . . . . .Dim local display77 . . . . . . . . . . . . . . . .Linear function increment78 . . . . . . . . . . . . . . . .Linear function decrement80 . . . . . . . . . . . . . . . .Step up81 . . . . . . . . . . . . . . . .Step down82 . . . . . . . . . . . . . . . .Menu on83 . . . . . . . . . . . . . . . .Menu off84 . . . . . . . . . . . . . . . .Display A/V system status85 . . . . . . . . . . . . . . . .Step left86 . . . . . . . . . . . . . . . .Step right87 . . . . . . . . . . . . . . . .Acknowledge88 . . . . . . . . . . . . . . . .PIP on/off (Pay TV channel + for system 3)89 . . . . . . . . . . . . . . . .PIP shift (Pay TV channel - for system 3)90 . . . . . . . . . . . . . . . .PIP / main swap (Radio channel + for system 3)91 . . . . . . . . . . . . . . . .Strobe on/off (Radio system – for channel 3)

92 . . . . . . . . . . . . . . . .Multi strobe (Date + for system 9)93 . . . . . . . . . . . . . . . .Main frozen (Date – for system 9)94 . . . . . . . . . . . . . . . .3/9 multi-scan (Start time + for system 9)95 . . . . . . . . . . . . . . . .PIP select (Start time – for system 9)96 . . . . . . . . . . . . . . . .Mosaic/multi-PIP (Record program + for system 9)97 . . . . . . . . . . . . . . . .Picture DNR (Record program – for system 9)98 . . . . . . . . . . . . . . . .Main stored (Alternate channel for system 9)99 . . . . . . . . . . . . . . . .PIP strobe (Stop time + for system 9)100 . . . . . . . . . . . . . . .Recall main picture (Stop time – for system 9)101 . . . . . . . . . . . . . . .PIP freeze102 . . . . . . . . . . . . . . .PIP step up +103 . . . . . . . . . . . . . . .PIP step down –118 . . . . . . . . . . . . . . .Sub mode119 . . . . . . . . . . . . . . .Options sub mode123 . . . . . . . . . . . . . . .Connect124 . . . . . . . . . . . . . . .Disconnect

Special commands for equipment addresses 0 und 1 (TV1 / TV2):Code Key Function10 . . . . . . . . . . . . . . . .1/2/3 digits / 1011 . . . . . . . . . . . . . . . .Freq./prog./ch./1112 . . . . . . . . . . . . . . . .Standby13 . . . . . . . . . . . . . . . .Mute/de-mute14 . . . . . . . . . . . . . . . .Personal pref.15 . . . . . . . . . . . . . . . .Display28 . . . . . . . . . . . . . . . .Contrast +29 . . . . . . . . . . . . . . . .Contrast –30 . . . . . . . . . . . . . . . .Search +31 . . . . . . . . . . . . . . . .Tint/hue –32 . . . . . . . . . . . . . . . .Ch./prog. +33 . . . . . . . . . . . . . . . .Ch./prog. –34 . . . . . . . . . . . . . . . .Altern./ch.35 . . . . . . . . . . . . . . . .? language36 . . . . . . . . . . . . . . . .Spatial stereo37 . . . . . . . . . . . . . . . .Stereo/mono38 . . . . . . . . . . . . . . . .Sleep timer39 . . . . . . . . . . . . . . . .Tint/hue. +40 . . . . . . . . . . . . . . . .RF switch41 . . . . . . . . . . . . . . . .Store/execute/vote42 . . . . . . . . . . . . . . . .Time43 . . . . . . . . . . . . . . . .Scan fwd./increm.44 . . . . . . . . . . . . . . . .Decrement46 . . . . . . . . . . . . . . . .Sec con/menu47 . . . . . . . . . . . . . . . .Show clock48 . . . . . . . . . . . . . . . .Pause49 . . . . . . . . . . . . . . . .Erase/correct50 . . . . . . . . . . . . . . . .Rewind51 . . . . . . . . . . . . . . . .Go to52 . . . . . . . . . . . . . . . .Wind53 . . . . . . . . . . . . . . . .Play54 . . . . . . . . . . . . . . . .Stop55 . . . . . . . . . . . . . . . .Record56 . . . . . . . . . . . . . . . .External 157 . . . . . . . . . . . . . . . .External 259 . . . . . . . . . . . . . . . .Advance60 . . . . . . . . . . . . . . . .TXT sub-mode/1261 . . . . . . . . . . . . . . . .Sys. Standby62 . . . . . . . . . . . . . . . .Crispener70 . . . . . . . . . . . . . . . .Speech/music79 . . . . . . . . . . . . . . . .Sound scroll104 . . . . . . . . . . . . . . .PIP size105 . . . . . . . . . . . . . . .Pic. Scroll106 . . . . . . . . . . . . . . .Act. On/off107 . . . . . . . . . . . . . . .Red108 . . . . . . . . . . . . . . .Green109 . . . . . . . . . . . . . . .Yellow110 . . . . . . . . . . . . . . .Cyan111 . . . . . . . . . . . . . . .Index/white112 . . . . . . . . . . . . . . .Next113 . . . . . . . . . . . . . . .Previous122 . . . . . . . . . . . . . . .Store open/close126 . . . . . . . . . . . . . . .Movie expand127 . . . . . . . . . . . . . . .Parental access

Page 9: HandsOnTechnology support Open Source Hardware(OSHW ...the Elektor Electronicswebsite or alternatively can be ordered (at nom-inal cost) on diskette 010029-11. If you are planing to

GENERALINTEREST

533/2001 Elektor Electronics

A message sent using the SIRCS or CNTRL S protocol fromSony consists of twelve to twenty bits. Five to thirteen of thesebits is used for the address field and seven bits for the keycode.

A Start bit (2.4 ms) is sent followed by a 0.6 ms space orpause. Next comes the data. A ’1’ is represented by a 1.2 msON or mark followed by a 0.6 ms OFF or pause. A ’0’ is repre-sented by a 0.6 ms ON and a 0.6 ms OFF. A typical messageis shown in Figure 4. The message is sent a minimum of twice(five times for a camcorder). The message is discarded if an

error is detected. SIRCS message coding is identical to CNTRLS, but SIRCS modulates the code at 40 kHz ready to be sent toan IR diode. CNTRL-S is the baseband (unmodulated) signaland is used between equipment where a communicationscable is fitted. Sony produce the following IC:

Transmitter:KIE RA275 S42

SIRCS/Control S Code

Figure 3. SIRCS code at the output of the TFMS5360 receiverIC.

45ms

start bit

2.4ms 0.6ms

2 command (bit 0 … bit 6) address (bit 0 … bit 4) ext. +3...8 bit

"0" "1"

0.6ms1.2ms

1.2ms 1.8ms010023 - 14

Figure 4. CNTRL-S and SIRCS message format.

The Sonycodes:Equipment address codes (decimal):Address Equipment type1 . . . . . . . . . . . . . . . . .TV2 . . . . . . . . . . . . . . . . .VTR14 . . . . . . . . . . . . . . . . .VTR26 . . . . . . . . . . . . . . . . .Laserdisc7 . . . . . . . . . . . . . . . . .VTR211 . . . . . . . . . . . . . . . .VTR312 . . . . . . . . . . . . . . . .Surround sound

processor16 . . . . . . . . . . . . . . . .Cassette deck, tuner17 . . . . . . . . . . . . . . . .CD Player18 . . . . . . . . . . . . . . . .Equaliser164 . . . . . . . . . . . . . . .TV digital effects

(8 bit device code)

keycodes:code key Function000 . . . . . . . . . . . . . . .1 button001 . . . . . . . . . . . . . . .2 button002 . . . . . . . . . . . . . . .3 button003 . . . . . . . . . . . . . . .4 button004 . . . . . . . . . . . . . . .5 button005 . . . . . . . . . . . . . . .6 button006 . . . . . . . . . . . . . . .7 button007 . . . . . . . . . . . . . . .8 button

008 . . . . . . . . . . . . . . .9 button009 . . . . . . . . . . . . . . .10 button/0 button011 . . . . . . . . . . . . . . .Enter016 . . . . . . . . . . . . . . .Channel up017 . . . . . . . . . . . . . . .Channel down018 . . . . . . . . . . . . . . .Volume up019 . . . . . . . . . . . . . . .Volume down020 . . . . . . . . . . . . . . .Mute021 . . . . . . . . . . . . . . .Power022 . . . . . . . . . . . . . . .Reset TV023 . . . . . . . . . . . . . . .Audio mode:

mono/SAP/stereo024 . . . . . . . . . . . . . . .Picture up025 . . . . . . . . . . . . . . .Picture down026 . . . . . . . . . . . . . . .Colour up027 . . . . . . . . . . . . . . .Colour down030 . . . . . . . . . . . . . . .Brightness up031 . . . . . . . . . . . . . . .Brightness down032 . . . . . . . . . . . . . . .Hue up033 . . . . . . . . . . . . . . .Hue down034 . . . . . . . . . . . . . . .Sharpness up035 . . . . . . . . . . . . . . .Sharpness down036 . . . . . . . . . . . . . . .Select TV tuner038 . . . . . . . . . . . . . . .Balance left039 . . . . . . . . . . . . . . .Balance right041 . . . . . . . . . . . . . . .Surround on/off042 . . . . . . . . . . . . . . .Aux/Ant047 . . . . . . . . . . . . . . .Power off048 . . . . . . . . . . . . . . .Time display054 . . . . . . . . . . . . . . .Sleep timer058 . . . . . . . . . . . . . . .Channel display059 . . . . . . . . . . . . . . .Channel jump

064 . . . . . . . . . . . . . . .Select input video1065 . . . . . . . . . . . . . . .Select input video2066 . . . . . . . . . . . . . . .Select input video3074 . . . . . . . . . . . . . . .Noise reduction on/off078 . . . . . . . . . . . . . . .Cable/broadcast079 . . . . . . . . . . . . . . .Notch filter on/off088 . . . . . . . . . . . . . . .PIP channel up089 . . . . . . . . . . . . . . .PIP channel down091 . . . . . . . . . . . . . . .PIP on092 . . . . . . . . . . . . . . .Freeze screen094 . . . . . . . . . . . . . . .PIP position095 . . . . . . . . . . . . . . .PIP swap096 . . . . . . . . . . . . . . .Guide097 . . . . . . . . . . . . . . .Video setup098 . . . . . . . . . . . . . . .Audio setup099 . . . . . . . . . . . . . . .Exit setup107 . . . . . . . . . . . . . . .Auto program112 . . . . . . . . . . . . . . .Treble up113 . . . . . . . . . . . . . . .Treble down114 . . . . . . . . . . . . . . .Bass up115 . . . . . . . . . . . . . . .Bass down116 . . . . . . . . . . . . . . .+ key117 . . . . . . . . . . . . . . .– key120 . . . . . . . . . . . . . . .Add channel121 . . . . . . . . . . . . . . .Delete channel125 . . . . . . . . . . . . . . .Trinitone on/off127 . . . . . . . . . . . . . . .Displays a red RtestS

on the screen

Page 10: HandsOnTechnology support Open Source Hardware(OSHW ...the Elektor Electronicswebsite or alternatively can be ordered (at nom-inal cost) on diskette 010029-11. If you are planing to

GENERALINTEREST

54 Elektor Electronics 3/2001

Next month:

– NEC– DENON– MOTOROLA– JAPAN– SAMSUNG– DAEWOO

RECS80 Code

The RECS80 code from Philips a pulse position modulationtechnique. With this system a fixed length pulse of light is fol-lowed by a variable length space. The space timing conveysthe data. There are 1280 possible codes divided into 64 com-mands and 20 subsystems. A subsystem is simply the type ofequipment being controlled i.e. a TV or a VCR. A message iscomposed of 11 bits. The first two bits are the toggle bits fol-lowed by three sub-system address bits and six data bits,these indicate which key was pressed. The toggle bits areincremented if a key is released for a minimum time but willremain unchanged within a multiple key-stroke sequence. Ifthe transmitter is configured to operate in modulated modethe first toggle bit is replaced by a REF bit of fixed duration.

In the lower trace of Figure 15 not all the data is shownbecause of the low sampling rate of the scope some of the bitshave been missed. The RECS80 protocol encodes the data byvariable length spaces between constant width ON pulses(140.8 µs). If the transmitter is configured to modulation mode

this time period will be represented by a burst of carrier fre-quency. If configured to flash mode the IR transmitter will beflashed on at this time. A ‘0’ has a space of 5.06 ms while a‘1’ has a space of 7.60 ms (derived from a 455 kHz resonator inthe remote control transmitter). Although the length of thedata packet is dependent on the commands sent, the timebetween two messages is fixed at 121 ms. The modulation fre-quency is 38 kHz.

Typical ICs for remote control:

Transmitter:SAA3004, SAA3007 and SAA3008 (Philips)M3004, M3005, M3006 (ST Microelectronics)

Receiver:SAA3009, SAA3049 (Philips)

Figure 5. RECS80 code at the output of the TFMS5360 receiverIC.

command stop bitstart bit address (bit 0 … bit 7)

60ms

8ms 4ms 4ms

"0" "1"

0.55ms

1ms 2ms

010023 - 26

Figure 6. RECS80 code message format

Internet LinksNec Format:

http://www.princeton.com.tw/spechtml/remote/2221.htm

Philips semiconductor:http://www.semiconductors.comwww-us.semiconductors.com/pip/SAA3049AP

Motorola Home-Page:http://motorola.com

Motorola-Format:http://holtek.com

Samsung Home-Page:

http://www.intl.samsungsemi.com/System_LSI/Microcontroller/Product_Guide/Microcontroller/product_guide.html

Page 11: HandsOnTechnology support Open Source Hardware(OSHW ...the Elektor Electronicswebsite or alternatively can be ordered (at nom-inal cost) on diskette 010029-11. If you are planing to

command (bit 5 … bit 0)address (bit 2 … bit 0)

121ms

start bit stop bittoggle

"0" "1"

140.8us

5.06ms 7.6ms010023 - 20

Correction to Part 1 (March 2001)In last month’s instalment, the illustrations with the RECS80 format description show the Daewoo format.The correct drawings are shown below.

GENERALINTEREST

54 Elektor Electronics 4/2001

IR Remote ControlCodes (2)Part 2

In this second andconcluding instalment welook at the structure of theinfra-red remote controlcode systems proposed by Denon, NEC, Motorola, Samsung and Daewoo,as well as a format which is generally referred to as ‘Japanese Code’.

By A.N. Other

Figure 5. RECS80 code at the output of the TFMS5360 receiver IC. Figure 6. RECS80 code message format

Page 12: HandsOnTechnology support Open Source Hardware(OSHW ...the Elektor Electronicswebsite or alternatively can be ordered (at nom-inal cost) on diskette 010029-11. If you are planing to

GENERALINTEREST

554/2001 Elektor Electronics

Denon Code

A Denon coded message consists of 15 information bits. Thefirst five bits are the equipment address field while the remain-ing ten bits contain the command.The modulation frequency is 32 kHz and the bit coding is:

1: 275 µs mark, 1900 µs space0: 275 µs mark, 775 µs space

To reduce the effects of interference the message is sent twice,

the second time 65 ms after the first. During the second timethe command field bits are inverted. The receiver will onlyaccept commands when the second message is identical tothe first after the command field bits are inverted. The addressfield is always sent uninverted. Bit 16 is a stop bit.

There are currently no dedicated chips to implement thiscode. Transmitters and receivers can be built from mask pro-grammable micro controllers e.g. the Mitsubishi M50560.

Figure 7. Denon code at the output of the TFMS5360 receiverIC (CD Player)

command (bit 9 … bit 0) stop bitaddress (bit 4 … bit 0)

65ms

"0" "1"

275us

1.05ms 2.175ms010023 - 16

Figure 8. Denon code message format

NEC CodeThe NEC code operates with a carrier frequency of 38 kHz anduses pulse position modulation (PPM). Transmission beginswith a 9 ms long start bit, followed by a 4.5 ms space. Themessage information is contained in the following 32 bitswhich consists of a 16 bit manufacturer field and a 16 bit com-mand field. The 8 bit wide data is sent twice, the second timeinverted. A complete message is 67.5 ms long. Each bit is sentusing the following format:1: 0.56 ms Pulse, 1.69 ms space

0: 0.56 ms Pulse, 0.565 ms spaceA new message is sent 108 ms after the start of the preced-ing message. A special current saving feature is implementedif a key is held down on the controller. In this case the mes-sage consists of a 9 ms start bit followed by a 2.25 ms spaceand a 0.56 ms pulse.

Sanyo supply ICs that generate codes using this format buthave a 13 bit manufacturers code.

Figure 9. NEC code at the output of the TFMS5360 receiver IC

67.5ms

108ms

9ms

27ms

Bit 0 Bit 7

manufacturer code manufacturer code data code data code

27ms

4.5ms

108ms

"0" "1"

0.56ms

1.125ms 2.25ms010023 - 18

Figure 10. NEC code message format

Page 13: HandsOnTechnology support Open Source Hardware(OSHW ...the Elektor Electronicswebsite or alternatively can be ordered (at nom-inal cost) on diskette 010029-11. If you are planing to

GENERALINTEREST

56 Elektor Electronics 4/2001

Motorola Code

The Motorola code consists of a 9 bit data word. Biphase mod-ulation is used similar to the RC5 standard but with Motorolaa ‘0‘ is represented by a 512 µs pause followed by a 512 µslong high and a ‘1‘ is represented by a 512 µs high followed bya 512 µs long pause. This is opposite to the data representa-tion found in the RC5 code. A 32 KHz carrier frequency is used.

A typical telegram has a message start header consistingof nine consecutive ‘1‘s followed by the key code of thepressed key (repeated for as long as the key is pressed) andended by sending nine consecutive ‘1‘s. A brief key press at

the controller will cause three messages to be transmitted.Each message consists of a pre-bit, a pre-bit-pause, a start-

bit and nine data bits. The pre-bit and the start-bit are alwaysa logical 1. The pre-bit is used by the receiver to set the AGCgain level of the IR receiver.

The IC MC144105 chip is typically used to implement aremote control system using the Motorola code.

Figure 11. Motorola code at the output of the TFMS5360receiver IC.

111 1 1 1

command (bit 0 … bit 6)

13.8ms3.072ms

512us

1024us

"0""1"

1.024ms 2x 512us

34ms 135.6ms

pre(amble) bit start bit

00 0 0

010023 - 22

Figure 12. Motorola code message format.

Japanese CodeSimilar to the way in which the RC5 code has been standard-ised in Europe, the Japanese Association for Electric HomeAppliances has produced a standard for IR control. This sys-tem is called (uninspiringly) the ‘recommended standard forinfrared remote controls‘.

The code is used by a number of manufacturers and has amessage length of 48 Bits split into the following fields:

Manufacturers Code (16 bit)These 16 Bits comprise the unique code for each manufacturerand are registered by the standards organisation. This code isprogrammed into the IC mask.

Parity Code (4 bit)These four bits detect data corruption in the message.

47.7...64.6ms 42.2ms

3.38ms

"0" "1"

0.42ms

0.84ms 1.69ms

Hersteller-Code Parity System-Code

Produkt-Code

Funktions-Code

Daten Check-Code

1.69ms

010023 - 23

Figure 13. Japanese code message format.

Typical transmitter ICs remote controls:PTPT2221, PT2222 (Princeton)

uPD6120, uPD6121 (NEC)LC7461M, LC7462M (Sanyo)

Page 14: HandsOnTechnology support Open Source Hardware(OSHW ...the Elektor Electronicswebsite or alternatively can be ordered (at nom-inal cost) on diskette 010029-11. If you are planing to

GENERALINTEREST

574/2001 Elektor Electronics

System Code (4 bit)The four system code bits are pre-programmed into the IC dur-ing manufacture.

Product Code (8 bit)The 8 Bit Product code is made up of two mask programmedbits and 6 user wired bits. The six hardwired bits determinethe equipment address.

Functions Code (8 bit)The 8 bit function code is the value of the key pressed.

Data check code (8 bit)These eight bits are used to detect data corruption. The sys-tem, product and function codes are passed through an algo-rithm to generate this check code.

A digital zero is represented by a ‘1‘ of 0.42 ms followed by a ‘0‘of 1.27 ms. A digital one is represented by a ‘1‘ of 0.42 ms fol-lowed by a ‘0‘ of 0.42 ms.

Sanyo produce the LC7465M this device interfaces to a key-pad and sends IR messages using this format.

SAMSUNG CodeThe Samsung code consists of a start bit followed by a 12 Bitmanufacturers code and an 8 bit command code. The messageis always sent a minimum of twice.

A digital zero is represented by a ‘1‘ of 0.56 ms followed bya ‘0‘ of 0.56 ms. A digital one is represented by a ‘1‘ of 0.56 msfollowed by a ‘0‘ of 1.69 ms. A continuous key press will causethe message to be repeated every 60 mS. The carrier fre-quency used for this code is 38 kHz.

There are no dedicated transmitter IC’s for the Samsungsystem. A microcontroller is generally used to generate thecode e.g. the data sheet of the KS51840 from Samsung givesan application for remote control use.

command (bit 0 … bit 7) stop bitstart bit manufacturer code (bit 0 … bit 11)

60ms

4.5ms 4.5ms

"0" "1"

0.56ms

1.125ms 2.25ms

010023 - 24

Figure 14. Samsung code message format.

Daewoo Code

A digital zero is represented by a ‘1‘ of 0.55 ms followed by a ‘0‘of 0.45 ms. A digital one is represented by a ‘1‘ of 0.55 ms fol-lowed by a ‘0‘ of 1.45 ms. This uses a carrier frequency of

38 kHz. A 4 ms space separates the address field from thecommand field.

(010023-2)

Figure 15. Daewoo code at the output of the TFMS5360receiver IC

command stop bitstart bit address (bit 0 … bit 7)

60ms

8ms 4ms 4ms

"0" "1"

0.55ms

1ms 2ms

010023 - 26

Figure 16. Daewoo code message format.