Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microstepping has been added for bipolar (2 and 4 wire configuration) stepper motor. #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Attila-FIN
Copy link

PWM based microstepping (1/2, 1/4, 1/8) has been added to four and two wires H bridge (L293D) configuration. L293D ENABLE pins must be connected to MCU pins.
Two wire configuration has been tested using ESP-12E module with L293D motor shield, but four wires not yet.

stepper motor.
Microstepping requires the ENABLE/PWM pins of the H bridge chip
connected to the MCU pins.
@lrmoreno007
Copy link

Nice, please merge this.

@nicocesar
Copy link

Tested on a NEMA17 motor with a esp12e motor shield and a NodeMcu 1.0 and works like a charm. Please merge this. I'm using @Attila-FIN fork meanwhile

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Attila Kovács seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

if (this->micro_stepping) {
this->micro_step_delay = step_delay / number_of_micro_steps;
// the PWM signal frqequency is proprtinal to the RPM
analogWriteFreq(whatSpeed * 100);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// analogWriteFreq(whatSpeed * 100);

@jcarta
Copy link

jcarta commented Jul 27, 2022

I get two errors with this implementation:

'analogWriteFreq' was not declared in this scope and 'PWMRANGE' was not declared in this scope

How would I resolve these errors?

@mcer12
Copy link

mcer12 commented Jan 15, 2023

@jcarta and anyone else having this issue => analogWriteFreq is ESP8266 only function so this PR will only work on ESP8266.
On STM32 replace analogWriteFreq() with analogWriteFrequency()
On ESP32 it's some more work => use ledcSetup() and use ledcWrite() instead of analogWrite()
On atmega chips it's not as easy and you have to tinker with timers.

@geonick69
Copy link

geonick69 commented Feb 14, 2023

In an attempt to adjust some numerical values on an older sketch I am facing a compilation error: "'PWMRANGE' was not declared in this scope". I am microstepping a 28BYJ-48 with a NodeMCU ESP8266 (ESP-12E) and a L293D Motor Shield. Everything would compile, upload and run without problems with older version of Arduino IDE (not sure which one, it's been a while) and this version of the Stepper library. Any ideas, please?

EDIT: I have been looking into the problem and managed to come across some info suggesting that PWMRANGE was defined up to v2.7.4 of ESP8266 (esp8266/Arduino#8447). Any ideas for a workaround to maintain the microstepping functionality with the current version?

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Feb 14, 2023
@WhiteLionATX
Copy link

WhiteLionATX commented Mar 10, 2024

In an attempt to adjust some numerical values on an older sketch I am facing a compilation error: "'PWMRANGE' was not declared in this scope". I am microstepping a 28BYJ-48 with a NodeMCU ESP8266 (ESP-12E) and a L293D Motor Shield. Everything would compile, upload and run without problems with older version of Arduino IDE (not sure which one, it's been a while) and this version of the Stepper library. Any ideas, please?

EDIT: I have been looking into the problem and managed to come across some info suggesting that PWMRANGE was defined up to v2.7.4 of ESP8266 (esp8266/Arduino#8447). Any ideas for a workaround to maintain the microstepping functionality with the current version?

Try add to stepper.cpp:
#define PWMRANGE 1023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.