Build Log: Smart Standing Desk


Welcome to my attempt at taking a broken standing desk and not only fixing it, but making it smart!

Summer in Canada was in full swing and I was loving it. Working with some tunes blasting away on the stereo, nice breeze rolling through the window, crushing bugs and saving the world (if the Supervisor is the world then ok this is accurate) but, I was missing something. Sitting down was so anticlimactic to my mood, I wanted to be free, unshackled from the confines of the 18" by 16" square foam cushion (my seat, and I actually did measure it).

I started looking for a standing desk as I was substituting my desk mat with stacks of books and storage containers. I saw how much a standing desk cost and felt it wasn’t worth it to me but one day I stumbled upon a for sale listing of a broken desk for about $200 poutine pennies (Canadian dollars) that I thought would be an easy fix since the seller mentioned an error code “asf”. After looking this code up online it seemed like a simple fix, just reset the table…so I went and picked it up.

Let me introduce my new broken standing desk. It’s a dual motor, T frame base, with a white laminate top. Right when I got home I hooked up the control box to see if my $200 gamble was going to turn into a big win or a new project…I was going to follow a sequence of reset steps posted online and see if that cleared the code.

Reality check

Well, the fact you’re reading a build log on this you could have guessed it did not work :stuck_out_tongue:

So…as someone that has never under taken a hardware project like this come along for the journey of me just guessing my way to a functional standing desk that will be powered by Balena so we can do some neat things. More updates to come soon!

So, it’s pretty common for standing desks to throw error codes because the control box doesn’t know the position of the desk which is what I believe to be the issue here. Usually when this happens the desk still allows you to lower but not raise. What you have to do is follow the sequence of reset steps from the manufacturer which will tell the control box where home is (lowest height).

Finding this sequence was pretty trivial since all the standing desks on the market are essentially from a handful of manufacturers and just rebranded with cool names (what does autonomous and ai have to do with standing desks?!). That’s right, autonomous, jarvis, uplift, effy, etc, they are all made in practically the same factories with the same components. Well, same components in principal but they are actually copies of each other. The Ikea Bekant is the only standing desk I’ve seen with electronics from another company (Bosch).

Anyways, the sequence to reset the desk is just lower the desk as much as you can then press and hold the down button again with another button, in my case M key. The control box should now be homed and allow you to raise the desk. There are tons of videos online showing people doing this but my control box would just make a click noise from a relay.

To troubleshoot this I decided to power the motors directly. To that I had to extract them and figure out how they work (did I mention I’ve never done anything like this ?)

Standing desks are just a base (legs + motors + control box + controller) and the top. Once you remove the top you can see wires leading to the top of the legs with a motor under a cover:

Here we can see a DC motor with a worm gear output and some encoder. On the legs you see the cog that engages with the worm gear which transfers the motors horizontal output to vertical rotation to spins a rod inside the leg.

I had no experience with electric motors before this so didn’t even know what the board on the end was for. After a bunch of searching I learned about HAL sensors which uses a magnetic sensor to track the rotations of a shaft. This particular encoder has 2 HAL sensors…which leads me to the wiring of the motor.

These motors are using a 6 pin PCIe connector. I knew 2 of those had to be +/- for the motor so I had to find them. By testing for continuity from the PCIe pins to the wires on the encoder I figured out what each pin was for.

(I ended up de-soldering the board to make it easier to debug)

Now with the wires figured out I stole the power supply from my 3D printer because I didn’t have a bench power supply (yet). I knew the printer power supply would work because it could output 14 A and 24 V. The motor said 18V so that’s close enough xD

After powering the motor though, nothing was happening. I verified the motor was getting power with my multimeter but nothing. It was at this moment I realized I was out of my league.

This thread is to help teach others and myself somethings so I’ll just be completely honest with what I do and don’t know.

I had no clue if I was doing something wrong with powering the motor so I spent a bunch of days just watching videos that explained brushed vs brushless motors and how to troubleshoot them. I found this video great for understanding how they work and this one for testing the motor.

The volts will determine the speed of the motor but the amps will provide the torque to spin the motor. You can have a lot of torque and slow speeds or vice versa. Watts is just a calculation of total energy used by multiplying the volts and amps.

So why wasn’t the motor spinning ? Brushed motors are the most common in electronics and they have a contact point (the brush) which contacts the commutator.

These brushes do wear out over time so perhaps that’s the issue ? I took the motor apart to check.

Well that looks different then the animation. What the heck are those blue capacitors for ? As this article explains, the capacitor is a technique used for filtering the noise (EMF) generated by the motors operation.

I performed some tests such as checking continuity across the commutator and the lack of from commutator bar to armature stack (the testing video above covers this). The wires are coated btw which is how they aren’t just 1 big short so you can’t just simply probe a wire to see if it has power. This is also how motors fail because the coating erodes away and causes a short which the tests would locate.

Now I was getting really desperate since the motor passed all the tests. I got a buck converter to step down the power just so I could have some form of control on the power input to see if it does anything.

WARNING: Placing a buck converter between a power supply and a component that will draw decent power is dumb.

So after reassembling the motor I begin sending power with a buck converter in the middle. After I kept stepping down the power from the power supply miraculously the motor begins to spin! I was ecstatic. We were back in business.

It was at this time that I decided not only would I fix the desk, but I wanted to control it from an IOT device running balenaOS. I had a few ideas to implement such as track hours spent standing (knowing if I was there would be the tricky part), automate standing up to force a minimum amount of standing hours, allow height adjustments via other devices such as a web ui, terminal, or even apple home kit integration ?

One more comment about DC motors…

When you apply power to an electronic device it will either be in constant voltage or constant current. This is to say, the device is either pulling the max amount of volts or max amount of amps the input is giving. So, if you have a motor with no load on it and give 2 amps, 10 volts, then it will be constant voltage because it it doesn’t need 2 amps to rotate and therefore is going to just be limited by the voltage. If you apply a lot of load which causes the motor to not spin you will cause the motor to pull more amps and if it still cannot spin then it will be reach Stall Current.

What. A. Log!

I can’t wait to follow this journey @20k-ultra! Let’s add pose estimation. Then you could tell the desk to rise with an expressive dance move. :sweat_smile:

1 Like

On a side note,
Powering a brushed motor with more voltage that its specification will work, it will even allow it to turn faster. But it will make more heat and age faster too. Putting to much voltage will just burn the motor. That is why you genery got voltage and current limiter on motor controler to prevent to kill the motor from over voltage or current !

And last point, brush got limited lifetime, if the motor stop, it is generally worth checking then for replacement before getting another motor as it is cheaper for big motors !

Good luck to rest of the repaird !

That’s right! I forgot about the “perfect height” calculator…this feature lets you enter your height and arm length so the desk will know what your desk height should be.

1 Like


Now that the motors are working I wanted to see if I could get the desk to move. I ordered a Hanmatek HC310 bench power supply for this project so I didn’t have to keep using my 3D printer’s power supply and it’ll be useful for other projects.

I’ve never owned a bench power supply so had to do a bit of research. You can spend a lot of money for some serious equipment but being my first one I went for a hobbyist grade unit that just met some basic requirements:

  • Can output 10 amps (a lot are 5 amps and I think that’s too close to what the standing desk motors could pull which is 4.8)
  • Dedicated load switch so you can have the power supply on and set up the output without actually applying load to your device
  • Dynamically set volt/amp of course

A feature I didn’t know I needed was being able to know when a device is pulling constant current or voltage. Since I was going to make my own device to control the motors I wanted to do a lot of trial and error to see what power is needed to move the desk and I don’t want to be running the motor at constant current since I think that would indicate it’s under too much load for the amps given.

If you decide to buy this unit I recommend searching on aliexpress as it’s considerably cheaper: High precision 30V 5A 10A DC power supply Mini low noise artificial power regulator portable safety lock for multi scene use|Voltage Regulators/Stabilizers| - AliExpress.

After hooking up the motors to the desk I turned the power supply on to settings that I previously confirm worked when the motors were outside of the desk. To my surprise, the desk moved very little then binded. No movement just electrical motors growling.

I thought then, something damaged the motors originally so maybe it’s the legs ? I ended up taking the legs apart which proved to be a waste of time however I learned a lot about their construction. Unfortunately I don’t have any photos because my hands were pretty dirty from the grease.

I won’t go into details about the consutrction of the leg as you can see that in this great breakdown of 2 common standing desks: You can see how these desk are all copies of each other because of how similar they are.

Close up of Uplift Desk Gear System source

After re-assembling the legs and trying again the motors were still binding…yet another roadblock that I had no clue to overcome so I let the parts sit for a bit…

Side note, it’s so funny how the standing desk market is just rebranded parts because in the above article you can see what the desk controller looks like and mine is EXACTLY the same minus the branding xD

Since the project felt like it was at a stand still I began to work on my fallback plan…contact the vendor for this desk and ask for replacement parts. There was a sticker on the control box with a model number that I was able to use and eventually locate the vendor who was a Canadian company. The issue is the motors and legs come as 1 unit so you have to buy the whole thing which began to make the $200 gamble turn into a nightmare. Still, the cost of legs I’d spent less then getting a whole new desk which typically costs $800 CAD so we had $600 of wiggle room. I however did not buy this desk with the intentions of spending that much (funny though because the power supply cost me another $100 but that will work for other projects! at-least that’s how I justified it).

I began thinking about how to solve this issue so much that I even had a dream about standing desks. It was really bizarre and made me not want to think about it even more so I left the project alone again…

Keep going dude! Take a break and then go again. This is going to be epic when we start integrating a balena device into it. :grin::grin::grin: