Skip to content

Commit

Permalink
Update README with new INPUT_SAVE implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanwick committed May 31, 2021
1 parent 4530517 commit ccde2ae
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
## BEKANT Firmware
# BEKANT Firmware

The IKEA BEKANT adjustable-height sit/stand desk is controlled by a minimal two-button interface: hold one button to move up, hold the other button to move down. Releasing the button stops moving the desk, which means you have to hold a button while the table steadily moves into position, perhaps while you watch for it to line up with a mark you made on the wall at the perfect height.
Control firmware with position memory for IKEA BEKANT adjustable-height desk. Can be flashed onto the OEM microcontroller, on its OEM circuit board, without changing any hardware.

## Background

The stock configuration of the IKEA BEKANT adjustable-height sit/stand desk is controlled by a minimal two-button interface: hold one button to move up, hold the other button to move down. Releasing the button stops moving the desk, which means you have to hold a button while the table steadily moves into position, perhaps while you watch for it to line up with a mark on the wall at the perfect height.

If you switch the height of the desk often, standing there holding a button gives you plenty of time to wonder why a position memory feature wasn't originally built in. A single button press should be able to move it to a pre-programmed height.

Several IKEA hackers with the same thoughts have reverse engineered the signaling protocol, built replacement hardware, and added more automation to the the control system. But these implementations have all either treated the OEM control board as a black box or replaced it outright, meaning their modifications all require new hardware.
Several IKEA hackers with the same thoughts have reverse engineered the signaling protocol, built replacement hardware, and added more automation to the the control system. But these implementations have either treated the OEM control board as a black box or replaced it outright, meaning their modifications all require new hardware.

This project is a reimplementation of the BEKANT control firmware which can be flashed onto the OEM microcontroller, on its OEM circuit board, adding position memory without changing any hardware.
This firmware adds position memory with no new hardware.

## Build & Flash

Expand All @@ -16,29 +20,37 @@ The firmware image was built in MPLAB X with the XC8 compiler. The microcontroll

| Button | Action |
| ------ | ------ |
| <kbd>△</kbd> (hold) | Move up |
| <kbd>△</kbd> + <kbd>▽</kbd> | Move to upper memory position |
| <kbd>▽</kbd> (hold) | Move down |
| <kbd>▽</kbd> + <kbd>△</kbd> | Move to lower memory position |
| <kbd>△</kbd> | Move up |
| <kbd>△</kbd> + <kbd>▽</kbd> | Move up to upper memory position |
| <kbd>▽</kbd> | Move down |
| <kbd>▽</kbd> + <kbd>△</kbd> | Move down to lower memory position |
| <kbd>△</kbd><kbd>▽</kbd> (hold 3 sec) | Save current position |

"+" means press the first button, and while holding it, press the second button, then release both. Just like <kbd>Ctrl</kbd> + <kbd>X</kbd>.

Automatic movement to a memory position can be canceled by pressing either button or cutting power.
Automatic movement to a stored position can be canceled by pressing either button or cutting power.

For the *Save* gesture, press both buttons at the same time and hold for 3 seconds. The firmware will overwrite either the lower or upper stored position, whichever is closer to the current position. The table should not be moving during the hold, otherwise one of the other gestures was triggered. Both buttons must be pressed within the software debounce interval.


### Memory Positions

Memory positions are stored in the PIC EEPROM. These are 16-bit little-endian integers for the presumed encoder values of the motorized table legs.
Memory positions are stored in the PIC EEPROM. These are 16-bit little-endian integers for the encoder values of the motorized table legs.

| Offset | Length | Default | Description |
| ------ | ------ | ------- | ----------- |
| 0x00 | 2 bytes | 0x0636 | Lower position encoder value |
| 0x02 | 2 bytes | 0x1600 | Upper position encoder value |
| 0x00 | 2 bytes | 0x0636 | Lower position encoder value, default about 70cm |
| 0x02 | 2 bytes | 0x1600 | Upper position encoder value, default about 110cm |

## Disclaimer

Use at your own risk.

# References
The real reason that position memory is not built into the stock firmware is probably for safety and liability. Requiring a human to hold a button while the table is moving keeps a human in the control loop.

Ensure that the path of the table is clear during all movement.

## References
1. <a name="1">https://web.archive.org/web/20190116092248/https://blog.rnix.de/hacking-ikea-bekant/</a>
2. <a name="2">https://github.com/trainman419/bekant</a>
3. <a name="3">https://github.com/robin7331/IKEA-Hackant</a>
Expand Down

0 comments on commit ccde2ae

Please sign in to comment.