Stepper Motor
Moderators: grovkillen, Stuntteam, TD-er
Re: Stepper Motor
Hi friends,
can you share please compiled plugin ? Thank you
can you share please compiled plugin ? Thank you
-
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
Re: Stepper Motor
@Neykov_t
My current Lab version including a 4M binary,
https://we.tl/OtR1GnKOWd
(avail for 7 days)
Based on majklovec's _P106, I have created my local versions named _P107 and _P108.
- based on ESPEasy_v2.0.0-dev7, 4M version
- based on _P106, timelaps functions removed
- Controls 2 steppers: Ostep and Cstep (for Open and Close)
- Running 50x per second, non blocking for other Tasks
- Ostep and Cstep exclude each other (one disables the other)
- Instantiate Task: Ostep or Cstep or both
- Replace the strange values (why are they there??) by your GPIO numbers
- Safe GPIO's are 14,12,13,8,4,5
- Fill-in an IDX number
- Commands called by <IP>/command?cmd=<Cstep/Ostep>,<command>,<value>
Example:
http://<IP>/control?cmd=Ostep,speed,30
http://<IP>/control?cmd=Cstep,left
I used my programmers experience of 35 year ago.
Elegant code? Not at all!
Proof of correctness? No. (Is this still learned at university?)
Marginally tested, but it works.
Support? No support.
My current Lab version including a 4M binary,
https://we.tl/OtR1GnKOWd
(avail for 7 days)
Based on majklovec's _P106, I have created my local versions named _P107 and _P108.
- based on ESPEasy_v2.0.0-dev7, 4M version
- based on _P106, timelaps functions removed
- Controls 2 steppers: Ostep and Cstep (for Open and Close)
- Running 50x per second, non blocking for other Tasks
- Ostep and Cstep exclude each other (one disables the other)
- Instantiate Task: Ostep or Cstep or both
- Replace the strange values (why are they there??) by your GPIO numbers
- Safe GPIO's are 14,12,13,8,4,5
- Fill-in an IDX number
- Commands called by <IP>/command?cmd=<Cstep/Ostep>,<command>,<value>
Example:
http://<IP>/control?cmd=Ostep,speed,30
http://<IP>/control?cmd=Cstep,left
I used my programmers experience of 35 year ago.
Elegant code? Not at all!
Proof of correctness? No. (Is this still learned at university?)
Marginally tested, but it works.
Support? No support.
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
Re: Stepper Motor
@Domosapiens, any chance to share your custom plugin (again).
I would like to control a single stepper using a DRV8825.
I've tried to build the plugin my own based on the proposed modification mentioned by majklovec but with the recent sources of ESPEasy compile fails.
Thanks in advance, hoods
I would like to control a single stepper using a DRV8825.
I've tried to build the plugin my own based on the proposed modification mentioned by majklovec but with the recent sources of ESPEasy compile fails.
Thanks in advance, hoods
-
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
Re: Stepper Motor
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
Re: Stepper Motor
The link is expiered. Could you please share it again
Thanks
Thanks
-
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
Re: Stepper Motor
https://we.tl/vjC6hhH6tL
7days means ... 7days
7days means ... 7days
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
Re: Stepper Motor
Many thanks!
Just a question, why not make it an "official plugin" on the playground so everyone just can cherry-pick it to their build?
I didn't find it on the playground area...
https://github.com/letscontrolit/ESPEas ... Playground
Just a question, why not make it an "official plugin" on the playground so everyone just can cherry-pick it to their build?
I didn't find it on the playground area...
https://github.com/letscontrolit/ESPEas ... Playground
Re: Stepper Motor
Hi
I looked at your code and successfully uploaded the pre-compiled version.
There are some cheep motors from China for $1
http://robocraft.ru/files/datasheet/28BYJ-48.pdf
These are 4-phase unipolar and running directly on 4 GPIO with a simple ULN2003 driver between.
I see that you use the library: AccelStepper.h in your code.
I found a modified version of this including my motor so I was thinking of modifying your plugin with this custom build of the AccelStepper.
https://forum.arduino.cc/index.php?topic=194671.0
One question I have thou, when you have your motor running on the ESP, is it blocking all other functions while running? Can you stop the motor while running?
I looked at your code and successfully uploaded the pre-compiled version.
There are some cheep motors from China for $1
http://robocraft.ru/files/datasheet/28BYJ-48.pdf
These are 4-phase unipolar and running directly on 4 GPIO with a simple ULN2003 driver between.
I see that you use the library: AccelStepper.h in your code.
I found a modified version of this including my motor so I was thinking of modifying your plugin with this custom build of the AccelStepper.
https://forum.arduino.cc/index.php?topic=194671.0
One question I have thou, when you have your motor running on the ESP, is it blocking all other functions while running? Can you stop the motor while running?
-
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
Re: Stepper Motor
The while loop code contains yield();
So I think it is non-blocking.
Stop? ... just give it a try
My coding skills are more than 40 years old,
so I hardly understood what I have modified.
So I think it is non-blocking.
Stop? ... just give it a try
My coding skills are more than 40 years old,
so I hardly understood what I have modified.
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
-
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
Re: Stepper Motor
System design is the right balance between mechanics,electrics and software.
I think the A4988 driver is much simpler (1 control signal step) then the ULN2003 and less load for ESP. The 28BYJ-48 motor can run with the A4988 after a small motor modification:
See:
http://www.jangeox.be/2013/10/change-un ... polar.html
I tried it, it works, but this motor was too slow for my application: a curtain of 4 meters.
I think the A4988 driver is much simpler (1 control signal step) then the ULN2003 and less load for ESP. The 28BYJ-48 motor can run with the A4988 after a small motor modification:
See:
http://www.jangeox.be/2013/10/change-un ... polar.html
I tried it, it works, but this motor was too slow for my application: a curtain of 4 meters.
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
Re: Stepper Motor
Well if you want to discuss hardware / software...
https://circuitdigest.com/electronic-ci ... or-circuit
Why not then add a external PWM and only controll Direction/Enable with the ESP12?
555 timer is like $0,5
https://circuitdigest.com/electronic-ci ... or-circuit
Why not then add a external PWM and only controll Direction/Enable with the ESP12?
555 timer is like $0,5
-
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
Re: Stepper Motor
Strange answer ..
With a small electronic modification and an intelligent A4988 driver you can use the software you asked me for (without overloading the ESP).
As TD-er commented here: https://github.com/letscontrolit/ESPEas ... -373406715
With a small electronic modification and an intelligent A4988 driver you can use the software you asked me for (without overloading the ESP).
As TD-er commented here: https://github.com/letscontrolit/ESPEas ... -373406715
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
Re: Stepper Motor
Also know a bit of the electronics and why things are limited somehow.
The thing is, a stepper motor is driven by current, not by voltage. This may sound a bit strange, but let me explain.
If you disable the current through the stepper motor coil, it will produce some voltage, which is opposite to the voltage applied previously.
For slow stepping, this doesn't matter.
But for faster steps, this will decrease the current through the coil and thus the strength of the magnetic field of the coil.
Above some step frequency it is no longer to keep up and you will loose steps, stall or even make some reverse steps.
This depends on the load of the stepper, the voltage applied and some other factors.
Some more sophisticated stepper motor drivers support a sense resistor to measure the current through the coil and limit the current (to prevent heating up the motor).
This allows to use a much higher voltage and thus higher step frequencies.
The A4988 is such a more sophisticated stepper motor driver, used often in 3D printers.
If you're running at the same step frequency always and also disable the current through the stepper when not moving, you could use a (much) higher voltage, even when using a very simple stepper motor driver like the 2003. (make sure you don't exceed the max current and voltage of the driver)
Just watch the temperature closely when determine the desired stepper speed and do these tests with the actual load of the stepper motor.
You could also make a power supply for the stepper which limits the current automatically to something like 100 mA. I think that's the safest way.
The thing is, a stepper motor is driven by current, not by voltage. This may sound a bit strange, but let me explain.
If you disable the current through the stepper motor coil, it will produce some voltage, which is opposite to the voltage applied previously.
For slow stepping, this doesn't matter.
But for faster steps, this will decrease the current through the coil and thus the strength of the magnetic field of the coil.
Above some step frequency it is no longer to keep up and you will loose steps, stall or even make some reverse steps.
This depends on the load of the stepper, the voltage applied and some other factors.
Some more sophisticated stepper motor drivers support a sense resistor to measure the current through the coil and limit the current (to prevent heating up the motor).
This allows to use a much higher voltage and thus higher step frequencies.
The A4988 is such a more sophisticated stepper motor driver, used often in 3D printers.
If you're running at the same step frequency always and also disable the current through the stepper when not moving, you could use a (much) higher voltage, even when using a very simple stepper motor driver like the 2003. (make sure you don't exceed the max current and voltage of the driver)
Just watch the temperature closely when determine the desired stepper speed and do these tests with the actual load of the stepper motor.
You could also make a power supply for the stepper which limits the current automatically to something like 100 mA. I think that's the safest way.
Re: Stepper Motor
@Domosapiens
Thanks, I have already seen the modification for the motor in another forum. I may go in this direction, but they also pointed out that you loose torque. I am afraid that the motor will not manage to drive a roller-blind.
What's your experience of this modification? I have the 12v versions.
Thanks, I have already seen the modification for the motor in another forum. I may go in this direction, but they also pointed out that you loose torque. I am afraid that the motor will not manage to drive a roller-blind.
What's your experience of this modification? I have the 12v versions.
-
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
Re: Stepper Motor
I never used it without modification, so I don't know the difference.
It fulfilled my requirement of 7N but too slow for my 4 meter curtain (iirc 1.5 minutes).
This one is my selection:
https://www.ebay.com/itm/1PCS-Used-27mm ... 282f328fa0
Has metal gears instead of plastic.
And works with Stepper-Driver-A4988 https://nl.aliexpress.com/item/5pcs-lot ... 62c6uYD24x
It fulfilled my requirement of 7N but too slow for my 4 meter curtain (iirc 1.5 minutes).
This one is my selection:
https://www.ebay.com/itm/1PCS-Used-27mm ... 282f328fa0
Has metal gears instead of plastic.
And works with Stepper-Driver-A4988 https://nl.aliexpress.com/item/5pcs-lot ... 62c6uYD24x
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
Re: Stepper Motor
Guys,
hope you can help me.
I have setup a Wemos D1 mini + DRV8825 + Nema 17 (17HD40005-22 b).
Wires are connected as shown in post #7:
ENABLE -> D5
Step -> D6
Dir -> D7
12VDC / 6A Power supply:
+ -> VMOT
- -> GND
100 µF cap between + and -
RESET + SLEEP are connected to 3,3V from ESP
I have successfully compiled the ESPEasy firmware (ESPEasy_mega-20180302) incl. the plugin from Domosapiens and also tested a second version of the firmware with the original P106 plugin. Both ESPEasy versions have the same behavior after configuring the Plugin in the Web-IF of ESPEasy.
Vref of the motor driver before has been configured to 600mV.
Unfortunately I do not have any experience with stepper motors so I start to ask myself, what values I have to define for my stepper in the plugin sources.
I've tested a lot with values like:
max_stepper_speed = 32000;
stepper_speed = 32000;
stepper_accel = 16000;
steps = 800;
According to the spec my stepper runs max 8000 pps (pulse per sec) and 200 pulses/rev.
The problem is, it starts to move but only very slow and it's more like stuttering it's way forward. I'm not able to change the speed with parameters set_accel, steps, speed.
http://esp09.fritz.box/control?cmd=speed,2000
http://esp09.fritz.box/control?cmd=left
I played already with Vref but the situation stays the same. Next I've used a very simple stepper code with an Arduino UNO only connected 5V, GND, Pins 8 and 9 and voila it turns as expected with a decent speed.
Arduino code:
Why it is that slow if I use the ESP and how do I have to properly configure the parameters in the plugin sources. At the moment I'm a bit lost, would be great if someone can help me to sort that out.
Thanks in advance, Sven
hope you can help me.
I have setup a Wemos D1 mini + DRV8825 + Nema 17 (17HD40005-22 b).
Wires are connected as shown in post #7:
ENABLE -> D5
Step -> D6
Dir -> D7
12VDC / 6A Power supply:
+ -> VMOT
- -> GND
100 µF cap between + and -
RESET + SLEEP are connected to 3,3V from ESP
I have successfully compiled the ESPEasy firmware (ESPEasy_mega-20180302) incl. the plugin from Domosapiens and also tested a second version of the firmware with the original P106 plugin. Both ESPEasy versions have the same behavior after configuring the Plugin in the Web-IF of ESPEasy.
Vref of the motor driver before has been configured to 600mV.
Unfortunately I do not have any experience with stepper motors so I start to ask myself, what values I have to define for my stepper in the plugin sources.
I've tested a lot with values like:
max_stepper_speed = 32000;
stepper_speed = 32000;
stepper_accel = 16000;
steps = 800;
According to the spec my stepper runs max 8000 pps (pulse per sec) and 200 pulses/rev.
The problem is, it starts to move but only very slow and it's more like stuttering it's way forward. I'm not able to change the speed with parameters set_accel, steps, speed.
http://esp09.fritz.box/control?cmd=speed,2000
http://esp09.fritz.box/control?cmd=left
I played already with Vref but the situation stays the same. Next I've used a very simple stepper code with an Arduino UNO only connected 5V, GND, Pins 8 and 9 and voila it turns as expected with a decent speed.
Arduino code:
Code: Select all
/* stepper motor control code for DRV8825
*
*/
// define pin used
const int stepPin = 9;
const int dirPin = 8;
void setup() {
// set the two pins as outputs
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
}
void loop() {
digitalWrite(dirPin,HIGH); //Enables the motor to move in a perticular direction
// for one full rotation required 200 pulses
for(int x = 0; x < 200; x++){
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
delay(1000); // delay for one second
digitalWrite(dirPin,HIGH); //Enables the motor to move in a opposite direction
// for three full rotation required 600 pulses
for(int x = 0; x < 600; x++){
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
delay(1000); // delay for one second
}
Thanks in advance, Sven
-
- New user
- Posts: 8
- Joined: 20 May 2017, 07:23
Re: Stepper Motor
Hi there!
@Domosapiens, did you use the default settings (for the AccellStepper library) or some specific ones for the 28BYJ
And if I may, which values you used for the 2phase - 6wires? (https://www.ebay.com/itm/1PCS-Used-27mm ... 282f328fa0)
It's a bit tricky to find the right balance and get the most of these little motors.
I am trying to move 2m long Ikea roller blinds.
Thanks and great work on the libraries!
@Domosapiens, did you use the default settings (for the AccellStepper library) or some specific ones for the 28BYJ
And if I may, which values you used for the 2phase - 6wires? (https://www.ebay.com/itm/1PCS-Used-27mm ... 282f328fa0)
It's a bit tricky to find the right balance and get the most of these little motors.
I am trying to move 2m long Ikea roller blinds.
Thanks and great work on the libraries!
-
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
Re: Stepper Motor
My project is still dormant ..
What I remember
Use
A+ and A-
B+ and B-
Other wires not connected.
I just fiddled with the parameters, nothing special.
What I remember
Use
A+ and A-
B+ and B-
Other wires not connected.
I just fiddled with the parameters, nothing special.
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
Re: Stepper Motor
Hey,
i am using the code from the fist page of this thread. Compiling and uploading OK.
When i try to add the motor plugin i get this error:
Is that something i can ignore? Doesn't look like it. Am i the only one with this error?
Would be thankful for an advice.
Thank you
ED
i am using the code from the fist page of this thread. Compiling and uploading OK.
When i try to add the motor plugin i get this error:
Is that something i can ignore? Doesn't look like it. Am i the only one with this error?
Would be thankful for an advice.
Thank you
ED
-
- New user
- Posts: 4
- Joined: 03 Nov 2016, 23:13
Re: Stepper Motor
Is there anybody using it with actual mega firmware?
there is less about stepper motors in the forum nobody usig it?
-
- New user
- Posts: 4
- Joined: 03 Nov 2016, 23:13
-
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
Re: Stepper Motor
W.r.t. viewtopic.php?f=6&t=2356#p25884
Hope this link is persistent
https://drive.google.com/open?id=1Xylw5 ... ezs7vBohyg
Hope this link is persistent
https://drive.google.com/open?id=1Xylw5 ... ezs7vBohyg
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
-
- New user
- Posts: 4
- Joined: 03 Nov 2016, 23:13
Re: Stepper Motor
Thank you!
I will test it
I will test it
Re: Stepper Motor
Does anyone have this working?
I've got a TB6612 stepper motor controller but I can't get this plugin to work?
I could do with a wire diagram and an example.
I've got a TB6612 stepper motor controller but I can't get this plugin to work?
I could do with a wire diagram and an example.
Re: Stepper Motor
Hello,
I have been using nodeMCU for a couple of weeks now and I am able to control Leds using switches and potentiometer.
I am trying to control a stepper motor with the nodeMCU (with esp8266) and openhab. Can someone help me with this?
Could someone please provide the custom plugin? The 7 day duration has obviously expired, @Domosapiens
At a beginner level, can someone please explain how exactly to add a custom plugin to the firmware?
Any help and suggestions would be highly appreciated. Thank you!
I have been using nodeMCU for a couple of weeks now and I am able to control Leds using switches and potentiometer.
I am trying to control a stepper motor with the nodeMCU (with esp8266) and openhab. Can someone help me with this?
Could someone please provide the custom plugin? The 7 day duration has obviously expired, @Domosapiens
At a beginner level, can someone please explain how exactly to add a custom plugin to the firmware?
Any help and suggestions would be highly appreciated. Thank you!
-
- New user
- Posts: 1
- Joined: 23 Jun 2022, 09:55
Re: Stepper Motor
I'm struggling to compile ESPEasy_v2.0.0-dev7_Cstep_Ostep_firmware from around 2017 into latest ESPEasy releases. Full of errors when trying to build.
@Domosapiens please can you give us some pointers on how to successfully build on latest releases. What needs to change in the P107/P108 and ESPEasy.ino files? What else needs changing?
Your help is much appreciated.
@Domosapiens please can you give us some pointers on how to successfully build on latest releases. What needs to change in the P107/P108 and ESPEasy.ino files? What else needs changing?
Your help is much appreciated.
Re: Stepper Motor
Why are you trying to build a firmware of 5 years ago?
What do you need, that isn't present in the current builds?
Please share a link to the plugins you need to build.
What do you need, that isn't present in the current builds?
Please share a link to the plugins you need to build.
Who is online
Users browsing this forum: Google [Bot] and 85 guests