Hardware Required
- Arduino Uno With USB Cable - 1
- Rotary Encoder Module - 1
- Stepper Motor - 1
- ULN2003 Motor Module - 1
- 12V 1A Adapter - 1
- Jumper Wire (male to female) - 40 pcs
- Jumper wire (male to male) - 40 pcs
- 170 pt. Breadboard - 1
Introduction
In this project we have controlled the rotation of Stepper Motor using ULN2003 Motor Driver and Rotary Encoder. The rotation of Rotary Encoder controls clockwise & anticlockwise rotation of Motor.
HARDWARE REQUIRED
- Arduino Uno With USB Cable - 1
- Rotary Encoder Module - 1
- Stepper Motor - 1
- ULN2003 Motor Module - 1
- 12V 1A Adapter - 1
- Jumper Wire (male to female) - 40 pcs
- Jumper wire (male to male) - 40 pcs
- 170 pt. Breadboard - 1
SOFTWARE REQUIRED
Arduino IDE 1.8.5 (programmable platform for Arduino)
Click To Download :https://www.arduino.cc/en/Main/Software
SPECIFICATIONS
Rotary Encoder
A rotary encoder is a component which counts rotations. With a potentiometer, we can only turn so far before the knob will not turn any further. A rotary encoder does not have this problem, it can spin in either direction indefinitely. It can also be pushed in, functioning as a button. We have covered buttons before so we will focus on the rotary encoder for this tutorial. (Essentially the SW pin is of course, just a normal button, treat it the same way as the button module. It is useful for using one knob for an entire setup rather than independent controls for volume, pitch, balance etc.
Arduino Uno
CIRCUIT CONNECTION
- Connect Pins of Stepper Motor with ULN2003 Motor Driver Module.
- Connect Pin IN1 of ULN2003 Motor Driver with Digital Pin 8 of Arduino Uno.
- Connect Pin IN2 of ULN2003 Motor Driver with Digital Pin 9 of Arduino Uno.
- Connect Pin IN3 of ULN2003 Motor Driver with Digital Pin 10 of Arduino Uno.
- Connect Pin IN4 of ULN2003 Motor Driver with Digital Pin 11 of Arduino Uno.
- Connect Pin 5/12V of ULN2003 Motor Driver with Pin 5V of Arduino Uno.
- Connect GND of ULN2003 Motor Driver with GND of Arduino Uno.
- Connect GND of Rotary encoder with GND of Arduino Uno.
- Connect VCC of Rotary encoder with Pin 3.3V of Arduino Uno.
- Connect Pin SW of Rotary encoder with Digital Pin 4 of Arduino Uno.
- Connect Pin DT of Rotary encoder with Digital Pin 3 of Arduino Uno.
- Connect Pin CLK of Rotary encoder with Digital Pin 2 of Arduino Uno.
CODE
"Stepper.h"
https://drive.google.com/open?id=13c9LWB0n6FUBb-FhlbguAAJn7HJbptB8
Install the library given Above
https://drive.google.com/open?id=19_0_vvgeHiTyjiP4cRyaDuzScQdmYPnO
WORKING
Welcome to the Arduino Based Project which consists of ULN2003 Motor Driver Module, Stepper Motor and Rotary Encoders. The basic working principle of Rotary Encoders is being described here. A rotary encoder is a type of position sensor which is used for determining the angular position of a rotating shaft. It generates an electrical signal, either analog or digital, according to the rotational movement.
There are many different types of rotary encoders which are classified by either Output Signal or Sensing Technology. The particular rotary encoder used here is an incremental rotary encoder and it’s the simplest position sensor to measure rotation.
When the disk will start rotating, the pins A and B will start making contact with the common pin and the two square wave output signals will be generated accordingly. Any of the two outputs can be used for determining the rotated position if we just count the pulses of the signal. However, if we want to determine the rotation direction as well, we need to consider both signals at the same time.
We can notice that the two output signals are displaced at 90 degrees out of phase from each other. If the encoder is rotating clockwise the output A will be ahead of output B.
So if we count the steps each time the signal changes, from High to Low or from Low to High, we can notice at that time the two output signals have opposite values. Vice versa, if the encoder is rotating counter clockwise, the output signals have equal values. So considering this, we can easily program our controller to read the encoder position and the rotation direction.