Hi there! great video, loved that you went in depth about everything. Just a question since I'm new to this whole thing, is it possible to create a sequence of clock wise and then counter CW with one button?
@BMonsterLaboratory3 жыл бұрын
Hi there movies4life R&S! Yes, you can create a CW / CCW spin with a push button. Do you want 1 full rotation CW and then 1 Full rotation CCW just once per button push or continuous? Thanks for asking!
@olivierlandry1195 Жыл бұрын
hello bmonster i did try this one i see me that the remote give signal to the remove reciver but nothing move the motor what could be the cause ?
@BMonsterLaboratory Жыл бұрын
Hi Olivier! Did you double check your wiring? Are you using external power for the motor? If yes to both of those, can you share the code you're using ?
@olivierlandry1195 Жыл бұрын
@@BMonsterLaboratory yes i did recheck the whole wiring and i use external power . the little power board have the green led on . ill join the code i used #include "Stepper.h" #include "IRremote.h" /*----- Variables, Pins -----*/ #define STEPS 32 // Number of steps per revolution of Internal shaft int Steps2Take; // 2048 = 1 Revolution int receiver = 12; // Signal Pin of IR receiver to Arduino Digital Pin 6 /*-----( Declare objects )-----*/ // Setup of proper sequencing for Motor Driver Pins // In1, In2, In3, In4 in the sequence 1-3-2-4 Stepper small_stepper(STEPS, 8, 10, 9, 11); IRrecv irrecv(receiver); // create instance of 'irrecv' decode_results results; // create instance of 'decode_results' void setup() { irrecv.enableIRIn(); // Start the receiver } void loop() { if (irrecv.decode(&results)) // have we received an IR signal? { switch(results.value) { case 0xFFA857: // VOL+ button pressed small_stepper.setSpeed(500); //Max seems to be 500 Steps2Take = 2048; // Rotate CW small_stepper.step(Steps2Take); delay(2000); break; case 0xFF629D: // VOL- button pressed small_stepper.setSpeed(500); Steps2Take = -2048; // Rotate CCW small_stepper.step(Steps2Take); delay(2000); break; } irrecv.resume(); // receive the next value digitalWrite(8, LOW); digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(11, LOW); }
@olivierlandry1195 Жыл бұрын
when i press the remote i see the reciver led but i never see any led into the stepper controler board
@BMonsterLaboratory Жыл бұрын
@@olivierlandry1195 it looks fine so far. Have you tried reducing the delay? Try 500 and 1000 ? That may help.
@BMonsterLaboratory Жыл бұрын
@@olivierlandry1195 I can get the parts and put this together and see how it acts for me. The code looks fine though.
@BMonsterLaboratory3 жыл бұрын
I have lots more to learn about stepper motors, for sure! Will definitely have some practical projects using steppers in the future. If you need help setting up the Arduino IDE, check this video out kzbin.info/www/bejne/i5q0aJV7j8mphck - Thanks for watching!
@ramanjeetsingh86843 жыл бұрын
Is there a way to keep the motor rotating until the button is released?
@BMonsterLaboratory3 жыл бұрын
Hi Ramanjeet. Great question! My first instinct would be to post what I think would work. I would like to put this together on a breadboard and test it before I post the code, that way there's no confusion. I'll post it in this thread and on the Facebook page for others to see when I get home from work. Thanks for asking~
@SrgntBlntPasser2 жыл бұрын
@@BMonsterLaboratory I'm currently working on trying to figure this one out too. Have you discovered anything? I'm having a hard time figuring out how to change the speed. It will either move very slow, or slightly faster where each button press is sending a burst of steps, not ideal.
@BMonsterLaboratory2 жыл бұрын
@@SrgntBlntPasser hey there! Try this video out kzbin.info/www/bejne/rpyrY3iAnNGqmM0 After buying a NEMA 17 stepper, I probably won't use the one in this video again. Most stepper motors don't have a fast speed. Higher torque = lower speed. What kind of project are you using a stepper on? Are you using the same sketch as I am in this video?
@SrgntBlntPasser2 жыл бұрын
@@BMonsterLaboratory I'm trying to DIY my own telescope autofocuser. I have it currently working with 2 buttons and a potentiometer. I hold a button down and it rotates continuously at a speed defined by the Pot and it stops when the button is released. But the idea is to not touch the scope so I'm replacing the buttons with the remote and then replace the Pot with a High and Low setting on the remote.
@SrgntBlntPasser2 жыл бұрын
@@BMonsterLaboratory I am extremely close I needed to add a case for when the button in not pressed, and only step 1 time per loop, and set a delay time for each loop. Now I just need to find the max and min delay needed to set my high and low. I'll post a video on my other channel and get back to you when I do!
@AbidHussain-fp2xd3 жыл бұрын
Hello there! I am trying to use two endstop switches with this stepper motor as to controller its limits but I have something wrong in my code can you check it where is the problem please... @/include "Stepper.h" @/include "IRremote.h" /*----- Variables, Pins ----- */ @/define STEPS 32 // Number of steps per revolution of Internal shaft int Steps2Take; // 2048 = 1 Revolution int receiver = 6; // Signal Pin of IR receiver to Arduino Digital Pin 6 /*----( Declare objects )----*/// Setup of proper sequencing for Motor Driver Pins// In1, In2, In3, In4 in the sequence 1-3-2-4 Stepper small_stepper(STEPS, 8, 10, 9, 11); IRrecv irrecv(receiver); // create instance of 'irrecv' decode_results results; // create instance of 'decode_results’ void setup() { irrecv.enableIRIn(); // Start the receiver pinMode(2,INPUT_PULLUP); pinMode(3,INPUT_PULLUP); } void loop() { if (irrecv.decode(&results)) // have we received an IR signal? { switch(results.value) { case 0xF3A9C948: // 3 button pressed if(2!=0){ small_stepper.setSpeed(300); //Max seems to be 700 Steps2Take = 530; // Rotate CW small_stepper.step(Steps2Take);} break; case 0x7FAA9A9A: // 2 button pressed if(3!=0){ small_stepper.setSpeed(300); Steps2Take = -530 ; // Rotate CCW small_stepper.step(Steps2Take);} break; } irrecv.resume(); // receive the next value } } /* -end main loop - */
@jamiethompson10823 жыл бұрын
Thanks a million for doing this, your videos are easy to understand and well explained. I am having and issue however and get this error, can you possibly help me? Thx! Jamie ERROR: Arduino: 1.8.15 (Mac OS X), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)" Sketch uses 9340 bytes (3%) of program storage space. Maximum is 253952 bytes. Global variables use 481 bytes (5%) of dynamic memory, leaving 7711 bytes for local variables. Maximum is 8192 bytes. avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer An error occurred while uploading the sketch This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences. Here is the code I have been trying from Lesson 32, modified as per another issue asking me to delete a value: //www.elegoo.com //2016.12.12 #include "Stepper.h" #include "IRremote.h" /*----- Variables, Pins -----*/ #define STEPS 32 // Number of steps per revolution of Internal shaft int Steps2Take; // 2048 = 1 Revolution int receiver = 12; // Signal Pin of IR receiver to Arduino Digital Pin 6 /*-----( Declare objects )-----*/ // Setup of proper sequencing for Motor Driver Pins // In1, In2, In3, In4 in the sequence 1-3-2-4 Stepper small_stepper(STEPS, 8, 10, 9, 11); IRrecv irrecv(receiver); // create instance of 'irrecv' decode_results results; // create instance of 'decode_results' void setup() { irrecv.enableIRIn(); // Start the receiver } void loop() { if (irrecv.decode()) // have we received an IR signal? { switch(results.value) { case 0xFFA857: // VOL+ button pressed small_stepper.setSpeed(500); //Max seems to be 500 Steps2Take = 2048; // Rotate CW small_stepper.step(Steps2Take); delay(2000); break; case 0xFF629D: // VOL- button pressed small_stepper.setSpeed(500); Steps2Take = -2048; // Rotate CCW small_stepper.step(Steps2Take); delay(2000); break; } irrecv.resume(); // receive the next value digitalWrite(8, LOW); digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(11, LOW); } }/* --end main loop -- */
@BMonsterLaboratory3 жыл бұрын
Hey there Jamie! Thanks for the comment. I appreciate it. Just curious, do you have the correct board, processor, and port selected in the tools menu of IDE? Have you tried uploading with another USB on your computer and using that port? Give that a try and let me know.
@jamiethompson10823 жыл бұрын
Sorry, today is my first day coding and using this gear. I realized that I had not set it to UNO in this case. There are no errors now, but the unit does not work. Not sure if you have any private lessons?! OR if you would simply look at my setup. THX
@BMonsterLaboratory3 жыл бұрын
I was looking at your code. replace the first line of your loop with this "if (irrecv.decode(&results)) // have we received an IR signal?" you just left out the results of your decode. let me know how that works.
@BMonsterLaboratory3 жыл бұрын
@@jamiethompson1082 and if you ever what to email a question...feel free. bmonsterlaboratory@gmail.com I don't do private lesson but I can do my best to help with code.
@jamiethompson10823 жыл бұрын
@@BMonsterLaboratory - Thank you so much - I am looking fwd to getting home from work to try this. Million thx!!
@musaabamerel_ithawi16403 жыл бұрын
Can you send me lesson32 please?
@BMonsterLaboratory3 жыл бұрын
Hi there! Here is the code for Stepper Motor + IR Remote. Just make sure you have the Stepper and IRremote libraries installed at the Arduino IDE. best of luck! 👍 //www.elegoo.com //2016.12.12 #include "Stepper.h" #include "IRremote.h" /*----- Variables, Pins -----*/ #define STEPS 60 // Number of steps per revolution of Internal shaft int Steps2Take; // 2048 = 1 Revolution int receiver = 12; // Signal Pin of IR receiver to Arduino Digital Pin 6 /*-----( Declare objects )-----*/ // Setup of proper sequencing for Motor Driver Pins // In1, In2, In3, In4 in the sequence 1-3-2-4 Stepper small_stepper(STEPS, 8, 10, 9, 11); IRrecv irrecv(receiver); // create instance of 'irrecv' decode_results results; // create instance of 'decode_results' void setup() { irrecv.enableIRIn(); // Start the receiver } void loop() { if (irrecv.decode(&results)) // have we received an IR signal? { switch(results.value) { case 0xFFA857: // VOL+ button pressed small_stepper.setSpeed(500); //Max seems to be 500 Steps2Take = 4000; // Rotate CW small_stepper.step(Steps2Take); delay(2000); break; case 0xFF629D: // VOL- button pressed small_stepper.setSpeed(500); Steps2Take = -6000; // Rotate CCW small_stepper.step(Steps2Take); delay(2000); break; } irrecv.resume(); // receive the next value digitalWrite(8, LOW); digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(11, LOW); } }/* --end main loop -- */
@BMonsterLaboratory3 жыл бұрын
I'm not sure why the text is crossed out...hmm... Just copy & paste and you'll be fine~
@defnotglitch628 Жыл бұрын
Hey BMonster, when I try to verify the code, it says... C:\Users\glitc\AppData\Local\Temp\.arduinoIDE-unsaved2022115-22152-1xbxxv7.htvw\sketch_dec5a\sketch_dec5a.ino:4:10: fatal error: IRremote.h: No such file or directory #include "IRremote.h" ^~~~~~~~~~~~ compilation terminated. exit status 1 Compilation error: IRremote.h: No such file or directory
@BMonsterLaboratory Жыл бұрын
Hi there! you need to download the IRremote library. You can do it through Arduino IDE under library manager or get it from github. It needs to be downloaded before you include it in your program. Hope that helps! 👊👍
@defnotglitch628 Жыл бұрын
Thank you so much!!!
@BMonsterLaboratory Жыл бұрын
@@defnotglitch628 glad you got it working. Good luck with your projects! 💪👊
@surerollins5179 Жыл бұрын
code link?
@BMonsterLaboratory Жыл бұрын
It was from the elegoo mega kit file. here ya go! #include "Stepper.h" #include "IRremote.h" /*----- Variables, Pins -----*/ #define STEPS 32 // Number of steps per revolution of Internal shaft int Steps2Take; // 2048 = 1 Revolution int receiver = 12; // Signal Pin of IR receiver to Arduino Digital Pin 6 /*-----( Declare objects )-----*/ // Setup of proper sequencing for Motor Driver Pins // In1, In2, In3, In4 in the sequence 1-3-2-4 Stepper small_stepper(STEPS, 8, 10, 9, 11); IRrecv irrecv(receiver); // create instance of 'irrecv' decode_results results; // create instance of 'decode_results' void setup() { irrecv.enableIRIn(); // Start the receiver } void loop() { if (irrecv.decode(&results)) // have we received an IR signal? { switch(results.value) { case 0xFFA857: // VOL+ button pressed small_stepper.setSpeed(500); //Max seems to be 500 Steps2Take = 2048; // Rotate CW small_stepper.step(Steps2Take); delay(2000); break; case 0xFF629D: // VOL- button pressed small_stepper.setSpeed(500); Steps2Take = -2048; // Rotate CCW small_stepper.step(Steps2Take); delay(2000); break; } irrecv.resume(); // receive the next value digitalWrite(8, LOW); digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(11, LOW); } }/* --end main loop -- */
@surerollins5179 Жыл бұрын
@@BMonsterLaboratory thank you so much
@BMonsterLaboratory Жыл бұрын
You're welcome. Enjoy! 👍
@AbidHussain-fp2xd3 жыл бұрын
Hello there! I am trying to use two end-stop switches with this stepper motor as to controller its limits but I have something wrong in my code can you check where is the problem, please... @/include "Stepper.h" @/include "IRremote.h" /*----- Variables, Pins ----- */ @/define STEPS 32 // Number of steps per revolution of Internal shaft int Steps2Take; // 2048 = 1 Revolution int receiver = 6; // Signal Pin of IR receiver to Arduino Digital Pin 6 /*----( Declare objects )----*/// Setup of proper sequencing for Motor Driver Pins// In1, In2, In3, In4 in the sequence 1-3-2-4 Stepper small_stepper(STEPS, 8, 10, 9, 11); IRrecv irrecv(receiver); // create instance of 'irrecv' decode_results results; // create instance of 'decode_results’ void setup() { irrecv.enableIRIn(); // Start the receiver pinMode(2,INPUT_PULLUP); pinMode(3,INPUT_PULLUP); } void loop() { if (irrecv.decode(&results)) // have we received an IR signal? { switch(results.value) { case 0xF3A9C948: // 3 button pressed if(2!=0){ small_stepper.setSpeed(300); //Max seems to be 700 Steps2Take = 530; // Rotate CW small_stepper.step(Steps2Take);} break; case 0x7FAA9A9A: // 2 button pressed if(3!=0){ small_stepper.setSpeed(300); Steps2Take = -530 ; // Rotate CCW small_stepper.step(Steps2Take);} break; } irrecv.resume(); // receive the next value } } /* -end main loop - */
@BMonsterLaboratory3 жыл бұрын
Hi Abid! I'm sorry, I just haven't had a chance to try this out. It looks like you're using an IR remote control. Have you double checked the IR button codes? Can you get the code to work at all or do you just get an error message? Great to hear from you