Create a desk lift using NEMA 17, Arduino Nano and Push Buttons

Hi there,

I have an IKEA desk with a manual lever system to rise and lower it, and I want to automatize it, just because! :slight_smile:
I want to do something simple, to rise and lower the table using 2 buttons. No wifi, BT, computer, sensors, etc... Just to buttons to make it move in both directions at the same speed in either. Something like this: STPB-2 Control Stepper motor 28BYj-48 with Arduino and 2 push buttons - Robojax

I've created some stuff (CNC router) where I edited existing code for my hardware. Basically the parameters and commenting to disable part of the code. But I cannot find a suitable code for this purpose to use this approach...

I have available an Arduino Nano, Nema 17 and 23 stepper motors, Stepper driver A4988, and some arcade buttons. I believe this is enough!
Question 1: can use I use the arcade buttons for this? Or do I need special push buttons?

I've seen some projects using the Nano and:

I've also seen some using Uno R3, but I really wanted a more compact hardware, since I'm only using one motor.

Can any of you help me with this project, mainly with the code?

First things first.
Show us how you are mounting the stepper motor and connecting it to the existing devices. Then tell us how you are going to power the motor and Arduino.

Why do you need a microcontroller? If you want to raise and lower with only 2 buttons, you can add 2 limit switches and a simple DC motor with a change of direction.

I didn't want to go deep into the mechanics of the system, but no worries.

The table has a manual lever/crank, that I want to replace with the motor. It is connected to the elevator system by a standard 6mm hexagon rod. The ones used by screwdrivers. I also have pulleys and belts available.
I will design and 3D print a mount (or use some sheet metal mount) to fix the Nema17 to the table and attached it to the hexagon rod.

To power up the system, I have a 5V to power the Arduino and a 12V3A for the Nema17.

Good start. Will have to complete so you can test your code.

It's just that I have a lot of this material laying around and want to put it to good use! :slight_smile:

As for the limit switches, I also have some of those, but I want to adjust the height freely because my wife also uses this desk, so I need different heights.

I just wanted to know if it is possible before starting to work on the hardware.

Are the arcade buttons good for this?!

Using a stepper you will need at least one limit switch to allow you to "home" or zero the stepper position at start up.

How many positions will you need for the table. Just down and raised or some positions in between?

I see no reason that your arcade buttons would not work. To the Arduino one momentary normally open switch is like another.

The 28BYJ-48 is made to position air duct vents. I doubt very much if it is powerful enough for your use. A NEMA 17 (NEMA 17 is really just a physical size spec) with a lead screw may be powerful enough.

The Nema17 used to power a wood router. If I find it is not enough, I also have some Nema23! :smiley:

The A4988 driver is good for 1A coil current without active cooling and heat sink. 1.5A with.
Choose the motor first, then the driver.

A NEMA 23 will likely need a driver capable of more than 2A. The TB6600 is a popular driver that is good for up to 4A.

The Accelstepper and MobaTools stepper libraries may make things easier. I am starting to like MobaTools more as time goes on. Though your application may be simple enough that you don't need a library. See Robin2's simple stepper code tutorial.

A powerful Nema 17 driving a lead screw can generate a lot of force.

The Nema's I have are powerful enough. That I know. But the position is not favorable for direct drive. I'll need some sort of pulley system or similar.

That Robin's tutorial looks really good for what I need. I'll give it a go, hopefully this week still.

I don't see a problem - you put 3 buttons with 3 switches. In addition, you can always stop moving if you want an intermediate position at the moment.

If you are still considering stepper(s), you will still need one limit switch for homing at startup. From then on keep track of position by counting steps. A properly designed stepper system will not lose steps.

You could use one button and step through the positions for simpler hardware or have a up, down and maybe home buttons.

Those are all good ideas.

But the table geometry is not the best to place limit switches along the height without adding to many fixtures. Maybe just one for the lower limit.

As for the buttons, I want to use the Arduino Nano Classic. Does it withstand that many inputs?

You only need one limit switch. Home the motor to that switch and count steps to keep track of position from then on. Map the positions that you want,table all the way down (in steps from home) and all the way up ( in steps from home). Now you know the limits you can send the position that you want and the table will go there. Or manually move the table up and down.

The limit switch does not have to be a mechanical switch. It can be an opto interrupter, reflective optical, or Hall Effect magnetic switch.

I want it simple! :sweat_smile:

Push button to go up, or go down, until it reaches the position I want, and release.
No memory positions, limits, etc. At least not yet.
The mechanics of the table is done so it doesn't need the stepper to be active to brake it to maintain height.

First step, automation. Then I'll see! :slight_smile:

But thanks for all the great inputs!

How much torque is required on the crank to raise the fully loaded table?

I didn't measure it. I'm ass-uming on the force I require to raise it.
The NEMA17 I have are 17HS19-2004S1 from omc-stepperonline: Nema 17 Bipolar 59Ncm (84oz.in) 2A

It should be more than enough, especially if I use different size pulleys to divide the force.

And probably use a 12 volt 2+ amp power supply?