No video

How To Connect A Stepper Motor With IR Remote Control To Arduino (Lesson 32 of Elegoo Mega 2560 Kit)

  Рет қаралды 10,392

BMonster Laboratory

BMonster Laboratory

Күн бұрын

Пікірлер: 42
@BMonsterLaboratory
@BMonsterLaboratory 3 жыл бұрын
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 kzfaq.info/get/bejne/i8-BasV2v8raf5s.html - Thanks for watching!
@movies4lifers322
@movies4lifers322 3 жыл бұрын
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?
@BMonsterLaboratory
@BMonsterLaboratory 3 жыл бұрын
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
@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
@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
@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
@olivierlandry1195 Жыл бұрын
when i press the remote i see the reciver led but i never see any led into the stepper controler board
@BMonsterLaboratory
@BMonsterLaboratory Жыл бұрын
@@olivierlandry1195 it looks fine so far. Have you tried reducing the delay? Try 500 and 1000 ? That may help.
@BMonsterLaboratory
@BMonsterLaboratory Жыл бұрын
@@olivierlandry1195 I can get the parts and put this together and see how it acts for me. The code looks fine though.
@ramanjeetsingh8684
@ramanjeetsingh8684 3 жыл бұрын
Is there a way to keep the motor rotating until the button is released?
@BMonsterLaboratory
@BMonsterLaboratory 3 жыл бұрын
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~
@SrgntBlntPasser
@SrgntBlntPasser Жыл бұрын
@@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.
@BMonsterLaboratory
@BMonsterLaboratory Жыл бұрын
@@SrgntBlntPasser hey there! Try this video out kzfaq.info/get/bejne/rtF4Zah7zNLbkp8.html 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?
@SrgntBlntPasser
@SrgntBlntPasser Жыл бұрын
@@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.
@SrgntBlntPasser
@SrgntBlntPasser Жыл бұрын
@@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-fp2xd
@AbidHussain-fp2xd 3 жыл бұрын
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 - */
@BMonsterLaboratory
@BMonsterLaboratory 3 жыл бұрын
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
@musaabamerel_ithawi1640
@musaabamerel_ithawi1640 3 жыл бұрын
Can you send me lesson32 please?
@BMonsterLaboratory
@BMonsterLaboratory 3 жыл бұрын
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 -- */
@BMonsterLaboratory
@BMonsterLaboratory 3 жыл бұрын
I'm not sure why the text is crossed out...hmm... Just copy & paste and you'll be fine~
@jamiethompson1082
@jamiethompson1082 3 жыл бұрын
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 -- */
@BMonsterLaboratory
@BMonsterLaboratory 3 жыл бұрын
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.
@jamiethompson1082
@jamiethompson1082 3 жыл бұрын
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
@BMonsterLaboratory
@BMonsterLaboratory 3 жыл бұрын
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.
@BMonsterLaboratory
@BMonsterLaboratory 3 жыл бұрын
@@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.
@jamiethompson1082
@jamiethompson1082 3 жыл бұрын
@@BMonsterLaboratory - Thank you so much - I am looking fwd to getting home from work to try this. Million thx!!
@defnotglitch628
@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
@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
@defnotglitch628 Жыл бұрын
Thank you so much!!!
@BMonsterLaboratory
@BMonsterLaboratory Жыл бұрын
@@defnotglitch628 glad you got it working. Good luck with your projects! 💪👊
@surerollins5179
@surerollins5179 Жыл бұрын
code link?
@BMonsterLaboratory
@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
@surerollins5179 Жыл бұрын
@@BMonsterLaboratory thank you so much
@BMonsterLaboratory
@BMonsterLaboratory Жыл бұрын
You're welcome. Enjoy! 👍
@AbidHussain-fp2xd
@AbidHussain-fp2xd 3 жыл бұрын
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 - */
Big Stepper Motors with Arduino
29:43
DroneBot Workshop
Рет қаралды 1,2 МЛН
Get Started in Electronics #10 - Using the Infrared Remote and Sensor
17:53
Unveiling my winning secret to defeating Maxim!😎| Free Fire Official
00:14
Garena Free Fire Global
Рет қаралды 10 МЛН
Fortunately, Ultraman protects me  #shorts #ultraman #ultramantiga #liveaction
00:10
Bony Just Wants To Take A Shower #animation
00:10
GREEN MAX
Рет қаралды 7 МЛН
Schoolboy Runaway в реальной жизни🤣@onLI_gAmeS
00:31
МишАня
Рет қаралды 3,9 МЛН
Arduino Tutorial 35: Understanding How to Use a Stepper Motor
40:09
Paul McWhorter
Рет қаралды 295 М.
Stepper Motors with Arduino - Controlling Bipolar & Unipolar stepper motors
50:22
Electronics - The ELEGOO MEGA2560 R3 Most Complete Starter Kit.
25:22
RFID Arduino Tutorial - Elegoo The Most Complete Starter Kit
20:39
Hamed Adefuwa
Рет қаралды 10 М.
Beginners Guide To Using Large Stepper Motors: #087
19:49
Jeremy Fielding
Рет қаралды 289 М.
Unveiling my winning secret to defeating Maxim!😎| Free Fire Official
00:14
Garena Free Fire Global
Рет қаралды 10 МЛН