CNC encoder wheel with stepper motors

  Рет қаралды 23,107

Curious Scientist

Curious Scientist

Күн бұрын

In this video I show you another type of encoder wheel. In some of my previous videos, I showed how to work with a typical rotary encoder or with an absolute encoder and stepper motors. This time, I show you how to utilize the CNC encoder wheels and use them in your stepper motor projects to control the stepper motors.
Please don't forget to subscribe!
Code and schematics: curiousscienti...
If you want to support my work, please consider buying the parts using my affiliate links:
curiousscienti...

Пікірлер: 74
@qcnck2776
@qcnck2776 3 жыл бұрын
Good explanation of the quadrature values coming from the wheel. Though I might say that I was a little confused by the scope pictures of the two channels, until I realised that they were overlapping. I will usually keep a little separation on the vertical axis between the channels. Especially since the rising and falling edges are not easily seen. Thank you for another excellent video!
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Thanks! Yes, the vertical separation maybe was too large between the two signals. When I explained the signals before showing the source code, I also wrote and mentioned that there is a vertical separation, roughly 2.5V to avoid any confusion by the overlapping signals. Maybe I was not clear enough or I was too confusing. Also, I tried to increase the brightness on the scope signal, but this was the maximum. Next time, I will enhance the waves manually and make the edges thicker. Thanks for the feedback, next time I will try to explain and present the things a bit more clearly!
@isidoromaich7226
@isidoromaich7226 3 жыл бұрын
I never realized that an encoder can use directly with a stepper, that's was simply clever. Another great video👍
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Thank you! Yes, this is a neat function of them. I will show some more applications in the future, but right now I am fighting with the post office to receive my missing parts for the upcoming projects.
@martinkeckes
@martinkeckes 2 жыл бұрын
Great Work! and useful! I would like to ask you, if we can bypass the microcontroller, is that possible with any microcontroller and any driver or just in that case as you described... The enable pin must be connected anyway - as GND. But it does not have to be programmed, just ON. Am I right? My second question is about magnetic encoders. Do they appear on the market just in that form like a future part of a stepper - for feedback and alignment? Can I buy it in the shape like mechanical rotary encoder - like CNC wheel or KY-040? If so, could you give me advice where to get it? Thanks and all best for your future projects!!! Martin.
@CuriousScientist
@CuriousScientist 2 жыл бұрын
Hi and thanks! Yeah as long as you use a stepper driver that accepts square waves to control the stepping you can directly connect the wheel to the driver. Also, you can use a switch for the ENA pin. Regarding the magnetic encoders, check my AS5600-related videos on my channel. I even made a board that can be directly attached to NEMA17 stepper motors for the exact purpose you described. Also, recently a viewer recommended a rotary encoder-looking magnetic encoder: P3022-V1-CW360. It is a bit expensive, but it looks quite good.
@martinkeckes
@martinkeckes 2 жыл бұрын
Well, just for better understanding of my second question: I meant magnetic rotary encoder which looks like mechanical rotary encoder and which I can turn and control this way the stepper motors... Many Thanks!!!
@CuriousScientist
@CuriousScientist 2 жыл бұрын
Yes, it is the P3022-V1-CW360. Check it on AliExpress.
@toddroles3234
@toddroles3234 2 жыл бұрын
Your vids and website blogs are great...subscribed and going through them now. I built a pendant for my diy Cnc (arduino controlled)and used a cheap ky01 rotary encoader, but I would like to rebuild the pendant with one of these pulse hand wheels. What is the difference between the 4 and 6 terminal hand wheels?
@CuriousScientist
@CuriousScientist 2 жыл бұрын
Hi and thanks! If I am not wrong, the 6 terminal hand wheel also outputs the inverted versions of the A and B pulses. For general applications, I don't think we need it. I also used the 4 terminal version.
@pgabrieli
@pgabrieli 3 жыл бұрын
nice. any advantage of these CNC wheels compared to the absolute encoder you showed in the previous video? other than you can bypass the MCU, that is (which I don’t need to do). thanks!
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Hi! Seems like the answer I wrote in the morning just disappeared. This encoder/pulse generator is a bit more sturdy, but this is the only advantage that I can think of. The absolute encoder is the absolutely best (pun intended) choice if you are aiming for precision and repeatability. But, it will be the most expensive choice. Also, if you use a proper code, and a bit better components, a simple rotary encoder can do the job too and you can buy multiple of them for the price of the absolute encoder.
@bhgtanable
@bhgtanable Ай бұрын
Awesome vidz as always .... the cnc encoder helps eliminate the need for arduino in harsh environments implementation ... I'm still looking for a wiring diagram that show the by-pass of the arduion module , connecting the encoder directly to the driver ... any directions i should be looking at ... thank in advance.
@CuriousScientist
@CuriousScientist Ай бұрын
Hi, and thanks! What kind of diagram are you looking for? You literally directly connect one of the outputs of the CNC encoder wheel to the step pin...
@thecontrabband9773
@thecontrabband9773 3 жыл бұрын
I just bought the components to make your project. I'll need it for the fence of a DIY milling wood machine. It doesn't matter if it skips a few steps, I'll use a DRO to see the fence move. We hope the cnc encoder will come from china soon. Great explanation!
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Hi! I am glad that you liked my explanation! Let's hope it will arrive soon and safely.
@davidstewart5291
@davidstewart5291 3 жыл бұрын
Does your encoder skip or miss steps if the encoder is turned too fast? There are capacitors added to the pin pf B10 and B11 in your video but not shown on the circuit diagram. Can you tell me how much are the capacitors. I made the circuit as you described but I am experiencing step skipping - a full rotation returns steps of 94 or 101, not exactly 100 every time.
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Hi! The capacitors are 100 nF (104). I think I mentioned this either in this video or in the video I uploaded after this one that sometimes I notice that the number of clicks registered by the microcontroller is not the same as the position of the encoder. It is usually not the speed but the interrupts what is not OK. I have noticed that if I use the oled display, this jumping is more common (afaik, the oled library also uses some interrupts, so those might "compete" with the encoder's interrupts). I think I know the problem and you can see it yourself too if you try the following: put a print command in the A pin's interrupt and print a letter "A", then do the same with the B interrupt. If you rotate clockwise, the serial terminal should show "ABABABAB..." as the output. After just one click, it should show "AB". This is the two square waves I showed in the video. Now, sometimes I noticed that I only get an "A" after a click and if I rotate the wheel one more step, I see "BA" on the terminal. If the microcontroller sees this, it will actually think that you rotated in the CCW direction. So, sometimes something is fishy with the pulses or with the way how they get registered. I will keep working on this, but I also encourage you to play with it!
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Hi! It is mechanically more robust. But that's all in my opinion. If you use a microcontroller and you can afford those absolute encoders, then you should go for them. They are extremely reliable. Otherwise, you can also use rotary encoders from some better manufacturers. They are cheaper than the absolute encoders.
@mattivirta
@mattivirta 4 ай бұрын
i need my linuxcnc all axis own encoder can controller closed loop, but how this can made i not understand code how make and what need, no have many input my paraller port. all has used, probe,limits,end-stop,home switch,
@CuriousScientist
@CuriousScientist 4 ай бұрын
Sorry, it is hard to understand what you want. What's the question? I provided a tutorial and a source code for everything I showed.
@toolmaker1370
@toolmaker1370 2 жыл бұрын
Good Video, I was interested in using the stepper motor driver, pulse generator, and stepper motor. (And power supply). What is the enable wire for that is still connected to the bread board? Do I need it? I don't need the display. Thanks.
@CuriousScientist
@CuriousScientist 2 жыл бұрын
Thanks! The enable wire is pulled to the ground to let the stepper motor driver power the stepper motor.
@milthon57
@milthon57 6 ай бұрын
Great video. Now i can control my old junky lathe with steppers and arduino, I hope I can add one more MPG. with two mpgs it would allow me to use two axis on a lathe. Thanks a lot
@CuriousScientist
@CuriousScientist 6 ай бұрын
If you use a microcontroller that allows more than two interrupt pins (e.g. NOT Arduino Uno or Nano), then you can add many MPGs. I hope your project will be a success! Cheers!
@daryl7237
@daryl7237 3 жыл бұрын
Hi can this project use Arduino nano"?
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Hi! Yes, of course.
@justinmathew130
@justinmathew130 Жыл бұрын
Can please help me, How to use an optical rotary encoder to stop the motor when it rotates a certain amount, I’m building a cablecam, the cable cam should stop automatically when the cable cam reaches a certain distance
@CuriousScientist
@CuriousScientist Жыл бұрын
Hi! Count the number of clicks from the encoder, and if you reach the desired number, stop the motor.
@justinmathew130
@justinmathew130 Жыл бұрын
@@CuriousScientist can you give me an idea for coding
@CuriousScientist
@CuriousScientist Жыл бұрын
I just wrote what to implement. I can not write the code for you for free. If you want, you can hire me.
@justinmathew130
@justinmathew130 Жыл бұрын
@@CuriousScientist okay thank you
@louisfaasen4511
@louisfaasen4511 3 жыл бұрын
Hello, Is Point A Step, Direction or Pulse? Likewise, is Point B Step, Direction or Pulse?
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Hi! It does not matter. They are the same pulses with some delay between them.
@paulhirst3548
@paulhirst3548 Жыл бұрын
Thank you for these tutorials! I have tried this with a TB6600 and an UNO without any luck. I set the pinA = 2 and pinB = 3, also stepper (1, 9, 8); but no luck so far. When I look at the serial monitor ( I do not have the oled yet) I get "CNC" not "CNC encoder test". I changed the baud rate to 9600 in sketch but that did not help. Any suggestions would be helpful. My goal is to dust off my old Teensy2 and run the encoder and limit switches as interrupts while a joystick is used to quick adjustments for a router lift. If anyone could point me in the right direction I would appreciate it. I do understand that this session was uploaded 2 years ago. Take care.
@CuriousScientist
@CuriousScientist Жыл бұрын
Hi! What do you mean by no luck? It does not work at all? Where do you encounter issues? I would suggest only using pinA as an interrupt and defining pinB at 7 for example. If you don't get the full serial message, try inserting a 3-5 second delay right after Serial.begin(115200). Or put a blocking while there. while(!Serial){;}. But when you use the device without the computer, comment out all the serial-related things, otherwise, you will notice some lagging. Also, since I have no idea what's wrong because you haven't told me ("without any luck" is not a good description), it could also be that your wiring is wrong and the TB6600 stays disabled thus the motor won't move.
@paulhirst3548
@paulhirst3548 Жыл бұрын
Sorry, I should have been more specific. The TB6600 is not receiving any signals so the stepper motor does not move. I used pinB to 7 and still no signal. I tried your "Arduino with TB6600 using AccelStepper library" and everything worked fine. I am going to pick up new Dupont connectors and try again.
@CuriousScientist
@CuriousScientist Жыл бұрын
Please drop me an email with your modified code. Also, checking the connections is a great idea. Breadboards sometimes can have poor connections. Recently, I messed up an SD card because of it. 😄
@titanionindustrias2952
@titanionindustrias2952 2 жыл бұрын
magnificent video tutorial !!! it is compatible with arduino uno
@CuriousScientist
@CuriousScientist 2 жыл бұрын
Thanks! Yes, the code, with slight modifications, can work on any Arduino microcontrollers.
@sorankarim5190
@sorankarim5190 Жыл бұрын
@@CuriousScientist Please I need it for Arduino Uno. Send me the code Please. I really need it for University Project. Thank you
@CuriousScientist
@CuriousScientist Жыл бұрын
The code is available, use it. ;)
@sorankarim5190
@sorankarim5190 Жыл бұрын
@@CuriousScientist Thanks
@hernanluis4250
@hernanluis4250 3 жыл бұрын
Hello. I am completely reviewing your youtube channel that I recently discovered. I am a total beginner in programming and your work is a great contribution.I am trying to modify this program to be able to modify the speed of a stepper motor in proportion to the pulses generated in a rotary encoder coupled to another motor. How can I modify the program so that the speed is a function of those encoder pulses? MUCHAS GRACIAS
@hernanluis4250
@hernanluis4250 3 жыл бұрын
How could I generate an arduino program to control a large number of microsteps so as to generate different divisions between the motor and the encoder. The idea is to control a gear cutter shaft with the encoder and move the part to create gears with different number of teeth. Thank you very much for sharing your knowledge!
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Hi! I think you can count the pulses of the encoder, than set up some multiplying factor that connects the number of pulses per second with the number of steps per second. So in this case, you will get a linear response on the pulses.
@intruderEvil
@intruderEvil 3 жыл бұрын
I Try your Code but get this Error: sketch_sep21f:13:12: error: 'PB10' was not declared in this scope int pinA = PB10; // Pin A of the encode
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Probably you're trying to compile it for an Arduino while the pin definition is according to STM32 requirements. You have to modify the pins to make it compatible with Arduino.
@intruderEvil
@intruderEvil 3 жыл бұрын
@@CuriousScientist thx i found this Error 1 Hours ago. Thank you👍
@CuriousScientist
@CuriousScientist 3 жыл бұрын
You are welcome! I hope you could fix it.
@martinkeckes
@martinkeckes 2 жыл бұрын
And now I am also a Patron, Dr. of Curiosity... 🙂
@CuriousScientist
@CuriousScientist 2 жыл бұрын
Thank you very much for the generous support!
@7alfatech860
@7alfatech860 3 жыл бұрын
Thanks for trying out the encoder wheels. They seem nice. A very neat use of the encoder to directly drive the stepper controller!
@CuriousScientist
@CuriousScientist 3 жыл бұрын
It was an excellent suggestion, thanks! Yes, the direct control is so neat. If my packages finally go through the customs, I will be able to build a nice controlling and encoding circuit.
@daryl7237
@daryl7237 3 жыл бұрын
Then I think is my nano problem! Thanks
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Make sure that you define the pins according to the Nano.
@daryl7237
@daryl7237 3 жыл бұрын
hi! Ya I already define it to nano pin
@daryl7237
@daryl7237 3 жыл бұрын
I will change it to oun try again while waiting for my new nano
@thecontrabband9773
@thecontrabband9773 3 жыл бұрын
Hi, just a little question: why did you specify in the description that you need to use pin 2 or 3 for the encoder output A (instead of 10)? Can output B remain on pin 11 (arduino)? Sorry but I have never used the STM32 (I will use arduino Nano). (my cnc encoder is coming soon from china!! :o)) )
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Hi! If you use Arduino Nano, the interrupt pin has to be either 2 or 3. The other pin (pinB) can be any other leg. But you have to be very careful about the definition of the pins. The code on my website is adjusted for STM32, so you need to use different pin descriptions for Arduino. It is not a rocket science, you just need to pay attention.
@thecontrabband9773
@thecontrabband9773 3 жыл бұрын
@@CuriousScientist of course, I have already set the pins on ArduNano, I have added small pieces of code that will be useful to me but, I cannot understand why I have to use pins 2 or 3 only for the encoder A output. I will study the matter, I am not an expert and I want to understand ;o) Thanks again for sharing your studies, I follow you! ;o)
@CuriousScientist
@CuriousScientist 3 жыл бұрын
You are welcome. Arduino Nano and Uno can only use pin 2 and 3 as an interrupt pin, that's why. The STM32 can use nearly all of its pin as an interrupt pin, so if you use that microcontroller, you can pick any of the pins as an interrupt.
@thecontrabband9773
@thecontrabband9773 3 жыл бұрын
​@@CuriousScientist ok, ok, thanks a lot! I am more versed in mechanics but I like to add electronic controls to the machines I build (I really like working wood on weekends). When I have finished the milling machine, if you want, I will send you the photos. Good evening Prof!
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Sure! You can drop me an email via my web page.
@justinmathew130
@justinmathew130 Жыл бұрын
Very nice
@CuriousScientist
@CuriousScientist Жыл бұрын
Thank you!
@stefanguiton
@stefanguiton 3 жыл бұрын
Excellent!
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Thank you!
@gibbs-13
@gibbs-13 3 жыл бұрын
Are you a school teacher or engineer?
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Hi! I am a scientist with a great interest in engineering.
@gibbs-13
@gibbs-13 3 жыл бұрын
@@CuriousScientist are you a scientist at a university in Sweden?
@CuriousScientist
@CuriousScientist 3 жыл бұрын
@@gibbs-13 No.
Testing a capacitive proximity sensor
24:56
Curious Scientist
Рет қаралды 25 М.
Beginners Guide To Using Large Stepper Motors: #087
19:49
Jeremy Fielding
Рет қаралды 293 М.
哈哈大家为了进去也是想尽办法!#火影忍者 #佐助 #家庭
00:33
规则,在门里生存,出来~死亡
00:33
落魄的王子
Рет қаралды 26 МЛН
AS5600 magnetic position encoder - best encoder for stepper motors
48:18
Curious Scientist
Рет қаралды 108 М.
Programming the Arduino Logic for A Custom CNC Pendant!
10:01
DIY Engineering
Рет қаралды 19 М.
Stepper motor PID control using a TMC2209 and AS5600
45:25
Curious Scientist
Рет қаралды 12 М.
Manual Pulse Generator Control Panel for CNC Lathe
4:28
Kent VanderVelden
Рет қаралды 44 М.
How To Use A Rotary Encoder Without Software
29:41
Gadget Reboot
Рет қаралды 16 М.
Big Stepper Motors with Arduino
29:43
DroneBot Workshop
Рет қаралды 1,2 МЛН
This Component solves "All" Motor Problems?! (Motor Encoder) EB#58
11:34
Controlling 3 Stepper Motors with the AccelStepper Library for Arduino
11:49
Closed loop stepper motors -- very impressive
10:46
Matthias random stuff
Рет қаралды 129 М.
Rotary Encoders: A Comprehensive Guide to Understanding and Using Them
7:44
哈哈大家为了进去也是想尽办法!#火影忍者 #佐助 #家庭
00:33