Arduino SA
  • Learn @ Arduino SA
  • Arduino Introduction
  • Support
    • Setup your Computer
    • Adding Libraries
    • Setting up a ESP32
  • Arduino Robot Car
    • Arduino Bluetooth Car
      • What you will need
      • Circuit Diagram
      • Assembly the Car
      • Upload the Code
      • Bluetooth setup and Test
    • 4WD Obstacle Avoidance
      • Introduction
      • Component List
      • Assembly
      • Component Description
      • Circuit Diagram
      • Computer Setup
      • Line Tracking Mode
      • Obstacle Avoidance Mode
  • Arduino Kits
    • Smart Plant Watering Kit
      • What you will need
      • Wiring Diagram
      • The Code
      • Pics
    • Basic Starter Kit
      • Component View
      • Installing the IDE
      • Add Libraries
      • Blink
      • Button Control LED Delay Switch
      • Active Buzzer
      • Passive Buzzer
      • Servo
      • IR Remote and Receiver
      • Stepper Motor
      • Eight LED with 74HC595
      • LCD
      • Digital tube with Traffic Light Experiment
      • Four digit tube display
      • LM35D Temperature Sensor
      • LDR 5516 experiment
      • Flame Sensor
      • 8 * 8 LED Module
      • Controlling Stepper Motor With Remote
    • Super Starter Kit
      • Tutorials
    • Best Beginner Kit for Arduino
      • Tutorials
    • Uno R3 RFID Kit
    • WIFI ESP32 IOT Kit
    • Arduino School STEM Kit
    • Arduino Ultimate Starter Kit
  • Blocking Coding Lessons
    • Beginner Lessons
      • Setting up mBlock
      • Blinking an LED
      • LED Switching
      • LED Chasing
      • Traffic Signal
      • Buzzer
      • Buzzer + Push Button
      • LED + Push Button
  • Sensor Kits
    • 37-in-1 Sensor Kit
      • Joystick
      • Relay
      • Big Sound
      • Small Sound
      • Tracking
      • Avoid
      • Flame
      • Linear Hall Sensor
      • Touch
      • Digital Temperature
      • Buzzer
      • Passive Buzzer
      • RGB LED
      • SMD RGB
      • Two-Color 5mm
      • Two Color 3mm
      • Reed Switch
      • Mini Reed
      • Heartbeat
      • 7 color flash
      • Laser emitter
      • PCB mounted push Button
      • Shock switch
      • Rotary encoder
      • Light Cup
      • Tilt Switch
      • Rolling ball tilt switch
      • Photoresistor
      • Temp and Humidity
      • Analog Hall
      • Hall Magnetic
      • Temp
      • Analog Temp
      • IR Emission
      • IR Receiver
      • Tap Module
      • Light blocking
Powered by GitBook
On this page
  • Overview
  • Component Required
  • Connection Diagram
  • Wiring schematic
  • Physical wiring diagram
  • Library Files Required
  • Code

Was this helpful?

  1. Arduino Kits
  2. Basic Starter Kit

Controlling Stepper Motor With Remote

In this lesson, you will learn a fun and easy way to control a stepper motor from a distance using an IR remote control.

Previous8 * 8 LED ModuleNextSuper Starter Kit

Last updated 3 years ago

Was this helpful?

Overview

In this lesson, you will learn a fun and easy way to control a stepper motor from a distance using an IR remote control.

The stepper we are using comes with its own driver board making it easy to connect to our UNO R3.

The IR sensor is connected to the UNO R3 directly since it uses almost no power.

Component Required

  • 1 x Arduino UNO R3

  • 1 x IR receiver module

  • 1 x IR remote

  • 1 x ULN2003 stepper motor driver module

  • 1 x Stepper motor

  • 7 x F-M wires (Female to Male DuPont wires)

  • 2 x M-M wire (Male to Male jumper wire)

Connection Diagram

Wiring schematic

Physical wiring diagram

Library Files Required

Please include the Stepper.zip and IRremote.zip to your Library. Download the files below

Code

#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 0xFFE01F:  // “—”button pressed
        small_stepper.setSpeed(500); //Max seems to be 500
        Steps2Take  =  2048;  // Rotate CW
        small_stepper.step(Steps2Take);
        delay(2000);
        break;

      case 0xFFA857: // “+” 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 -- */
33KB
IRremote.zip
archive
10KB
Stepper.zip
archive
1KB
18_Controlling_Stepper_Motor_With_Remote.ino