-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Stepper motor control w/ TMC2209 #69
base: main
Are you sure you want to change the base?
Conversation
Everything seemed to build correctly, however no luck with the TMC2209 + moving the stepper motor. I will add that yesterday, I was able to confirm the TMC2209 works and drives the stepper motor (silently!) with some test code (Arduino IDE). This Arduino code relied on simply the Direction & Step pins. Therefore, I'm confident my A1,A2,B1,B2, motor power and TMC2209 board ground/power isn't an issue. I can see that the motor driver isn't being requested to move since the LED on the TMC2209 board is not cycling or turning on at all. I did use the pins you suggested between the ESP32 & TMC2209 board. From my brief investigations, it seemed many had issues getting the UART Tx/Rx to function properly between ESP32 and the TMC2009. Would it be easier to simply leverage the DIR & STEP pins for this application? |
Regarding UART Tx/Rx, I noticed that too. Did you also connect the This is used at lines
|
-D OLED_ENABLED=true | ||
-D PWM_MOTOR_CONTROL=false | ||
-D STEPPER_MOTOR_CONTROL=true | ||
-D HOME_ASSISTANT_ENABLED=false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set all to false
before merging
Yes, I did confirm the TMC2209 Enable pin was connected to ESP32 Pin 4. I also tried tying the TMC2209 Enable Pin directly to Ground manually. Sent from my iPhoneOn Oct 15, 2024, at 10:18 AM, mwood77 ***@***.***> wrote:
Regarding UART Tx/Rx, I noticed that too. Did you also connect the HARDWARE_ENABLE_PIN to GPIO4?
This is used at lines https://github.com/mwood77/winderoo/blob/9be415302d74445f1ed71913a8e011139a8e2216/src/platformio/osww-server/src/utils/MotorControl.cpp#L36 and https://github.com/mwood77/winderoo/blob/9be415302d74445f1ed71913a8e011139a8e2216/src/platformio/osww-server/src/utils/MotorControl.cpp#L39
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
|
I will confirm and try again later tonight. FYI, I’m in the USA on EST. On Oct 15, 2024, at 10:26 AM, mwood77 ***@***.***> wrote:
@mwood77 commented on this pull request.
In platformio.ini:
+ -D OLED_ENABLED=true
-D PWM_MOTOR_CONTROL=false
+ -D STEPPER_MOTOR_CONTROL=true
-D HOME_ASSISTANT_ENABLED=false
set all to false before merging
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
|
Any luck? If not, no worries. I'll have a motor and controller on hand to debug with by the end of the week. |
I tried setting all 4 build flags to FALSE, saving, uploading & upload filesystem image. |
@NickNerfLips I've refactored to use the step/dir interface. I can definitely hear the stepper motor trying to work, but I don't think I'm giving it enough power (I'm supplying barely 5v). I'll track down a better power supply on my end now. For the build flags, it should be able to ignore a bad config. Just make sure the stepper motor flag is set to |
Anything progress or anything in particular you’d like to try? |
Sorry mate, I've been crazy busy and haven't had time to work on it. I've got some spare time tomorrow, so I'll have at it again 👍 |
@NickNerfLips commit cd794ce has functional code for stepper motors controlled by a TMC2209. I've verified this on my test bench winderoo (USB-C ESP32 - identical to yours). However, it isn't very refined. The motor steps and micro second interval still needs tweaking. Right now it's turning at around 100RPM, which is much faster than the target 40rpm. If you're feeling adventurous, you can adjust the value in this line to
I couldn't reliably get my stepper motor to rotate in both directions at 900-ish, but it could be my power supply (3V line off an ESP32). The pinout is still the same: const uint16_t EN_PIN = 4; // Enable
const uint16_t DIR_PIN = 16; // Direction
const uint16_t STEP_PIN = 17; // Step Ignore the RX / TX pinouts, they aren't actually used. I still need to cleanup the code. You might also experience a few hard-crashes here and there. Like I said, it's functional, but not ironed out yet. |
You rock. I will plan to try it tomorrow and let you know. |
OK, I tried the new code and some good news: it does now move my stepper motor. I tried changing microsecond interval, but after the stepper motor pauses more frequently. Both directions seemed to work OK (albeit with the pauses, not continuous movement). Issues I saw:
Please let me know if you'd like me to try anything else. |
Another thing I noticed when playing with microstep values, definitely some relationship between the motor smoothly rotating (at lower microstep value of 100-200, etc.). Lastly, I'm seeing an inverse relationship between set rotation direction and actual stepper rotation direction. |
@NickNerfLips OK, I'm going to update issue #68 with your feedback, as those are all actual issues. Let's move our chat there so we can keep track of it a bit better; we're a bit all over the place between this PR, discussion #61 , and issue #68 . Can you please reply to me in issue #68 with your microsecond, mA, and microstep values were? |
Adds support for stepper motors, using TMC2209 derived boards.
-D OLED_ENABLED=false
prior to merging.