Control a Stepper Motor using an IR Remote and an Arduino
Here’s a fun and easy way to control a Stepper motor at 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.
Since we don’t want to drive the motor directly from the UNO, we will be using an inexpensive little breadboard power supply that plugs right on our breadboard and power it with a 9V 1Amp power supply.
The IR sensor is connected to the UNO directly since it uses almost no power.
We are using 4 pins to control the Stepper and 1 pin for the IR sensor.
Pin 8-11 are controlling the Stepper motor and pin 6 in Receiving the IR information.
We connect the 5V and Ground from to UNO to the sensor and as a precaution, use a breadboard power supply to power the Stepper motor since it can use more power and we don’t want to damage the power supply of the UNO.
We use 2 Libraries in our Sketch: “IRremote” and “Stepper”.
The “Stepper” library is included by default with the Arduino Software install.
You will need to download the “IRremote” library and extract it to your Library folder.
The code below only recognize 2 values from the IR Remote control: UP and DOWN.
When UP is pressed on the remote the motor will make a full rotation clockwise.
DOWN will make a full rotation counter-clockwise.
As always you can have a look at the tutorial video for more information.
Copy and paste the above code in the Arduino IDE to program your Arduino.
Download the IRremote created by Ken Shirriff here: https://github.com/z3t0/Arduino-IRremote
Once downloaded, just extract the content of the zip files inside your “arduino/libraries” folder.