Make your IKEA standing desk smart!

Matthias Schaffer
6 min readJul 21, 2022

--

Last year in summer, when i was renovating my room at home, i bought a beautiful IKEA standing desk: The IKEA Bekant with 160 by 80 centimeters space it fits perfectly and looks really nice.

IKEA Bekant Desk sit/stand, black stained ash veneer/white, 499€

But one thing bugged me: It can’t save height positions. The controller only has two buttons for upward and downward movement. So, i started my search for a solution and found Megadesk by the talented Gred Cormier.
Megadesk solves not only the problem by allowing to save ten memory positions (you can enable up to twenty positions), but it also enables you to control your desk with a serial interface.

It was clear to me that this is a must-have!

Megadesk is a circuit board that replaces the original PCB which is inside the gray controller box. You can either make the PCB yourself or Greg sells it for 44$ on Tindie. I got it from him and payed with shipping to Austria and customs 72,52€.

Megadesk Controller Circuit Board (Credits: from tindie.com / Greg Cormier)

Inserting the new Megadesk Controller

They replacement of the board is completely solder free. The only thing you’ll have to do, is to open the controller case. The easiest way to achieve this, is to use a ruler and a cutter knife and cut 20 to 30 times on the same line, then you can leverage the top off with a small screwdriver where the cable goes out of the case. As soon you opened it up you can switch out the controller boards by simply switching the transparent connector which connects to the buttons and connect the supplied power cable.

But that is only half of the fun part: It also comes with serial control!

To enable serial control, we must flash a firmware which enables it.

Enabling serial control

We need the following stuff to flash the new firmware to the Megadesk:

Megadesk Controller
Firmware File (you find that under the Repository Releases > Assets > megadesk-serial-hex)
AVRDude Software
Sparkfun AVR Programmer — 24,67$ on Amazon
AVR Driver (follow this instructions)

You got everything? Good! Now let’s hook it up.

I connected the smaller side of the supplied cable with six little pin headers (two rows two by three) to the Megadesk PCB. You can hold the connector in place during the flashing process. Hold the pins to the top of the programming header of the Megadesk with the notch in direction to the white connector on the PCB.

https://www.avrfreaks.net/sites/default/files/avr%20pocket%20programmer%20pinout2.jpg

Download AVRDude, extract the folder, download the flash.bat and the serial enabled firmware (megadesk-…-serial.hex).
Your folder should look like the following:

Now edit the paths in your flash.bat file:

Run the flash.bat file in a terminal and after a few seconds you should be greeted with a success.

Connecting Megadesk to your WiFi

To establish a connection with my Smarthome Broker “Homeassistant” i wanted to be able to control Megadesk with its serial interface over WiFi.

I used a lightweight ESP8266 which i had laying around at home and had a friend of mine print me a case for it, because the original IKEA controller is a tight fit.

https://m.media-amazon.com/images/I/51FoFFu8aRL._AC_SX466_.jpg

Here are the requirements of what you’ll need:
1x ESP8266 microcontroller — 3 pieces 8,99$ on Amazon
1x Programmer for ESP — 9,99$ on Amazon
2x Female-Female Dupont Cable (chances are high you’ll have them at home, a full set of them cost 6,98$ on Amazon)
1x StepDown Converter (24V down to 3.3V) — 5 pieces 14,99$ on Amazon
1x RC car servo splitter cable — 3 pieces 8,99$ on Amazon
soldering iron, solder lead, electric tape, small flathead screwdriver, …

Because Greg pointed out, that the Voltage Output from the Megadesk Controller should not be used to power any other device, i had to use a StepDown Converter from the 24V supplied by the desk to the 3.3V needed by the ESP8266. When you use a StepDown Converter, check that it has “Common Ground” as we want the Megadesk and the ESP to have the same GND. You can check that with a continuity tester/multimeter.

The following connection schema was the fight plan:

To be able to easily dis-/connect the StepDown Converter i used a Y-cable made for RC car servos (servo cable splitter) which fits the connector of the Megadesk and its cable.

Source: amazon.com / RC Car Servo Splitter

I cut the longer end of and soldered it to the voltage input side of the StepDown, the shorter side connected to the Megadesk. To the output side i soldered Dupont cables which i cut in half because i needed exactly four female Dupont plugs to connect to my ESP8266.

Then i soldered the other half of the two jumper cables to MISO and SCK on the Megadesk PCB.

A good friend of mine designed and printed a case for my project, which you can download here on Thingiverse: Megadesk ESP8266/ESP32 Case.

So everything assembled in the 3d printed case it looked like this:

(yes, i know the esp8266 is not in its defined enclosure, i made the jumper cables a little bit short)

You can see the (not perfectly; don’t hit me i am a software dev ;) ) soldered serial connections on the bottom of the Megadesk PCB, they are the two red and brown wires south of the connector from the splitter cable.

https://pradeepsinghblog.files.wordpress.com/2016/04/esp8266-5.png

Before you connect the ESP8266 (or as alternative the ESP32) to the four jumper cables you’ll have to flash the software to the ESP.

I’m using esphome which i added as AddOn to my Homeassistant, you can follow this official guide on how to set it up, it is really straight forward.

After clicking “+ New Device” on the lower right, you’ll have to connect the ESP with a programmer to your pc. I couldn’t get it working on several tries, so i hit “Install > Manual download” and flashed the firmware with the ESPHome-flasher, which worked like a breeze.

Copy the configuration from the example esphome configuration and adapt it to your needs. I only had to replace the board (line 4) parameter with esp01_1m and the tx_pin/rx_pin (line 41&42; tx_pin: GPIO1, rx_pin: GPIO3) parameter to match my ESP8266.

After that i connected the following Pins on my ESP8266:

  • VCC (Voltage Output + from StepDown Converter)
  • GND (Voltage Output - from StepDown Converter)
    Remind to check that the StepDown Converter has a Common GND
  • RX (MISO from Megadesk)
  • TX (SCK from Megadesk)

Then check that the splitter cable is connected with the incoming 24V, the Megadesk and the StepDown Converter and now power it on.
When everything works correctly you should see that the ESP goes online in ESPHome.

You can now open the ip adress of the ESP in your browser and you’ll be greeted with many settings and buttons. Let's try to move your desk via your webbrowser!

Webinterface of the ESP8266

You can also integrate ESPHome with Homeassistant and create a simple card to easily change the height of your now “Smart”desk :)

Two buttons: one for seating and one for standing

Have fun tinkering around,

Matthias

The Amazon links in that post are affiliate links. The price does not change for you, but I will get a little money for some hard-earned beer from Amazon. 🍺

--

--