Use an Arduino as a remote control

The goal is to build a custom remote which can control my devices. The hardware is a 3V3 Arduino Pro Mini and a Lithiumbatteri. This is charged with a small charger.
The software is based on Ken Shirriff:s IR library.

Code for the Creative DDTS-100
The first thing I do is to adjut the library for my DDTSS-100.

Step 1 - Install Irremote library from http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html.

Step 2 Research. According to Google the DDTS uses NEC-type code. Lirc-project has info about the codes (http://lirc.sourceforge.net/remotes/creative/DDTS-100).

Step 3 Adjust the file IrremoteInt.h in Irremote according to the values found in the Lirc-file. Add this section:

#define CREATIVE_HDR_MARK 8973
#define CREATIVE_HDR_SPACE 4760
#define CREATIVE_BIT_MARK 591
#define CREATIVE_ONE_SPACE 1675
#define CREATIVE_ZERO_SPACE 567
#define CREATIVE_RPT_SPACE 2308

In IRremote.cpp we add this:

void IRsend::sendCreative(unsigned long data, int nbits)
{
enableIROut(38);
mark(CREATIVE_HDR_MARK);
space(CREATIVE_HDR_SPACE);
for (int i = 0; i < nbits; i++) {
if (data & TOPBIT) {
mark(CREATIVE_BIT_MARK);
space(CREATIVE_ONE_SPACE);
}
else {
mark(CREATIVE_BIT_MARK);
space(CREATIVE_ZERO_SPACE);
}
data <<= 1;
}
mark(CREATIVE_BIT_MARK);
space(0);
}

In IRemote.h:
void sendCreative(unsigned long data, int nbits);

Step 4 Find the pre_data bytes in the Lirc-file. In this case it's 0x8322 (Lirc: pre_data 0x8322).

Step 5 Construct a send-command in the Arduino software. The first argument is the pre_data bytes with the command byte added. For example, in the Lirc-file we find this line:
power 0xE11E

The first argument for sending a power on/off code is therefore 0x8322E11E. The NEC-codes shall be 32 bytes, which is given as the second argument. The complete command:

irsend.sendCreative(0x8322E11E, 32);

Step 6 Say thanks to Ken Shirriff for the library and the info!

DVB-box
My DVB-box was harder to get to. The name is Dilog DT-355, which seems to be a Handan clone. There's more clones of this box, but didn't find a Lirc-file for those either. guess I have to investigate the recording feature of Irremote. But then the box got replaced...

Experimenting with a Sagem DVB
Used an IR-receiver attached to the Arduino (output to pin 11) and run Irecvdump (from the IRremote package). Got the following results by pressing the buttons on the remote, one by one:

Protocol: NEC
Arrow up: E17AD629
Arrow down: E17A36C9
Arrow left: E17ADA25
Arrow right: E17A3AC5
'x': E17A50AF
EPG: E17AA45B
1: E17A28D7
2: E17A40BF
3: E17AC03F
4: E17A20DF
5: E17AA05F
6: E17A609F
7: E17AE01F
8: E17A10EF
9: E17A906F
0: E17A00FF
Tone: E17A847B
Menu: E17A8877
Revert channel: E17A28D7
OK: E17AA857
V+: E17A3CC3
V-: E17ADC23
P+: E17AD42B
P-: E17A34CB
info: E17A7887
Text: E17AB847
Pan/Scan: E17A9C63
Soundtrack/text: E17AF807
Red: E17A6897
Green: E17AE817
Yellow: E17A18E7
Arrows: E17A04FB
Mute: E17AF00F
Source: E17A24DB
Power: E17A48B7

Irecvdump told me that it is NEC-codes, and the code for every single button. It's then easy to send codes from the Arduino to the box:

irsend.sendNEC(0xE17ADC23, 32);

---------------------------------------------

Panasonic TV
Next up is the good old Panasonic 36" CRT TV. Here I used code from this site, but I think it's added in news versions of the original library. This makes it easy, just use the Panasonic-routine. For codes I looked at the original remote:s back for the model number. I then used codes from Lirc (here, not an exact match on the model but it worked.

To raise the volume:
irsend.sendPanasonic(0x40040100, 0x04050000, 48);

Ref for adding new code: http://arduinostuff.jimdo.com/home/remote/irremote-updates/