about:benjie

Random learnings and other thoughts from an unashamed geek

LightwaveRF RF Protocol

| Comments

Following on from yesterday’s success, I’ve done a big data capture of various commands and have figured out (mostly) the protocol.

As you saw yesterday, each command comprises 10 bytes. But actually, each of these only ever take one of 16 values, thus they really represent nibbles. The values of these nibbles are:

Lightwave RF nibble values
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 0 : 1111 0110
 1 : 1110 1110
 2 : 1110 1101
 3 : 1110 1011
 4 : 1101 1110
 5 : 1101 1101
 6 : 1101 1011
 7 : 1011 1110
 8 : 1011 1101
 9 : 1011 1011
10 : 1011 0111
11 : 0111 1110
12 : 0111 1101
13 : 0111 1011
14 : 0111 0111
15 : 0110 1111

Then the payload is made out of 10 of these nibbles.

Level (2 nibbles)

The level is defined by nibbles 1 and 2, giving a range of 0-255 (NOTE: this full range is not used, as far as I can tell). For simple commands (on/off), the level is 0.

You can dim a light to one of the 31 different levels, but these levels start at 129. I find that the easiest way to think of this is 0x80 + dim level (from 1 to 31), where 0x80 is the hex representation of the number 128. Note that to dim a light you simply use the ON command - there isn’t a specific “dim” command.

As with dimming, for a MOOD command (see later), you add 0x80 to your mood value - there are at least 5 moods supported: 0-4.

Subunit (1 nibble)

Each LightwaveRF remote can target 16 different “subunits” - e.g. the remote shown has in effect 34 buttons - on and off the the 16 subunits (A-D * 1-4) plus the two “global” buttons below.

Commands which communicate with all devices send the highest subunit number, 15, where as simple commands can be sent to individual subunits. On the remote above the subunits are 0=A1, 1=A2, 2=A3, … 14=D3, 15=D4.

Command (1 nibble)

LightwaveRF supports (by the looks of it) up to 16 commands. The ones I’m aware of are:

LightwaveRF Commands
1
2
3
4
5
6
 0 : OFF   (specify subunit, level=0)
 1 : ON    (specify subunit,
            send level = 0 to switch on to previous state, or
            level = 0x80 + level[1..31] to turn on to a specific
            level)
 2 : MOOD  (subunit = 15, level = 0x80 + mood[0..4])

Note on my mood remote (when the switch on the back is in “mood” mode) the buttons (excluding the off button) from top left to bottom right have moods: 2, 3, 4, 0, 1 - the ordering of which seems a bit bizarre.

Remote Identifier (6 nibbles)

The remainder of the payload I assume to be the identity of the remote control, e.g.

LightwaveRF Commands
1
0xF21527 encodes to: 0110 1111 1110 1101 1110 1110 1101 1101 1110 1101 1011 1110

Calculator

I’ve knocked up a quick and dirty calculator to help with encoding/decoding.

How can I use this?

Watch this space, I’ll be posting how to make your own LightwaveRF transceiver using an Arduino soon. As always, the code is on GitHub.

Comments