Zigbee control for step motor

I am trying to make a coffee cup mover for my coffee machine.

For this purpose, I am looking for options to drive a tray in front of the coffee machine. For example, the following sliding table with a step motor would work if I can build a custom tray expansion to it with my 3d printer.

https://tr.aliexpress.com/item/4001272086575.html?spm=a2g0o.productlist.main.37.7ba777bessQ3yD&algo_pvid=69dccf06-85ce-4514-9389-6d741aa7586b&algo_exp_id=69dccf06-85ce-4514-9389-6d741aa7586b-18&pdp_ext_f={"sku_id"%3A"12000016188477144"}&pdp_npi=3%40dis!TRY!1354.79!541.91!!!!!%402100baf316781686498916897d06d2!12000016188477144!sea!TR!856905781&curPageLogUid=1SCRDuNSt1w1

these are in various sizes, so I can fit one for my coffee machine.

But I want to control it through Hubitat using a zigbee or zwave device and I have really very few knowledge about step motors. Can I drive it with the following relay :

https://tr.aliexpress.com/item/1005002482524516.html?spm=a2g0o.order_list.order_list_main.56.3cf23d12kqCnmd&gatewayAdapt=glo2tur

it is a 2 channel zigbee relay which works with Hubitat. So would it be possible to use each channel per direction of the step motor ?

Otherwise, is there a more practical way of controlling such step motor ?

And, lastly, is there a better out of the boz solution as a zigbee controlled sliding tray ?

If you are happy controlling the motor with relays, look at the Zooz relay.

It theory you can use relays but it will take a year to go from one side to another.
I think the best option for this project is Hubduino.

1 Like

Hubduino is a software which controls arduino devices through Hubitat hub. But what kind of hardware do I need for controlling a step motor through that ?
Obviously something with Arduino but what is the simplest and cheapest solution ?
What Aruino hardware and how should the step motor be connected ?

And why would it be easier (or faster) than using a zigbee relay ?

but how do I connect the relay to the step motor's 4 wires ?
A normal relay has 2 cables. A 2 channel relay has 4 wires. So how do we connect a relay to a step motor ?

Sorry my post was a little short of info. I thought you were further along....

  1. to drive a stepper motor you need a stepper motor driver. eBay has a bunch of them here.

  2. You need either switches to tell the controller the shelf has reached its destination or a method to count the steps.

  3. Hubduino is a set of "programs" that allows you to control things through the Hubitat Hub - WiFi to an Arduino board.

All this is definitely not plug an play.

1 Like

thanks. so I need a driver (A4988) and an Arduino controller.
The controller will be connected to the driver and the driver will be connected to the step motor.

I am not good at selecting an Arduino controller. I just need wifi chip and a USB port for powering up. So with this minimal requirements what Arduino device would be the cheapest solution ?

If you want to go that route (Hubduino) I suggest the ESP32. NodeMCU. It has enough I/0 and a built in WiFi.

I found a cheap Arduino UNO with Wifi board and just purchased it.
It was really cheap so I didn't want to miss.
Is that ok for Hubduino ?

And for this purpose is there a Hubduino profile that I can use ?

Basically @JohnRob already answered all yours question.
For this DIY project you will need:

  1. ESP32 Controller
  2. Stepper Motor Driver
  3. Power Supply for the Stepper Motor (usually 24VDC)
  4. Downconverter 24V to 5V (or whatever Stepper Motor voltage is)
  5. Carrier board for putting all these toys together
  6. DIY Box
  7. Soldering skills
  8. HubDuino files/libraries
  9. C++ Programming skills and Arduino IDE
  10. Sure, I forgot something else

Please check spec for the selected Stepper Motor.
Based on its parameters (Voltage and Drive Current) you will need
to select appropriately sized Power Supply and Motor Driver.
Make sure Motor Driver max current is about 25-30% higher than
max Motor Current.

Stepper Motors are very popular for DIY projects.
I am sure there are few ready-to-go libraries already exist.

Unlike DC and/or AC motors (power applied and motor spins)
Stepper Motor requires alternate two phases in KHz range.
With a relays you may achieve only few pulses per second.
Relay will sound like a machine gun and will die within few hours.

4 Likes

Thanks for your help.

as I wrote above, I ordered a Arduino UNO with Wifi. I believe it will be possible to handle this on it. I have already some experience on Arduino but no Hubduino experience.

I have a A4988 for this purpose.

Why 24V ? If I will downconvert to 5V , why not 5V ?

5,6,7 and 9 OK - I have them :slight_smile:

I just miss Hubduino libraries etc. But it seems to be the easy part. If not, I can write my own web endpoint on Arduino.

The important part for me is the power (5V ? 24V ?) , I did not understand what power supply I should use. Shall I power the motor directly or through the A4988 ?
What about the Arduino board ?

You definitely will need 5V PS.
But as I mentioned please check the spec for the selected Stepper Motor.
Usually Steppers are running on 24V. If yours is 5V then sure, you don't need 24V PS.
Also the selected PS must handle 25-30% higher current vs. whatever is
required for the Stepper.

The max current for this part is 1.2A with heatsink.
It will drive Steppers with max current 0.8A.
Make sure your chosen Stepper max current is les than 0.8A
(Obviously, you want a reliable design and don't want to see
a smoke on a first try).

Arduino UNO should be OK but ESP32 far more elegant solution.

1 Like

Motor voltage goes though the A4988. If you are using a nema motor these will need a minimum of 12V (max is usually 24V) which you feed into the stepper board along with 5V to power the electronics.

If you are using a much smaller 5V stepper like a 28BYJ48 then you need to use the driver board that is usually shipped with the motor. All depends on how much torque you need.

This will need 5V also.

1 Like

I'm sorry, I am a little confused. I am good at software and programming but never as good in electronics.
Trying to understand , please bear me.

How many power adapters do I need ?
I understand that the motor will not be powered directly but through the A4988.
So one power input (most probably 12V) will go into there.

Then, shall I also need a power for Arduino board ? And it will be 5V ?

So 2 power adapters;
One for Arduino : 5V (can I power it with 12V as well ? since Uno has a 9-24V input separate from USB power input)
One for motor (connected through the driver board): 12V

is that correct ?
if yes, I don't need a power convertor. And if I can power Arduino using 12V, maybe 1 power adapter would be also sufficient provided that it has enough current.

I don't need much torque and I will use A4988.

There is a motor power input pin on the board which takes 12-24V. You also need to power the board itself with 5V which you can get from the uno's 5V pin.

The arduino has a DC socket input that takes 6-20V. So no.

Short answer is yes you can power everything from a single 12V supply. However as arduinos have onboard linear regulators, with extended use I'm not sure how hot they would get, so you might want eventually to use a DC-DC converter feeding off your 12V supply (they are very cheap) to supply 5V to the arduino directly.

What stepper are you using? If not much torque needed you can use the much cheaper stepper in 12V form as I mentioned. But that's entirely up to you.

1 Like

so you mean I have to power the A4988 with 5V in addition to the motor power pin which will require 12V ?
2 power inputs on A4988 should be provided ? Is that correct ?

Probably not. I do not recommend Arduino UNO boards due to the very small amount of memory onboard.

No there is not. HubDuino has no support for stepper motors, nor do I personally plan on adding it. Others are welcome to add stepper motor support, and many have discussed doin so for the past 8 years. Yet, it have ever done so.

OK. Then I'll write my own endpoint on Arduino and call it through MakerAPI
The code will be very short. Why did you say Uno is not suitable because of memory ?

@rocketwiz , @vitaliy_kh

I will try to implement the following diagram:

but I didn't understand the connection on A4988 , MS1, MS2, MS3 pins.
Also the loop on RST & SLP

Should I do anything on these pins ?

The UNO only has 2KB of RAM. When trying to use Ethernet or WiFi along with application code, it is often not enough.

An ESP8266 or ESP32 is usually much cheaper than an UNO + Ethernet shield. It has much more memory and a faster CPU.

1 Like