In fact, you have shared the most used and needed information. :) Those who exchange this for high prices will be very angry with you :) As a Muslim, I hope you will be as materially and spiritually happy as the total happiness of the people who benefit from this video.
Thank you very much! I think the fly was suspecting something... :) I will actually add an AS5048A sensor to this actuator. I just need some time to draw and print a bracket for the circuit and write some code for the closed loop control. But I will definitely make this happen!
Hi and thanks! I am located in Scandinavia. I haven't really done any collabs so far, but I worked on several private projects/assignments related to the content I publish here on RUclips.
Hello, I am a newbie learning code and was playing around with your code and was wondering how I would go about converting Milimeter to imperial in the code. I live in the US, and I would like my tinker project to display imperial. Any help would be highly appreciated.
Hi! It's the same way as you would do it on paper. Multiply the millimeters by 0.0394, so you get the result in inches. Or you can substitute the pitch with the imperial unit (I guess you use TPI over there) and then get the result in inches directly. Both could work.
@CuriousScientist thank you for your feedback. I have watched a few of your videos and wanted to let you know you're doing an amazing job, and thanks for sharing your incredible talent.
Thank you very much for making such informative videos. I am having a hard time getting it done for me. The library for nokia N5110 is not working appropriately. I didn't see anything on screen except the light. I don't know why may be the N5110 display is bad. However, I ordered it from your link. And can you please also let me know about pins of rotary encoder which one is clk , Dt, and switch as the one which I got has pins S1, S2, and key.
Hi! If you use the exact same procedure as I did; same parts, same libraries, same code (my code), then it should work. Regarding the rotary encoder, it does not matter which is the CLK and which is the DT pin. If you swap them, you will only get the opposite behaviour, but nothing gets damaged. You can flip the wires and do everything as usual. S1 and S2 are CLK and DT and the key pin is the SW (switch).
Thanks and one more question . Stm32 does not have any function to digitalPinToInterrupt in the following line. attachInterrupt(digitalPinToInterrupt(RotaryCLK), RotaryEncoder, CHANGE);
I got an error that stm32 blue bill does not understand digitalPinToInterrupt as its defined before in the following line of code. attachInterrupt(digitalPinToInterrupt(RotaryCLK), RotaryEncoder, CHANGE);
So i did a little research and found that AccelStepper with distance 1.0.4 is in millimeter distance. Is this where the code would be to convert from mm to imperial? Like i said, I'm a newbie and bound and determined to figure this out. Hopefully with a little bit of help😊
Hi Pal !! Your video series related to stepper motor is really helpful. I need to complete a project using a linear actuator based on the NEMA 23. The project contains keeping the sliding part at 20 mm from the other end (making it Home) and giving it a stroke length ranging from 1 mm to 20 mm. And in every stoke length, the frequency of reciprocating motion of the sliding part can also vary ranging from 1 Hz to 10 Hz. Can you plz let me know if it is possible to achieve this way of motion?
Hi! You didn't mention anything about the load scenarios... But, to cover 20 mm while oscillating with 10 Hz sounds reasonable. But you need to consider load, acceleration, inertia...etc.
@@CuriousScientist there will be a 3d printed attachment on the top part. the weight will be possibly 100 gm max. the attachment is supposed to perform reciprocating motion(different stroke lengths with different frequencies) and also to hit a wall against it. the wall will be fixed at the other end of the linear actuator.
I have a question concering the LimitSwitchPressed() function you are using. For my realisation I found it easier to use the attachInterrupt() and then trigger a stopMotor() function as you did in your old homing video. When I now trigger it, with the stopMotor() function defined as below, then after triggering it stops immediately (that I want) entering another command it still proceeds to decelerate (where it left off) and then turns around and goes to the value selected. Would you happen to know how I can make it so that it does not "decelerate" since that is quite pointless? And another question is, if there would be a away to implement the while from the LimitSwitchPressed() into the attachInterrupt() based function. I don't seem to get it to work unfortunately, playing with the setup and the digitalRead 0 or 1 values. void LimitSwitchPressed() { if (digitalRead(pinCrash) == 0) { //0 or 1, depends on the wiring! if (millis() - previousInterrupt > 300) { stepper.stop(); //"soft" stop - decelerates to 0. previousInterrupt = millis(); //Alternatively we can make it to go to a specific place: //stepper.moveTo(0); //This goes back to absolute 0, which is technically the homing } while (digitalRead(pinCrash) == 0) { //0 or 1, depends on the wiring! stepper.setSpeed(500); stepper.runSpeed(); } //stepper.setCurrentPosition(0); //Set the new position to zero } } void stopMotor() { //Function activated by the pressed microswitch runallowed = false; //Disable running Serial.println("Stopped by crash sensor."); stepper.stop(); stepper.disableOutputs(); //Disable power Serial.print("Current position: "); Serial.println(stepper.currentPosition()); //stepper.setCurrentPosition(0); // reset position }
As long as you use the run() function it will decelerate. Read the documentation of the AccelStepper library. Try to put a runToPosition() command right after the stop() command, it should help. You should not run anything in the ISR(). Just switch a flag and do the task in the loop() based on the flag's (a bool variable) status. Also, please not that I am not a free consulting service. I cannot keep solving the questions.
@@CuriousScientist First of all, thank you I will check it out. Secondly, I understand and it was not really intended that way, more of a discussion that any viewer of this video could answer. I did not plan on asking other questions or expect them to be (fully) answered.
How fast can this thing be? I am playing with the idea of making an inverted pendulum. But maybe stepper motor and ballscrew isnt fast enough for that?
I don't know, but it depends on different things. Your question is a bit underdetermined. What acceleration is needed? How much load do you want to put on it...etc?
I am facing a problem while using this code. I pasted the exact code in the arduino IDE, include the N5110 library but when I try to compile the sketch, it returns an error everytime saying that, "N5110_SPI.h: no such file or directory." Can anyone please help me out?
Based on the error message, you don't have the library installed. It should be installed in your Arduino/libraries folder. Including the library doesn't matter if there's nothing to include.
This seems to be your earliest video where you have used STM32F103C8T6 Blue Pill and have described the code in detail. I'm just wondering whether you used the Arduino IDE to upload the code to the Blue Pill and whether you also used the STM32 ST-LINK Utility as you described in another video "STM32F103C with ST-Link and STM32duino, simplified!" (ruclips.net/video/saolJ_7E7hc/видео.html). How would it be different if you had only used the STM32CubeIDE with the ST-Link V2 dongle?
Hi! Typically, when you buy a Blue Pill, they come with a pre-installed bootloader. That means that you can directly connect to them via USB and upload the software from Arduino IDE. I was not using the ST-Link in this case. The video that you are referring to is a guide for those who want to install the bootloader on the Blue Pill, or for those who want to program the microcontroller with the ST-Link. The bootloader is just a convenience which allows us to upload our code to the circuit through a USB connection. Regarding your last question, I would say that it would be _entirely_ different. The CubeIDE uses a totally different syntax (HAL), so even the code would be totally different. You would need to write everything from scratch. Programming-wise, you just need to connect the 3.3 V, GND, IO and CLK to the board and upload it using the ST-Link. It is simple.
Hi! Both MCUs came with bootloader, so I could program them via USB. Once again, from an oversimplified perspective, the bootloader is only a convenience for us users that allows us to upload our code via USB. We do not need the bootloader to upload the code to the microcontroller. You can use the ST-Link and upload the code directly with the ST-link. In the Part 8 of my coil winder video series I show how to configure the IDE to be able to use the ST-Link to upload code to the microcontroller. Then I also used the ST-Link to get that code on the MCU.
@@CuriousScientist Sorry, I must have missed that bit, i.e. "how to configure the IDE to be able to use the ST-Link to upload code", in Part 8 of the Coil Winder video series. However, I did find other videos on this topic which also describe the need to set the Arduino IDE Upload method to "STM32CubeProgrammer (SWD)", among the other things. The need to run STM32CubeProgrammer with the ST-Link connected to a USB port is explained in some of those other videos. They say that STM32CubeProgrammer just needs to be opened and then closed. I think I saw one video where STM32CubeProgrammer was able to CONNECT to a target (STM32F103C8 blue pill/STM32F401CCU6 black pill?) which was connected to a ST-LINK V2. However I have not been able to replicate that (CONNECTING to a STM32F401CCU6 black pill using STM32CubeProgrammer and ST-Link V2). It does not seem to matter though, because Arduino IDE is still successful uploading code (to a STM32F401CCU6 black pill) via the ST-Link V2 when the upload method is set to "STM32CubeProgrammer (SWD)".
Wrong. I was using low microstepping value (I think, I used 400 steps/turn or something like that) which is of course noisy. I could've used 1600 or 3200 steps/turn which would've rendered the motor almost entirely silent. Additionally, my table also amplifies all kinds of vibrations which you could also hear. Finally, your suggestion is bad, because the TMC2208 is rated for 1.4 A continuous current whereas this stepper motor is rated for 3 A. Also, the TMC2208 is more expensive. :)
In fact, you have shared the most used and needed information. :) Those who exchange this for high prices will be very angry with you :) As a Muslim, I hope you will be as materially and spiritually happy as the total happiness of the people who benefit from this video.
Wait until you see the rest of my channel. :)
I wish you the same!
Awesome demonstration 👍
The fly said: maybe this device is modifiable to add a linear sensor or an encoder to the shaft to get a closed loop system
Thank you very much! I think the fly was suspecting something... :) I will actually add an AS5048A sensor to this actuator. I just need some time to draw and print a bracket for the circuit and write some code for the closed loop control. But I will definitely make this happen!
I'm just halfway into this video but this is exactly what I needed to know. Thanks a lot!
I am happy to hear it. I will keep expanding and improving this code and control panel, so make sure you check back regularly.
@@CuriousScientist Great to hear that! I definetly will!
Great video, looking forward to watch. Thanks for the time and effort.
Appreciate it.
Hi! Thank you very much! I hope you will like it!
Looking forward to watching this, your videos are fantastic and no doubt this will be the same
Thank you very much! I hope you will like it. Don't forget to check back occasionally as I add more and more features to this control panel.
Surperb presentation, really well explained
Thank you very much! It is encouraging to read such comments!
Excellent CS! Thanks for sharing
Thanks! I am glad you like it!
This is great! Thank you!
I am glad you liked it!
Hi there...Love your content . Where are you located ? Do you ever collaborate on projects ?
Hi and thanks! I am located in Scandinavia. I haven't really done any collabs so far, but I worked on several private projects/assignments related to the content I publish here on RUclips.
Hello, I am a newbie learning code and was playing around with your code and was wondering how I would go about converting Milimeter to imperial in the code. I live in the US, and I would like my tinker project to display imperial. Any help would be highly appreciated.
Hi! It's the same way as you would do it on paper. Multiply the millimeters by 0.0394, so you get the result in inches. Or you can substitute the pitch with the imperial unit (I guess you use TPI over there) and then get the result in inches directly. Both could work.
@CuriousScientist thank you for your feedback. I have watched a few of your videos and wanted to let you know you're doing an amazing job, and thanks for sharing your incredible talent.
Thank you! I am trying my best.
Thank you very much for making such informative videos.
I am having a hard time getting it done for me. The library for nokia N5110 is not working appropriately.
I didn't see anything on screen except the light.
I don't know why may be the N5110 display is bad. However, I ordered it from your link. And can you please also let me know about pins of rotary encoder which one is clk , Dt, and switch as the one which I got has pins S1, S2, and key.
Hi! If you use the exact same procedure as I did; same parts, same libraries, same code (my code), then it should work. Regarding the rotary encoder, it does not matter which is the CLK and which is the DT pin. If you swap them, you will only get the opposite behaviour, but nothing gets damaged. You can flip the wires and do everything as usual. S1 and S2 are CLK and DT and the key pin is the SW (switch).
Thanks and one more question .
Stm32 does not have any function to digitalPinToInterrupt in the following line. attachInterrupt(digitalPinToInterrupt(RotaryCLK), RotaryEncoder, CHANGE);
What's the question?
I got an error that stm32 blue bill does not understand digitalPinToInterrupt as its defined before in the following line of code.
attachInterrupt(digitalPinToInterrupt(RotaryCLK), RotaryEncoder, CHANGE);
Probably a bracket ("{" or "}") is missing somewhere. Check the code.
So i did a little research and found that AccelStepper with distance 1.0.4 is in millimeter distance. Is this where the code would be to convert from mm to imperial? Like i said, I'm a newbie and bound and determined to figure this out. Hopefully with a little bit of help😊
Sorry but I have no idea about what you're talking about. Accelstepper doesn't use mm units, only steps are used.
amazing job man! just a question, is possible to convert everything from steps to mm?
Thanks! Yes, I explained it in the video.
Hi Pal !! Your video series related to stepper motor is really helpful. I need to complete a project using a linear actuator based on the NEMA 23. The project contains keeping the sliding part at 20 mm from the other end (making it Home) and giving it a stroke length ranging from 1 mm to 20 mm. And in every stoke length, the frequency of reciprocating motion of the sliding part can also vary ranging from 1 Hz to 10 Hz. Can you plz let me know if it is possible to achieve this way of motion?
Hi! You didn't mention anything about the load scenarios... But, to cover 20 mm while oscillating with 10 Hz sounds reasonable. But you need to consider load, acceleration, inertia...etc.
@@CuriousScientist there will be a 3d printed attachment on the top part. the weight will be possibly 100 gm max. the attachment is supposed to perform reciprocating motion(different stroke lengths with different frequencies) and also to hit a wall against it. the wall will be fixed at the other end of the linear actuator.
I have a question concering the LimitSwitchPressed() function you are using. For my realisation I found it easier to use the attachInterrupt() and then trigger a stopMotor() function as you did in your old homing video. When I now trigger it, with the stopMotor() function defined as below, then after triggering it stops immediately (that I want) entering another command it still proceeds to decelerate (where it left off) and then turns around and goes to the value selected. Would you happen to know how I can make it so that it does not "decelerate" since that is quite pointless?
And another question is, if there would be a away to implement the while from the LimitSwitchPressed() into the attachInterrupt() based function. I don't seem to get it to work unfortunately, playing with the setup and the digitalRead 0 or 1 values.
void LimitSwitchPressed() {
if (digitalRead(pinCrash) == 0) { //0 or 1, depends on the wiring!
if (millis() - previousInterrupt > 300) {
stepper.stop(); //"soft" stop - decelerates to 0.
previousInterrupt = millis();
//Alternatively we can make it to go to a specific place:
//stepper.moveTo(0); //This goes back to absolute 0, which is technically the homing
}
while (digitalRead(pinCrash) == 0) { //0 or 1, depends on the wiring!
stepper.setSpeed(500);
stepper.runSpeed();
}
//stepper.setCurrentPosition(0); //Set the new position to zero
}
}
void stopMotor() { //Function activated by the pressed microswitch
runallowed = false; //Disable running
Serial.println("Stopped by crash sensor.");
stepper.stop();
stepper.disableOutputs(); //Disable power
Serial.print("Current position: ");
Serial.println(stepper.currentPosition());
//stepper.setCurrentPosition(0); // reset position
}
As long as you use the run() function it will decelerate. Read the documentation of the AccelStepper library. Try to put a runToPosition() command right after the stop() command, it should help. You should not run anything in the ISR(). Just switch a flag and do the task in the loop() based on the flag's (a bool variable) status.
Also, please not that I am not a free consulting service. I cannot keep solving the questions.
@@CuriousScientist First of all, thank you I will check it out. Secondly, I understand and it was not really intended that way, more of a discussion that any viewer of this video could answer. I did not plan on asking other questions or expect them to be (fully) answered.
How fast can this thing be? I am playing with the idea of making an inverted pendulum. But maybe stepper motor and ballscrew isnt fast enough for that?
I don't know, but it depends on different things. Your question is a bit underdetermined. What acceleration is needed? How much load do you want to put on it...etc?
Thanks!
Thank you!
I am facing a problem while using this code. I pasted the exact code in the arduino IDE, include the N5110 library but when I try to compile the sketch, it returns an error everytime saying that, "N5110_SPI.h: no such file or directory." Can anyone please help me out?
Based on the error message, you don't have the library installed. It should be installed in your Arduino/libraries folder. Including the library doesn't matter if there's nothing to include.
This seems to be your earliest video where you have used STM32F103C8T6 Blue Pill and have described the code in detail. I'm just wondering whether you used the Arduino IDE to upload the code to the Blue Pill and whether you also used the STM32 ST-LINK Utility as you described in another video "STM32F103C with ST-Link and STM32duino, simplified!" (ruclips.net/video/saolJ_7E7hc/видео.html). How would it be different if you had only used the STM32CubeIDE with the ST-Link V2 dongle?
Hi!
Typically, when you buy a Blue Pill, they come with a pre-installed bootloader. That means that you can directly connect to them via USB and upload the software from Arduino IDE. I was not using the ST-Link in this case.
The video that you are referring to is a guide for those who want to install the bootloader on the Blue Pill, or for those who want to program the microcontroller with the ST-Link. The bootloader is just a convenience which allows us to upload our code to the circuit through a USB connection.
Regarding your last question, I would say that it would be _entirely_ different. The CubeIDE uses a totally different syntax (HAL), so even the code would be totally different. You would need to write everything from scratch. Programming-wise, you just need to connect the 3.3 V, GND, IO and CLK to the board and upload it using the ST-Link. It is simple.
Hi! Both MCUs came with bootloader, so I could program them via USB. Once again, from an oversimplified perspective, the bootloader is only a convenience for us users that allows us to upload our code via USB. We do not need the bootloader to upload the code to the microcontroller. You can use the ST-Link and upload the code directly with the ST-link.
In the Part 8 of my coil winder video series I show how to configure the IDE to be able to use the ST-Link to upload code to the microcontroller. Then I also used the ST-Link to get that code on the MCU.
@@CuriousScientist Sorry, I must have missed that bit, i.e. "how to configure the IDE to be able to use the ST-Link to upload code", in Part 8 of the Coil Winder video series. However, I did find other videos on this topic which also describe the need to set the Arduino IDE Upload method to "STM32CubeProgrammer (SWD)", among the other things.
The need to run STM32CubeProgrammer with the ST-Link connected to a USB port is explained in some of those other videos. They say that STM32CubeProgrammer just needs to be opened and then closed.
I think I saw one video where STM32CubeProgrammer was able to CONNECT to a target (STM32F103C8 blue pill/STM32F401CCU6 black pill?) which was connected to a ST-LINK V2. However I have not been able to replicate that (CONNECTING to a STM32F401CCU6 black pill using STM32CubeProgrammer and ST-Link V2). It does not seem to matter though, because Arduino IDE is still successful uploading code (to a STM32F401CCU6 black pill) via the ST-Link V2 when the upload method is set to "STM32CubeProgrammer (SWD)".
very noisy controller, you better use TMC2209, silent step
If you buy me, sure I will use it.
very noisy motor. you should use TMC2208 you will get a much better performances from the motor and also less space used by the driver .
Wrong. I was using low microstepping value (I think, I used 400 steps/turn or something like that) which is of course noisy. I could've used 1600 or 3200 steps/turn which would've rendered the motor almost entirely silent. Additionally, my table also amplifies all kinds of vibrations which you could also hear. Finally, your suggestion is bad, because the TMC2208 is rated for 1.4 A continuous current whereas this stepper motor is rated for 3 A. Also, the TMC2208 is more expensive. :)
Boring
Don't watch it then. 🙃