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

preview_player
Показать описание
Learn how to connect a stepper motor with IR (infrared) remote control to your Arduino microcontroller. This is also lesson 32 of the Elegoo Mega 2560 tutorial.
Don't for get to "Like + SUBSCRIBE" ~👍👍

Chapters:
0:00 intro
1:12 components needed
2:03 intro to the 28BYJ-48 stepper motor
3:31 difference between bipolar & unipolar stepper motors
4:50 intro to the ULN2003 stepper motor driver module
6:56 the IR receiver module
7:30 The Arduino IDE code
9:47 stepper motor in action

Stop by and say hello at the Facebook and Twitter pages!

Be sure to check out our other play lists!
---Here is an awesome collection of educational STEM toys you just have to see!
---Do You Love Battery Operated Toys and RC Toys? We thought you did. Check these reviews out!
---Here are some simple and easy to follow Arduino videos for the beginner
--Did you know I have electronic product reviews?
Рекомендации по теме
Комментарии
Автор

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?

movieslifers
Автор

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 ?

olivierlandry
Автор

Is there a way to keep the motor rotating until the button is released?

ramanjeetsingh
Автор

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

break;
case 0x7FAA9A9A: // 2 button pressed
if(3!=0){
small_stepper.setSpeed(300);
Steps2Take = -530 ; // Rotate CCW

break;
}
irrecv.resume(); // receive the next value }
} /* -end main loop - */

AbidHussain-fpxd
Автор

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

delay(2000);
break;

case 0xFF629D: // VOL- button pressed
small_stepper.setSpeed(500);
Steps2Take = -2048; // Rotate CCW

delay(2000);
break;

}

irrecv.resume(); // receive the next value
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
}


}/* --end main loop -- */

jamiethompson
Автор

Hey BMonster, when I try to verify the code, it says...

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

defnotglitch
Автор

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

break;
case 0x7FAA9A9A: // 2 button pressed
if(3!=0){
small_stepper.setSpeed(300);
Steps2Take = -530 ; // Rotate CCW

break;
}
irrecv.resume(); // receive the next value }
} /* -end main loop - */

AbidHussain-fpxd