This writeup is still WIP
I bought a standing desk from Autonomous (Smart Desk 2 Home Office). After setting it up, I was wondering how the controller and the table/motor controller communicate with each other.
- More detailed writeup
- Finish implementing protocol on ESP32 (possibly with wifi control in the future?)
Opening up the controller reveals nicely labeled PINs.
Thus we now only know that UART is used to transfer data, but also which wire carries which signal:
color | function |
---|---|
red | sleep(?) |
orange | GND |
green | TX |
yellow | RX |
blue | 5V |
After some trying out, I found the baudrate: 9600
Height-Profiles are not saved on this controller - they are stored in the desk.
The controller board uses a STC12C5612AD controller. It features:
- 3,5-5,5V
- 8 Bit
- 23 I/O pins
- 1x UART
- 768 Bytes RAM
- 4K-30 KB program memory size (according to datasheet)
I used a DSView Logic Analyzer which I bought here from Banggood.
I did not dismantle the controller that shipped with my desk. Instead, I asked the customer support for a spare one / replacement. They shipped it to me for 27€.
I opened up the casing (standard screws) and found a nicely labeled PCB where I could attach the probes to.
You can find my captured data from the logic analyzer in the folder "logic_analyzer".
When no button is pressed, we keep receiving (repeating):
Base Message:
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 |
---|---|---|---|---|---|
0x98 | 0x98 | 0x00 | 0x00 | (height) | (height) |
0x98 | 0x98 | 0x03 | 0x03 | (height) | (height) |
Height can be a value between 0x4B and 0x7B
I am not really sure about the meaning of 0x03 as byte 2+3. I have mostly seen 0x00, but sometimes also 0x03.
Height indication:
Height: 29.05
Last 2 Bytes of Message: 0x4B, 0x4B
Height: 29.09
Last 2 Bytes of Message: 0x4C, 0x4C
Height: 30.03
Last 2 Bytes of Message: 0x4D, 0x4D
Height keeps increasing in steps of 0.4 Message keeps increasing by 1 ...
Height: 48.00
Last 2 Bytes of Message: 0x7A, 0x7A
Height: 48.40
Last 2 Bytes of Message: 0x7B, 0x7B
Base message:
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 |
---|---|---|---|---|
0xD8 | 0xD8 | 0x66 | (button) | (button) |
Button values:
⬇️ 0x01 (0b0000_0001)
⬆️ 0x02 (0b0000_0010)
1️⃣ 0x04 (0b0000_0100)
2️⃣ 0x08 (0b0000_1000)
3️⃣ 0x10 (0b0001_0000)
4️⃣ 0x20 (0b0010_0000)
0xD8, 0xD8, 0x66, 0x00, 0x00
0xD8, 0xD8, 0x66, 0x02, 0x02
(keep going with end 0x02 as long as the button is pressed)
0xD8, 0xD8, 0x66, 0x00, 0x00
0xD8, 0xD8, 0x66, 0x02, 0x01
(keep going with end 0x01 as long as the button is pressed)
0xD8, 0xD8, 0x66, 0x00, 0x00
0xD8, 0xD8, 0x66, 0x04, 0x04
(keep going with end 0x04 as long as the button is pressed)
0xD8, 0xD8, 0x66, 0x00, 0x00
0xD8, 0xD8, 0x66, 0x08, 0x08
(keep going with end 0x08 as long as the button is pressed)
0xD8, 0xD8, 0x66, 0x00, 0x00
0xD8, 0xD8, 0x66, 0x10, 0x10
(keep going with end 0x10 as long as the button is pressed)
0xD8, 0xD8, 0x66, 0x00, 0x00
0xD8, 0xD8, 0x66, 0x00, 0x20
(keep going with end 0x20 as long as the button is pressed)
0xD8, 0xD8, 0x66, 0x00, 0x00
0xD8, 0xD8, 0x66, 0x40, 0x40
(keep going with end 0x40 as long as the button is pressed)
-
Controller->Desk: Every message contains 5 bytes
-
Controller->Desk: Message always starts with 0xD8, 0xD8, 0x66
-
Controller->Desk: Last 2 Bytes always repeat
-
Desk->Controller: Every message contains 6 bytes
-
Desk->Controller always starts with 0x98, 0x98, 0x00, 0x00
-
Every button corresponds to 1 bit in the message
- 7 buttons, 8 bit -> highest bit unused (?)
-
The controller sends the current state of the buttons after receiving a message from the desk
-
The controller seems to only move as long as it is receiving data (0x00 as button-data seems to be enough)
-
Messages are sent every ~50ms