Page 440 - Hacking Roomba
P. 440

Appendix C — iRobot Roomba Open Interface (ROI) Specification                    421





                                                    iRobot® Roomba® Open Interface (ROI) Specification

                           Leds data byte 2: Power Color (0 – 255)  Note Number Table for Song Command (with Frequency in Hz)
                           0 = green, 255 = red. Intermediate values are intermediate   Number  Note  Frequency   Number  Note  Frequency
                           colors.
                                                                     31   G   49.0    80   G#   830.6
                           Leds data byte 3: Power Intensity (0 – 255)  32  G#  51.0  81   A    880.0
                           0 = off, 255 = full intensity. Intermediate values are intermediate   33  A  55.0  82  A#  932.3
                           intensities.                              34   A#  58.3    83   B    987.8
                                                                     35   B   61.7    84   C    1046.5
                            Example:                                 36   C   65.4    85   C#   1108.7
                                                                     37   C#  69.3    86   D    1174.7
                            To turn on the dirt detect and spot LEDs, make the status   38  D  73.4  87  D#  1244.5
                            LED red, and to light the power LED green at half intensity,   39  D#  77.8  88  E  1318.5
                            send the serial byte sequence [139] [25] [0] [128]
                                                                     40   E   82.4    89   F    1396.9
                                                                     41   F   87.3    90   F#   1480.0
                                                                     42   F#  92.5    91   G    1568.0
                                                                     43   G   98.0    92   G#   1661.2
                           Song  Command opcode: 140    Number of data bytes:         93   A    1760.0
                                               2N + 2, where N is the   44  G#  103.8
                                               number of notes in the song  45  A  110.0  94  A#  1864.7
                                                                     46   A#  116.5   95   B    1975.5
                           Specifies a song to the ROI to be played later. Each song is
                                                                     47   B   123.5   96   C    2093.0
                           associated with a song number which the Play command uses
                                                                     48   C   130.8   97   C#   2217.5
                           to select the song to play. Users can specify up to 16 songs
                                                                     49   C#  138.6   98   D    2349.3
                           with up to 16 notes per song. Each note is specified by a note
                                                                     50   D   146.8   99   D#   2489.0
                           number using MIDI note definitions and a duration specified
                           in fractions of a second. The number of data bytes varies   51  D#  155.6  100  E  2637.0
                           depending on the length of the song specified. A one note song   52  E  164.8  101  F  2793.8
                           is specified by four data bytes. For each additional note, two data   53  F  174.6  102  F#  2960.0
                           bytes must be added. The ROI must be in passive, safe, or full   54  F#  185.0  103  G  3136.0
                           mode to accept this command. This command does not change   55  G  196.0  104  G#  3322.4
                           the mode.                                 56   G#  207.7   105  A    3520.0
                           Serial sequence: [140] [Song Number] [Song Length] [Note   57  A  220.0  106  A#  3729.3
                           Number 1] [Note Duration 1] [Note Number 2] [Note Duration 2]   58  A#  233.1  107  B  3951.1
                           etc.                                      59   B   246.9   108  C    4186.0
                                                                     60   C   261.6   109  C#   4434.9
                           Song data byte 1: Song Number (0 – 15)
                           Specifies the number of the song being specified. If you send   61  C#  277.2  110  D  4698.6
                           a second Song command with the same song number, the old   62  D  293.7  111  D#  4978.0
                           song will be overwritten.                 63   D#  311.1   112  E    5274.0
                                                                     64   E   329.6   113  F    5587.7
                           Song data byte 2: Song Length (1 – 16)                     114  F#   5919.9
                           Specifies the length of the song in terms of the number of notes.  65  F  349.2
                                                                     66   F#  370.0   115  G    6271.9
                           Song data bytes 3, 5, 7, etc.: Note Number (31 – 127)  67  G  392.0  116  G#  6644.9
                           Specifies the pitch of the note to be played in terms of the MIDI   68  G#  415.3  117  A  7040.0
                           note numbering scheme. The lowest note that Roomba can     118  A#   7458.6
                           play is note number 31. See the note number table for specific   69  A  440.0  119  B  7902.1
                           notes. Any note number outside of the range of 31 to 127 will   70  A#  466.2
                           be interpreted as a rest note and no sound will be played during   71  B  493.9  120  C  8372.0
                           this note duration.                       72   C   523.3   121  C#   8869.8
                                                                     73   C#  554.4   122  D    9397.3
                           Song data bytes 4, 6, 8, etc.: Note Duration (0 – 255)     123  D#   9956.1
                           Specifies the duration of the note in increments of 1/64 of a   74  D  587.3
                           second. Therefore, half-second long note will have a duration   75  D#  622.3  124  E  10548.1
                           value of 32.                              76   E   659.3   125  F    11175.3
                                                                     77   F   698.5   126  F#   11839.8
                                                                     78   F#  740.0   127  G    12543.9
                                                                     79   G   784.0
                                                                 5                             www.irobot.com
   435   436   437   438   439   440   441   442   443   444   445