Close

IR Commands

A project log for OpenIR - Infrared Remote Control

Open source universal infrared remote control based upon the STM8S microcontroller with oooodles of connectivity options.

nevynNevyn 08/23/2014 at 18:200 Comments

Revision A of the board is now working and can send a single IR sequence out to a device in the real world when the on board switch is pressed.  If OpenIR is to be truly universal the system needs to be able to send a multitude of commands not just a single command.  In order to do this we need to be able to store IR command sequences and also allow the user to select which IR sequence is transmitted.

The STM8S has been set up to connect the TTL serial port to the FTDI and RedBear BLE board ports.  Doing this allows communication with the outside world (PC, iPhone etc.).  The proposed solution uses the serial TTL port to send commands to the STM8S and for the STM8S to store details of the IR signals (carrier frequency, active period etc.) in the on chip EEPROM.

Serial Commands

The STM8S will listen on the serial TTL port for commands from the outside world.  The following list of commands are proposed as a starting point:

Command IDDescription
1Get Remote control ID.  This returns a text string which identified the remote control.
2Set the remote control ID.
3Get the carrier frequency.  This gets the two bytes which are used by Timer 1 to determine the frequency of the PWM signal.
4Set the carrier frequency. This set the two bytes which are used by Timer 1 to determine the frequency of the PWM signal.
5Get the contents of the EEPROM pulse data store.
6Set the contents of the EEPROM pulse data store on the STM8S.
7Transmit pulses for sequence number x where x is the item in the payload.
8Transmit pulses. This transmits and arbitrary sequences of pulses which are contained in the remainder of the payload.
9Time Lapse mode.  Send the pulses for sequence x after y seconds.
10Reset the remote control.
11Enable or disable the on board power LED.

Layout of the EEPROM

The STM8S on the EEPROM stores the configuration of the remote control.  The data stored is a mixture of basic configuration along details of the pulses for each command the remote control can transmit.

OffsetLengthDescription
0x0016Text ID of the remote control
0x102Two bytes which are used by Timer 1 to determine the frequency of the carrier signal.  The carrier signal is assumed to be 50% duty cycle.
0x121Number of command sequences stored in the EEPROM.
0x131Number of seconds to use for the time lapse sequence.
0x1412Unused.
0x2064Length of the pulse sequences (0x20 = length of sequence 0, 0x21 = length of sequence 1 etc.).
0x60512Pulse data.  It is assumed that the pulse sequences will start with an on period followed by and off period until the number of sequences have been consumed.

Conclusion

The basic layout of the EEPROM has been determined along with a proposed command sequence.  The next step is to implement the STM8S code and some sample Windows code to configure the remote control.

Discussions