Тёмный

Stepper motor control with buttons and rotary encoder 

Curious Scientist
Подписаться 38 тыс.
Просмотров 17 тыс.
50% 1

Опубликовано:

 

6 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 70   
@isidoromaich7226
@isidoromaich7226 4 года назад
Now I understand the issue about refreshing the lcd, barely mentioned in a lots of videos out there, you explained well
@CuriousScientist
@CuriousScientist 4 года назад
Thanks! Yes, the LCD is a big pain in the butt. With a faster device, it is probably less problematic. I will try it with the blue pill soon which is much faster (16 vs 72 MHz).
@philipatkinson1532
@philipatkinson1532 3 года назад
Thank you, clearly explained and exactly what I need to automate my macro photography rail . And a lot of learning. I am using a nano and an oled display as these are what I have to hand. A little code tweaking needed. As a non coder something of a challenge but I think I’ll get there. Perfect timing!
@CuriousScientist
@CuriousScientist 3 года назад
Thanks! I am glad that you could use my resources for your project! Keep looking around on my channel because there are other videos where I have very similar things to what you want to build.
@imrichmorvay2227
@imrichmorvay2227 2 года назад
Thanks this is what I looking for turning variable capacitor for magnetic loop antenna Thanks a lot.
@CuriousScientist
@CuriousScientist 2 года назад
Glad that you found it helpful!
@luizcarlosarrudajunior3402
@luizcarlosarrudajunior3402 4 года назад
great channel. Subscribed already.
@CuriousScientist
@CuriousScientist 4 года назад
Welcome aboard!
@NAMHOANG-01
@NAMHOANG-01 2 года назад
Love you 3000... that's great, can you tell me how to start and stop step motor by start and stop buttons. That seem to be impossible for myself especially STOP step motor immediately
@CuriousScientist
@CuriousScientist 2 года назад
Hi! The answer for your questions can be found in most of my stepper motor related videos. Search for my stepper motor control panel, it is implemented there.
@NAMHOANG-01
@NAMHOANG-01 2 года назад
@@CuriousScientist I am sorry about that, but unfortunately seem to can not stop motor when running by a click button. I figure out lots of related videos and no one can control step motor by START STOP RESET buttons. To be honest. Hope you tell me the method. Peace
@CuriousScientist
@CuriousScientist 2 года назад
I can control it and many of my videos prove it. Check the video I mentioned.
@alexandrematos4031
@alexandrematos4031 4 года назад
If it is interesting, I would like to make a suggestion for a plaslyst to complement your projects, which I will certainly follow for learning. there is a Display touch scren called Nextion 7 "that we can place an animation and automate a project with total control by the display touch. It will be quite an experience! Hugs!
@CuriousScientist
@CuriousScientist 4 года назад
This display looks promising. But I have two issues with it. It is way too expensive for my budget, and it might be that it requires too much resources (CPU time). For the stepper motor, it is very important to unload the CPU as much as possible. I don't know how "heavy" its library is.
@mahalingamrajaratnam6121
@mahalingamrajaratnam6121 Год назад
Cool project. Can we discuss separately on the project that i am working on.
@CuriousScientist
@CuriousScientist Год назад
Thanks. You have already asked a question under another video. I am not a free support service, so if the question is not related to the video, feel free to hire me as a consultant.
@roelgritter
@roelgritter 4 года назад
Thanks for the tuturial. Can you make a tuturial for Axis control. Home position. Limitswitches. Go go to home, go to target.
@CuriousScientist
@CuriousScientist 4 года назад
Hi! Seems like that you have not checked the playlist as I suggested it in the video...
@aaronscharp1724
@aaronscharp1724 3 года назад
Hello, I am new to arduinos and stepper motors. Are there enough pins on a single arduino to have an LCD, rotary encoder, and two stepper motors (with TB6600s)? If you have a video on this subject, I could not find it. Thanks!
@CuriousScientist
@CuriousScientist 3 года назад
Hi! Check my stepper motor related playlist more carefully. The answer is yes, and the explanation is in the videos. Cheers!
@duicenasty1078
@duicenasty1078 Год назад
HI. Is there a way to get the " stepper.setAcceleration " to work with this code? I have stripped the code down to 2 buttons only. I have changed the RotateCounter++; to RotateCounter = (steps); ( steps = 0 ) Added stepper.setCurrentPosition(1000); and it homes back to (steps ) for one button and stepper.setCurrentPosition(-1000) for the other. As its 1000 steps i would have thought the stepper.setAcceleration Would work
@CuriousScientist
@CuriousScientist Год назад
Hi! Sure, but does it really make sense? In the original scenario, the motor mimics the movement of the rotary encoder which means that 1 click of the encoder is 1 step of the motor. You cannot turn the rotary encoder (by hand) so fast that you would need acceleration. So, it does not really make sense. Also, the functions I used do not implement acceleration (see the library's documentation). If you need acceleration, you will need to rewrite everything that moves the motor.
@duicenasty1078
@duicenasty1078 Год назад
@@CuriousScientist Thanks for the reply. I thought as much.. Well i will have to learn some more (:
@71youths
@71youths 3 года назад
Does something like this exist as a pre-built product I can buy?
@CuriousScientist
@CuriousScientist 3 года назад
Not that I know about. That's why I explain every bit of it, so those who follow the video carefully can built it. Wiring, source code, everything is freely accessible on my website.
@crashy7331
@crashy7331 3 года назад
Thanks sir for the tutorial. But i want to ask how to convert speed unit in mm/minute
@CuriousScientist
@CuriousScientist 3 года назад
It is simple math. You have the units in steps/sec. But your question doesn't make any sense without knowing what mechanism is used with the stepper motor...
@crashy7331
@crashy7331 3 года назад
Im using leadscrew T8 lead 8mm pitch 2mm in vertical mechanism. Can u help sir 🙏
@CuriousScientist
@CuriousScientist 3 года назад
Study this video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-_KfjBPyxpNs.html
@dougdjekic5398
@dougdjekic5398 Год назад
Can this work without the LCD and rotary hooked up? I'm trying to figure out how to make this circuit work with just the push buttons. Sorry new to this..
@CuriousScientist
@CuriousScientist Год назад
Sure, it can work without them, but of course, you lose those functions that the devices provide. And yes, you can make it work with buttons only.
@dougdjekic5398
@dougdjekic5398 Год назад
@@CuriousScientist Thanks for your reply! Will i have to change the code or can I use as is for just the buttons?
@CuriousScientist
@CuriousScientist Год назад
Of course, you will need to adjust the code accordingly.
@dougdjekic5398
@dougdjekic5398 Год назад
@@CuriousScientist Ty very much! I am excited to learn stepper motors.
@scrosby1000
@scrosby1000 3 года назад
Do you not need to power the breadboard somehow. Maybe from the 5v and ground on the UNO. The schematic does not show any power coming from the UNO.
@CuriousScientist
@CuriousScientist 3 года назад
The breadboard is powered with the 5 V rail. Otherwise the buttons would not work. Seems like it was so obvious, I missed it from the schematics. :)
@scrosby1000
@scrosby1000 3 года назад
@@CuriousScientist Ok, so I just place a wire from the 5V on the UNO to the 5v rail on the breadboard and then a wire from the GND on the UNO to the rail on the breadboard?
@CuriousScientist
@CuriousScientist 3 года назад
Yes, exactly. I just missed those 2 connections between the breadboard and the Arduino.
@alexandrematos4031
@alexandrematos4031 4 года назад
Hello, I fantastico your videos, I am following and doing as your explanation, won another subscriber, Congratulations! I would like to collaborate with an information that I observed and I was desperate because it did not compile the file, kkkk, in reality I had not included the LCD library. "LiquidCrystal I2C". as it was not in the description below, I went to look for the reason and found how to include this library, only that was missing.
@CuriousScientist
@CuriousScientist 4 года назад
Thanks! The mentioned LCD library is in the source code. However, if you don't have it installed in your Arduino IDE, the compiler will complain about it.
@scrosby1000
@scrosby1000 3 года назад
Your encoder has 2 pins on one side ( Switch side) and 3 pins on the other side. From the schematic it looks like you wired one side of the switch to VCC and the other side of the switch GND. So that creates a short circuit when I push the switch. Obviously I'm missing something? But what?
@CuriousScientist
@CuriousScientist 3 года назад
Search for the "KY-040 rotary encoder" on Google. It has 5 wires: VCC, GND, SW, DT and CLK. VCC and GND is very obvious, DT and CLK is written in the source code and SW is not used. The software I used to draw the circuit does not have this specific encoder in the models (or at that time, I could not find it), so I just used a general one and indicated the connections to make it clear.
@scrosby1000
@scrosby1000 3 года назад
I bought the same encoder you used in your schematics in order to make this easy The encoder has 2 pins on one side labeled PIN 1 = Switch and pin 2 =GND. The other side has 3 pins labeled Out A, GND and Out B. None of this matches your schematic. Which pin is the equivalent CLK? DT? Which pin do I wire to VCC. Obviously the 5vcc can go to GND, it can't go to the output A or B and it cant go to Switch. There are no other pins left. Rotary-Encoder-For-Dummies.jpg (1600×1053) (thecustomizewindows.com) .
@CuriousScientist
@CuriousScientist 3 года назад
I added an updated drawing to my website with the proper drawing. I hope you appreciate it.
@scrosby1000
@scrosby1000 3 года назад
@@CuriousScientist Well actually it doesn't help. I bought all the same components in order to follow the schematic. Now that you have changed the components I don't have any reference to follow.
@CuriousScientist
@CuriousScientist 3 года назад
You could not buy the same components because the one I show in the video is also in the description of the video and it happens to be the KY-040 encoder. Check my website, this drawing for the 5-pin encoder. curiousscientist.tech/blog/building-a-coil-winder-part-2 You are welcome......
@RodrigoAmorim1
@RodrigoAmorim1 4 месяца назад
endstop ?
@CuriousScientist
@CuriousScientist 4 месяца назад
Endstop what?
@RodrigoAmorim1
@RodrigoAmorim1 4 месяца назад
@@CuriousScientist Is it possible to put endstop?
@CuriousScientist
@CuriousScientist 4 месяца назад
Sure. I have dozens of videos with endstops.
@tudrow6087
@tudrow6087 3 года назад
Could you do assign a button for a fixed position. Or would it need an encoder.
@CuriousScientist
@CuriousScientist 3 года назад
Yes you can do that. Just assign a pin to the button and when you press the button, use the moveTo() function of the accelstepper library to move to that absolute position. Of course you need to tailor the numbers to the specific setup, but once it is done, it works automatically.
@tudrow6087
@tudrow6087 3 года назад
@@CuriousScientist Thank you.
@tudrow6087
@tudrow6087 3 года назад
@@CuriousScientist Thanks I want to make a locomotive turn table for a roundhouse. And I need it to be able to set a button for each track. Thanks again.
@CuriousScientist
@CuriousScientist 3 года назад
Yes, that is easy. You need a home position or zero position that you always use as a starting point. Then, you measure the number of steps from this home position to each tracks. Now, you know that track 1 is let's say 693 steps away from the home, track 2 is 4321 steps....etc. You note these values down and create variables in the code such as track1position = 693, track2position = 4321...etc. Then, you just have to use the buttons in a simple if() condition. In a very simplified algorithm: if(track1button == 1){steppermotor.moveTo(track1position);}. This says that if you pressed the button assigned to track 1, the accelstepper library will move to the track 1's position. The good thing about the moveTo() function is that it uses absolute positions, so for example if you are currently at track 6, the code will know that it has to move backwards to track 1. I hope this helps.
@tudrow6087
@tudrow6087 3 года назад
@@CuriousScientist Thank you and it helped a lot.I have never tried writing code but I am going to give it a try. Thanks again.
@scrosby1000
@scrosby1000 3 года назад
I'm moving a pool table back and forth and need to control acceleration. Basically I thing your setup without the Pot, just 2 buttons would work. one for CCW and one CW. Can you help me with the code?
@CuriousScientist
@CuriousScientist 3 года назад
Do you read my answers at all? I answered you twice already. Check my most recent video, there you have the solution. All code is published and every line of the code is explained in the video. I cannot do more than that, at least not for free.
@scrosby1000
@scrosby1000 3 года назад
@@CuriousScientist I think I have watched about 20 of your videos . Maybe I just didn't watch the right one yet but I haven't seen any way to hook up two buttons to actuate the motor. I will keep watching. Thanks for the GREAT content.
@CuriousScientist
@CuriousScientist 3 года назад
Without any offense, but if you want me to spoon-feed the info to you, then you will find button-controlled stepper motors in the following videos: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-4Wrt7swXjsQ.html ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-eVnZIuAVQEQ.html
@scrosby1000
@scrosby1000 3 года назад
@@CuriousScientist This is my first project so maybe I'm a bit slow to start. This circuit in this video would be perfect if it didn't have the Rotor Encode and LCD. Can I simply remove them from the circuit and hard code the maximum speed in the accelstepper parameter " stepper.setMaxSpeed(5000); //SPEED = Steps / second stepper.setAcceleration(1000); //ACCELERATION = Steps /(second)^2 "
@CuriousScientist
@CuriousScientist 3 года назад
Yes, you just remove the unnecessary hardware and the corresponding code and it will work. The LCD, the buttons and the rotary encode are all independent, so it will not influence anything if you remove them.
@kamesuph7790
@kamesuph7790 2 года назад
Is the SW pin of encoder also required?
@CuriousScientist
@CuriousScientist 2 года назад
Hi! If you don't need the button function of the encoder, then not. DT and CLK are most desired pins for the _encoder_ function.
@kamesuph7790
@kamesuph7790 2 года назад
@@CuriousScientist Thank you very much for what you have shared. it works very well but in your program It limits position to 32767. When the motor reaches position 32767, it reverses the rotation and does not accept switch commands. If I want the motor to spin continuously without any limit. On which line do I have to edit the code?
@CuriousScientist
@CuriousScientist 2 года назад
You're welcome. Based on the value, you have an overflow. Change the type of the variable you use to long or float.
Далее
CNC encoder wheel with stepper motors
35:15
Просмотров 23 тыс.
POLI и Маша - Сигма бой
00:20
Просмотров 329 тыс.
Stepper motor PID control using a TMC2209 and AS5600
45:25
Why Are Guillotine Blades Angled? (tested)
18:40
Просмотров 603 тыс.
Menu with voice & rotary encoder - Arduino
15:01
Просмотров 102 тыс.
HACKED!: Using an HDD Motor as a Rotary Encoder?!
8:21