iMicknl/LoctekMotion_IoT

Learn how to connect your Flexispot (LoctekMotion) desk to the internet. This repository contains a collection of scripts to get your started, combined with research and instructions.

C++

1,024

242 commits

updated Oct 13, 2026

See the code

README

Flexispot Desk with automation logos (image source: Windows Central)

[!WARNING] Be careful. Tinkering with electronics can be risky. Use this guide at your own risk.

Turn your LoctekMotion/FlexiSpot desk into a smart desk

When I assembled my FlexiSpot standing desk, I noticed the control panel had an RJ45 cable and a second RJ45 port. This sparked my interest: can I connect my desk to the internet?

Most Flexispot models utilize components from LoctekMotion, a manufacturer specializing in lifting columns for height-adjustable desks. Although LoctekMotion previously advertised a Bluetooth receiver for their control boxes, I haven't been able to obtain one.

This repository will guide you on connecting your desk to Home Assistant and other systems using the serial communication ports (RJ45). Imagine controlling your desk with your voice or receiving notifications when you've been sitting too long. Or, just do it because it's cool 🤓.

Features

  • Control your desk (up, down, stop) using a cover entity
  • Manage 4 presets with button entities
  • Monitor desk height with a sensor entity
  • Adjust desk height in cm using a number entity (experimental)

Known issues

  • Number entity may overshoot. The desk moves until the height sensor matches the requested height, which may cause overshooting due to reporting delays. Use the desk controller presets for accurate positioning.

Packages

NameDescription
ESPHomeControl your desk via an ESP32 module connected to Home Assistant. Can be adapted to ESP8266 or other ESP32 variant.
ESPHome Pass-throughControl desks which have only one RJ45 port using passthrough configuration via an ESP32 module connected to Home Assistant.

For v1 packages (Arduino, Raspberry Pi, older ESPHome packages, and different pin-outs), visit the archive directory. For alternative solutions, see similar projects.

Getting started

Please follow the ESPHome documentation for the basics of ESPHome. You can use the provided office-desk-esp32.yaml as a boilerplate for your own implementation. This implementation has been created for the ESP32 nodemcu, but can easily be adopted for other platforms and boards.

Pin-out

RJ45 pin (T-568B)NameESP32
8 🟫+5V (VDD)VIN
7 ⬜🟫GNDGND
6 🟩TXTX2 (GPIO17)
5 ⬜🟦RXRX2 (GPIO16)
4 🟦PIN 20D23 (GPIO23)
3 ⬜🟩(unknown)
2 🟧SWIM
1 ⬜🟧RES

You can use other GPIO pins (e.g. on an ESP32-C3) by changing the tx_pin, rx_pin and screen_pin substitutions in the package.

This pin-out should be compatible with all control panels featuring an RJ45 port for serial communication. If it doesn't work for your setup, consider trying an alternative pin-out from the archive.

Use the provided pin-out to connect your ESP32 to the desk controller's RJ45 port using an ethernet cable. If you're not experienced with electronics and soldering, consider using an RJ45 Adapter Board from sites like Aliexpress, connected with Dupont cables to your ESP32.

example setup

Pass-Through Configuations

If your desk controller lacks an extra RJ45 port, you'll need a pass-through solution. This requires connecting the RJ45 of the keypad to the pins below.

KeyPad RJ45 pinNameConnection
8+5V (VDD)VIN (Split)
7GNDGND (Split)
6TXRX0 (GPIO3)
5RXRX2 (Split)
4PIN 20(Not Required)
3(unknown)(Not Required)
2SWIM(Pass-Through)
1RES(Pass-Through)

The pins marked 'split' are to be connected to the ESP32 pin, the desk controller and to the keypad. The pins marked pass-through are to be connected directly between the controller and the keypad.

Note: the current implementation does not utilize PIN20 however, this could be utilized to sense if the screen is on if desired.

Pass-Through Pinout

Optional: Custom Enclosure for a Clean Setup

To keep your setup clean and well-protected, a custom enclosure for the ESP32 DevKit with Ethernet breakout is available. It ensures secure housing, optimal cable management, and a stable wired connection.

Features ✅:

  • Secure housing – Protects the ESP32 and Ethernet breakout
  • Optimized cable management – Keeps wiring neat and organized
  • Ventilation slots – Prevents overheating
  • Easy mounting – Designed for a hassle-free installation
  • Compact design – Fits seamlessly into any setup

image

🔗 Download the enclosure model at makerworld.com.

Optional: Enclosure for a Pass-Through Setup

A pass-through configuration needs two RJ45 jacks, which the enclosure above does not have. This case fits an ESP32 DevKit between two RJ45 breakout boards — desk controller on one side, keypad on the other.

EnclosureAssembled
Pass-through enclosure, printedESP32 and both RJ45 breakouts mounted in the case

🔗 Models (STL + Fusion 360 source): models/passthrough-case

Troubleshooting

My height sensor is not providing the correct value

  • Uncomment the debug line for UART in the ESPHome configuration to see the raw data coming from the desk controller. This will help you collect information to troubleshoot the issue. See debugging UART.
  • If your cover entity has up/down buttons grayed out due to height sensor issues, you can change the internal parameter for the up/down switch from true to falsein the YAML configuration.

Research

If you are interested in the internals of the LoctecMotion desk system, have a look at the research below which is composed of my own findings combined with findings of similar projects.

Full research

Control Panels

At the time of writing, LoctekMotion sells 11 different control panels. The features can differ per model, but it looks like the serial interface is pretty similar for the more advanced models.

The tables below will show a mapping of the RJ45 pinout to the pinout used by the control panel. Please note that all RJ45 pins are described in the following way:

RJ-45 connector layout

The most common color convention for wiring RJ45 for network cables is:

RJ45 T568B colors

In order to connect the control box to a Raspberry Pi and ESP32/ESP8266 chip I used a RJ45 to RS232 adapter with DuPont cables (jump wires), but you simply can cut and split an ethernet cable as well.

Supported Control Panels

[!NOTE] Eventually, we discovered that a single pin-out should work for all control panels. It seems multiple mappings can be used, but the most common one is the one used for the HS13B-1 control panel.

HS13B-1

  • Desk model: Flexispot E7
  • Tested with control box: CB38M2J(IB)-1
  • Source: Printed on the PCB of the control box.
RJ45 pinNameOriginal Cable ColorEthernet cable color (T568B)
1RESETBrownWhite-Orange
2SWIMWhiteOrange
3EMPTYPurpleWhite-Green
4PIN 20RedBlue
5RXGreenWhite-Blue
6TXBlackGreen
7GNDBlueWhite-Brown
8+5V (VDD)YellowBrown

Note that RX and TX is defined like this on receiver (control panel) side. So the custom controller also uses RX to receive data and TX to send data.

HS13A-1

  • Desk model: Flexispot EK5
  • Tested with control box: CB38M2B(IB)-1
  • Source: Printed on the PCB of the control box.
RJ45 pinNameOriginal Cable ColorEthernet cable color (T568B)
1RESET SWIMBrownWhite-Orange
2PIN 20WhiteOrange
3RXPurpleWhite-Green
4TXRedBlue
5GND1GreenWhite-Blue
6+5V (VDD)BlackGreen
729V+BlueWhite-Brown
829V-YellowBrown

Note that RX and TX is defined like this on receiver (control panel) side. So the custom controller also uses RX to receive data and TX to send data.

HS01B-1

RJ45 pinName
8+5V (VDD)
7GND
6TX
5RX
4PIN 20
3(unknown)
2SWIM
1RES

Note that RX and TX is defined like this on receiver (control panel) side. So the custom controller also uses RX to receive data and TX to send data.

Other control panels / control boxes could be supported in the same way, but you would need to figure the RJ45 pinout mapping. Most control boxes have an extra RJ45 port for serial communication, but otherwise you would need to place your device in between the control panel and the control box.

Retrieve current height

Based upon the great work of minifloat, it became clear that the control panel utilises a 7-segment display. Fortunately, this is very common in such devices and thus there is a lot of documentation on this topic.

The control box sends the height as 4-bit hexadecimal, which is decoded in the control panel to drive the 7-segment display. The second number on the display also supports an optional decimal point ("8 segment").

Make sure you set the baud rate to 9600. For most LoctekMotion desks, the control box only broadcasts the current height for x seconds after you sent the Wake Up command. Otherwise you will receive 0x00 0x00 0x00 as payload.

source: alselectro

Execute a command

The control box only accepts commands when the 'screen is active'. To activate the screen, PIN 20 needs to be set to HIGH for about 1 second. The screen gets disabled automatically again after some amount of time receiving no commands.

Command list

Command nameStartLengthTypePayloadChecksumEnd
Wake Up9b060200 006c a19d
Up9b060201 00fc a09d
Down9b060202 000c a09d
M9b060220 00ac b89d
Preset 19b060204 00ac a39d
Preset 29b060208 00ac a69d
Preset 3 (stand)9b060210 00ac ac9d
Preset 4 (sit)9b060200 01ac 609d

All bytes combined will become the command to send to the control box. See the packages for sample code.

Similar projects

While working on this project, I found that many others have done similar work. Several GitHub repositories with great research have been very helpful in starting this project. ❤️

Special thanks to the Tweakers.net community (Dutch) for helping kickstart this project.

Contributions

We welcome contributions from the community! If you have ideas, suggestions, or improvements, please feel free to open an issue or submit a pull request.

Support

Join our Discord channel for a chat with like-minded people or to get help with your project.

esp32
esp8266
flexispot
flexispot-desks
home-assistant
loctek
loctekmotion
smart-desk
standing-desk

iMicknl/LoctekMotion_IoT

Learn how to connect your Flexispot (LoctekMotion) desk to the internet. This repository contains a collection of scripts to get your started, combined with research and instructions.

C++

1,024

242 commits

updated Oct 13, 2026

See the code

README

Flexispot Desk with automation logos (image source: Windows Central)

[!WARNING] Be careful. Tinkering with electronics can be risky. Use this guide at your own risk.

Turn your LoctekMotion/FlexiSpot desk into a smart desk

When I assembled my FlexiSpot standing desk, I noticed the control panel had an RJ45 cable and a second RJ45 port. This sparked my interest: can I connect my desk to the internet?

Most Flexispot models utilize components from LoctekMotion, a manufacturer specializing in lifting columns for height-adjustable desks. Although LoctekMotion previously advertised a Bluetooth receiver for their control boxes, I haven't been able to obtain one.

This repository will guide you on connecting your desk to Home Assistant and other systems using the serial communication ports (RJ45). Imagine controlling your desk with your voice or receiving notifications when you've been sitting too long. Or, just do it because it's cool 🤓.

Features

  • Control your desk (up, down, stop) using a cover entity
  • Manage 4 presets with button entities
  • Monitor desk height with a sensor entity
  • Adjust desk height in cm using a number entity (experimental)

Known issues

  • Number entity may overshoot. The desk moves until the height sensor matches the requested height, which may cause overshooting due to reporting delays. Use the desk controller presets for accurate positioning.

Packages

NameDescription
ESPHomeControl your desk via an ESP32 module connected to Home Assistant. Can be adapted to ESP8266 or other ESP32 variant.
ESPHome Pass-throughControl desks which have only one RJ45 port using passthrough configuration via an ESP32 module connected to Home Assistant.

For v1 packages (Arduino, Raspberry Pi, older ESPHome packages, and different pin-outs), visit the archive directory. For alternative solutions, see similar projects.

Getting started

Please follow the ESPHome documentation for the basics of ESPHome. You can use the provided office-desk-esp32.yaml as a boilerplate for your own implementation. This implementation has been created for the ESP32 nodemcu, but can easily be adopted for other platforms and boards.

Pin-out

RJ45 pin (T-568B)NameESP32
8 🟫+5V (VDD)VIN
7 ⬜🟫GNDGND
6 🟩TXTX2 (GPIO17)
5 ⬜🟦RXRX2 (GPIO16)
4 🟦PIN 20D23 (GPIO23)
3 ⬜🟩(unknown)
2 🟧SWIM
1 ⬜🟧RES

You can use other GPIO pins (e.g. on an ESP32-C3) by changing the tx_pin, rx_pin and screen_pin substitutions in the package.

This pin-out should be compatible with all control panels featuring an RJ45 port for serial communication. If it doesn't work for your setup, consider trying an alternative pin-out from the archive.

Use the provided pin-out to connect your ESP32 to the desk controller's RJ45 port using an ethernet cable. If you're not experienced with electronics and soldering, consider using an RJ45 Adapter Board from sites like Aliexpress, connected with Dupont cables to your ESP32.

example setup

Pass-Through Configuations

If your desk controller lacks an extra RJ45 port, you'll need a pass-through solution. This requires connecting the RJ45 of the keypad to the pins below.

KeyPad RJ45 pinNameConnection
8+5V (VDD)VIN (Split)
7GNDGND (Split)
6TXRX0 (GPIO3)
5RXRX2 (Split)
4PIN 20(Not Required)
3(unknown)(Not Required)
2SWIM(Pass-Through)
1RES(Pass-Through)

The pins marked 'split' are to be connected to the ESP32 pin, the desk controller and to the keypad. The pins marked pass-through are to be connected directly between the controller and the keypad.

Note: the current implementation does not utilize PIN20 however, this could be utilized to sense if the screen is on if desired.

Pass-Through Pinout

Optional: Custom Enclosure for a Clean Setup

To keep your setup clean and well-protected, a custom enclosure for the ESP32 DevKit with Ethernet breakout is available. It ensures secure housing, optimal cable management, and a stable wired connection.

Features ✅:

  • Secure housing – Protects the ESP32 and Ethernet breakout
  • Optimized cable management – Keeps wiring neat and organized
  • Ventilation slots – Prevents overheating
  • Easy mounting – Designed for a hassle-free installation
  • Compact design – Fits seamlessly into any setup

image

🔗 Download the enclosure model at makerworld.com.

Optional: Enclosure for a Pass-Through Setup

A pass-through configuration needs two RJ45 jacks, which the enclosure above does not have. This case fits an ESP32 DevKit between two RJ45 breakout boards — desk controller on one side, keypad on the other.

EnclosureAssembled
Pass-through enclosure, printedESP32 and both RJ45 breakouts mounted in the case

🔗 Models (STL + Fusion 360 source): models/passthrough-case

Troubleshooting

My height sensor is not providing the correct value

  • Uncomment the debug line for UART in the ESPHome configuration to see the raw data coming from the desk controller. This will help you collect information to troubleshoot the issue. See debugging UART.
  • If your cover entity has up/down buttons grayed out due to height sensor issues, you can change the internal parameter for the up/down switch from true to falsein the YAML configuration.

Research

If you are interested in the internals of the LoctecMotion desk system, have a look at the research below which is composed of my own findings combined with findings of similar projects.

Full research

Control Panels

At the time of writing, LoctekMotion sells 11 different control panels. The features can differ per model, but it looks like the serial interface is pretty similar for the more advanced models.

The tables below will show a mapping of the RJ45 pinout to the pinout used by the control panel. Please note that all RJ45 pins are described in the following way:

RJ-45 connector layout

The most common color convention for wiring RJ45 for network cables is:

RJ45 T568B colors

In order to connect the control box to a Raspberry Pi and ESP32/ESP8266 chip I used a RJ45 to RS232 adapter with DuPont cables (jump wires), but you simply can cut and split an ethernet cable as well.

Supported Control Panels

[!NOTE] Eventually, we discovered that a single pin-out should work for all control panels. It seems multiple mappings can be used, but the most common one is the one used for the HS13B-1 control panel.

HS13B-1

  • Desk model: Flexispot E7
  • Tested with control box: CB38M2J(IB)-1
  • Source: Printed on the PCB of the control box.
RJ45 pinNameOriginal Cable ColorEthernet cable color (T568B)
1RESETBrownWhite-Orange
2SWIMWhiteOrange
3EMPTYPurpleWhite-Green
4PIN 20RedBlue
5RXGreenWhite-Blue
6TXBlackGreen
7GNDBlueWhite-Brown
8+5V (VDD)YellowBrown

Note that RX and TX is defined like this on receiver (control panel) side. So the custom controller also uses RX to receive data and TX to send data.

HS13A-1

  • Desk model: Flexispot EK5
  • Tested with control box: CB38M2B(IB)-1
  • Source: Printed on the PCB of the control box.
RJ45 pinNameOriginal Cable ColorEthernet cable color (T568B)
1RESET SWIMBrownWhite-Orange
2PIN 20WhiteOrange
3RXPurpleWhite-Green
4TXRedBlue
5GND1GreenWhite-Blue
6+5V (VDD)BlackGreen
729V+BlueWhite-Brown
829V-YellowBrown

Note that RX and TX is defined like this on receiver (control panel) side. So the custom controller also uses RX to receive data and TX to send data.

HS01B-1

RJ45 pinName
8+5V (VDD)
7GND
6TX
5RX
4PIN 20
3(unknown)
2SWIM
1RES

Note that RX and TX is defined like this on receiver (control panel) side. So the custom controller also uses RX to receive data and TX to send data.

Other control panels / control boxes could be supported in the same way, but you would need to figure the RJ45 pinout mapping. Most control boxes have an extra RJ45 port for serial communication, but otherwise you would need to place your device in between the control panel and the control box.

Retrieve current height

Based upon the great work of minifloat, it became clear that the control panel utilises a 7-segment display. Fortunately, this is very common in such devices and thus there is a lot of documentation on this topic.

The control box sends the height as 4-bit hexadecimal, which is decoded in the control panel to drive the 7-segment display. The second number on the display also supports an optional decimal point ("8 segment").

Make sure you set the baud rate to 9600. For most LoctekMotion desks, the control box only broadcasts the current height for x seconds after you sent the Wake Up command. Otherwise you will receive 0x00 0x00 0x00 as payload.

source: alselectro

Execute a command

The control box only accepts commands when the 'screen is active'. To activate the screen, PIN 20 needs to be set to HIGH for about 1 second. The screen gets disabled automatically again after some amount of time receiving no commands.

Command list

Command nameStartLengthTypePayloadChecksumEnd
Wake Up9b060200 006c a19d
Up9b060201 00fc a09d
Down9b060202 000c a09d
M9b060220 00ac b89d
Preset 19b060204 00ac a39d
Preset 29b060208 00ac a69d
Preset 3 (stand)9b060210 00ac ac9d
Preset 4 (sit)9b060200 01ac 609d

All bytes combined will become the command to send to the control box. See the packages for sample code.

Similar projects

While working on this project, I found that many others have done similar work. Several GitHub repositories with great research have been very helpful in starting this project. ❤️

Special thanks to the Tweakers.net community (Dutch) for helping kickstart this project.

Contributions

We welcome contributions from the community! If you have ideas, suggestions, or improvements, please feel free to open an issue or submit a pull request.

Support

Join our Discord channel for a chat with like-minded people or to get help with your project.

esp32
esp8266
flexispot
flexispot-desks
home-assistant
loctek
loctekmotion
smart-desk
standing-desk

Significant stargazers

Manuel Rüger

227 followers · starred Aug 2026

Rui Carmo

706 followers · starred Oct 2024

Evgeni Golov

284 followers · starred Jun 2026

davidedmundson

64 followers · starred Jan 2022