• Stars
    star
    555
  • Rank 80,213 (Top 2 %)
  • Language
    C++
  • License
    MIT License
  • Created over 3 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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.

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

Turn your LoctekMotion/FlexiSpot desk into a smart desk

Recently I acquired a new standing desk from FlexiSpot. During assembly I noticed that the control panel had a RJ45 cable and a second RJ45 port, which sparked my interest. Can we connect my desk to the internet?

Most of the models Flexispot sells are using components from LoctekMotion. LoctekMotion is a manufacturer of lifting columns for height adjustable standing desks. On their website they mention a bluetooth receiver that can be inserted to the control box, but I haven't been able to find this.

This repository will help you to connect your desk to the internet via the serial communication ports (RJ45), for example for use with Home Assistant. Think of scenarios like controlling your desk via voice or creating notifications when you sit for too long. (or just because it is cool 🤓)

Packages

Use the information in this repository at your own risk and with caution. Tinkering with electronics always has risks.

Name Description
Arduino Custom code to control your desk via an ESP32/ESP8266 module via MQTT.
ESPHome Control your desk via an ESP32/ESP8266 module connected to Home Assistant.
Raspberry Pi Custom code to control your desk via a Raspberry Pi via Python.

For more packaged solutions, see similar projects. Pull requests are welcome.

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.

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

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


HS13B-1

HS13A-1

HS01B-1

If your control panel is missing, feel free to create an issue to discuss the possibilities or create a PR to add your research to this overview.

HS13B-1

  • Desk model: Flexispot E7
  • Tested with control box: CB38M2J(IB)-1
  • Source: Printed on the PCB of the control box.
RJ45 pin Name Original Cable Color Ethernet cable color (T568B)
8 RESET Brown White-Orange
7 SWIM White Orange
6 EMPTY Purple White-Green
5 PIN 20 Red Blue
4 RX Green White-Blue
3 TX Black Green
2 GND Blue White-Brown
1 +5V (VDD) Yellow Brown

Note that RX and TX is defined like this on receiver (control panel) side. So RX can be used to receive data, 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 pin Name Original Cable Color Ethernet cable color (T568B)
8 RESET SWIM Brown White-Orange
7 PIN 20 White Orange
6 RX Purple White-Green
5 TX Red Blue
4 GND1 Green White-Blue
3 +5V (VDD) Black Green
2 29V+ Blue White-Brown
1 29V- Yellow Brown

Note that RX and TX is defined like this on receiver (control panel) side. So RX can be used to receive data, TX to send data.

HS01B-1

RJ45 pin Name Original Cable Color Ethernet cable color (T568B)
8 +5V (VDD) Yellow Brown
7 GND Blue White-Brown
6 TX Black Green
5 RX Green White-Blue
4 PIN 20 Red Blue
3 (unknown) Purple White-Green
2 SWIM White Orange
1 RES Brown White-Orange

Note that RX and TX is defined like this on receiver (control panel) side. So RX can be used to receive data, 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 name Start Length Type Payload Checksum End
Wake Up 9b 06 02 00 00 6c a1 9d
Up 9b 06 02 01 00 fc a0 9d
Down 9b 06 02 02 00 0c a0 9d
M 9b 06 02 20 00 ac b8 9d
Preset 1 9b 06 02 04 00 ac a3 9d
Preset 2 9b 06 02 08 00 ac a6 9d
Preset 3 (stand) 9b 06 02 10 00 ac ac 9d
Preset 4 (sit) 9b 06 02 00 01 ac 60 9d

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

Similar projects / research

While working on this project, I found out that I am not the only one with this idea. There are a few repositories on GitHub with great research which helped me kickstart this project. ❤️

and a huge thanks to the Tweakers.net community (Dutch), whom helped me to kickstart this project.

Support

Join our Discord channel

More Repositories

1

ha-nest-protect

Nest Protect integration for Home Assistant. This will allow you to integrate your smoke, heat, co and occupancy status real-time in HA.
Python
322
star
2

ha-tahoma

Custom component for Home Assistant to interact with smart devices via Somfy TaHoma or other OverKiz based API's.
Python
152
star
3

python-sagemcom-api

(Unofficial) Python wrapper to interact with SagemCom F@st routers via internal API's.
Python
83
star
4

python-overkiz-api

Async Python wrapper to interact with internal Somfy TaHoma API, or other OverKiz API's.
Python
45
star
5

cordova-plugin-openalpr

This Cordova plugin adds support for the OpenALPR (Automatic License Plate Recognition) library, which provides support for retrieving the license plate from a picture.
C++
33
star
6

ha-sagemcom-fast

Home Assistant integration to enable presence detection via Sagemcom F@st routers.
Python
31
star
7

python-postnl-api

Python wrapper for the PostNL API, a way to track packages using their online portal.
Python
20
star
8

BotBuilder-FacebookExtension

A collection of useful Facebook add-ons for BotBuilder.
JavaScript
19
star
9

search-ui-azure-connector

This connector is used to connect Search UI to Azure Cognitive Search.
TypeScript
3
star
10

powerbi-botframework-chat-transcripts

Visualises bot transcripts (activities) which show the interactions between a user and your bot in a webchat.
TypeScript
3
star
11

connect-AML-to-Azure-OpenAI

Connect Azure Machine Learning with Azure OpenAI, with AAD identity or managed identities.
Jupyter Notebook
2
star
12

home-assistant-config

The full Home Automation config of Mick & Cris
JavaScript
2
star
13

acs-static-web-app

Azure Communication Services meets Azure Static Web Apps
TypeScript
1
star