Dc Motor Driver Circuit Using Uln2003



Information about the 28BYJ-48 stepper motor and ULN2003 driver board. The 28BYJ-48 is one of the cheapest stepper motors you can find.Although it is not super accurate or powerful, it is a great motor to use for smaller projects or if you just want to learn about stepper motors. I have posted a project on the greenhouse system in which the relay driver circuit using uln2003 is used to drive four relays. Four relays are connected with four different relays. Check the following link to know more about the practical use of relay driver circuit: Intelligent green house control system. Stepper motor interfacing using Uln2003. A logical circuit with Darlington transistor (NPN) was used to control the High DC load approximately equal to 50V and 500mA. This circuit could only be used for a single load. To solve this issue an IC name ULN2003 was introduced.

This tutorial is an introduction to ULN2003. We will see the features, applications, pinout, and details of all pins and one example at the end of this guide on ULN2003. It is also used as a relay driver.

Why we need UNL2003?

Microcontroller and Microprocessor have an internal program or as we can say a set of functions, which control the voltage at the output and input pins of a single Control Unit. These control functions also help us to generate the timer, PWM, interrupts, and switching method internally without affecting the whole controller circuit. The issue of generating multiple functions was solved by a simple controller and processor.

Now the problem was how to control and minimize the circuit of high voltage DC devices. There was a wide usage of High voltage DC motors due to its energy efficiency. A logical circuit with Darlington transistor (NPN) was used to control the High DC load approximately equal to 50V and 500mA. This circuit could only be used for a single load. To solve this issue an IC name ULN2003 was introduced.

ULN2003 Introduction

ULN2003 comes with multiple functions. It has seven Darlington transistors installed which could help to control 7-Loads at the same time. It comes with 16 pins and multiple packings like SOP, PDIP, TSSOP or SOIC. This could help the user to install the IC with any circuit without taking too much space as a transistors circuit. The output power source could apply separately to all the outputs but the input will be the same as all microcontrollers and microprocessors.

The voltage range for any load is 50V but the current range is 500mA which could be increased by combining the multiple output pins. ULN2003 comes with internal safety protection from back emf. It has an internal flyback protection system which gives protection to the device.

Pinout of ULN2003 IC

PIN CONFIGURATION Description

FEATURES of ULN2003 IC

  • It is able to handle the high DC voltage range of about 50V maxima
  • It comes in another version with a voltage range of 100V.
  • The current handling system is also 500mA for each input.
  • The range of current could be increased by using the two pins for the same load.
  • Comes with an internal clap diode to protect the device from Back EMF Protection
  • ULN2003 has an internal flyback system protection and a pin too which can be used for an inductive load.
  • We can control by any low voltage device like Arduino, Microprocessor or any other controller or IC.
  • It is available in all kind of packages like SOP, PDIP, TSSOP or
  • ULN2003 output is compatible with all the TTL and 5-V CMOS logic
  • It operates without using any power source attached directly to it.

WHERE AND HOW TO USE ULN2003?

ULN2003 could be use any point where we need to control the high DC volts approximately 50V. To use this IC there are some rules which we need to follow to make it work perfectly. Attach any IC or Controller as an Input Source to provide the logical signal to the Input Pins. Then Attach the one end of the load with the output pin. Attach the other end of the load with the Power source of 0 – 50V. Then attach both Grounds of Controller and Power Source with ULN2003 Ground pin to keep in sync with the ULN2003. There is a pin as COM (Pin 9). Attach this pin with the ground through a button.

Proteus Simulation

This button could be used to bypass all the pins and could produce the output. In the case of inductive load protection, this COM pin will be effective for IC safety. The power source of each motor could be different, but the ground should remain common.

APPLICATIONS of ULN2003

  • 7-relays can be controlled with a single ULN2003
  • It is mostly used to control the stepper motor.
  • Inductive loads are also easy to control by using ULN2003
  • High load LED Bulbs can be controlled through it.
  • Efficient to use Logic Buffer in mostly Digital Electronics.
  • It has wide use as a torch sensor with the microcontrollers.

EXAMPLE to Control Multiple loads

We could handle multiple devices with this single device. Just attach the different loads with a different power source with ULN2003. Then Connect each load with a different power source. After that Common the ground with IC. Each Input pin controls each output. Now turn that device on which need to be on by applying High Logic on that input. To test all the pins at the same time or turn on all the devices at the same time Apply High logic at that input. During using ULN2003 always keep in mind that all the power and controllers Ground should be common with ULN2003. If Ground will not common with ULN2003 than it will have no control over the output.

Figure 3: Multiple loads with a single IC

ULN could control multiple devices at the same time or it can also control each device at a different time too. The usage of ULN2003 is easy but due rules and regulations of every IC ULN2003 also need to be followed by its requirement. If a user is not following the rules than it could get burn due to the inductive load or any other power circuit issue. If it isn’t burned than you are lucky and change the pins according to the above, we mentioned.

Tutorials and Projects

You can refer to this guide :

Dc Motor Driver Circuit Diagram

DataSheet

UNL2003 2D Diagram

Stepper motors are great motors for position control. They are a special type of brushless motors that divides a full rotation into a number of equal “steps”. They are usually found in desktop printers, 3D printers, CNC milling machines, and anything else that requires precise positioning control.

Uln2003

One of the inexpensive way to learn about stepper motors is to use 28BYJ-48 stepper motors. They usually come with a ULN2003 based driver board which makes them super easy to use.

Do you know how these stepper motors work?

These stepper motors use a cogged wheel (having 32 teeth) and four electromagnets to rotate the wheel one ‘step’ at a time.

Each HIGH pulse sent, energizes the coil, attracts the nearest teeth of the cogged wheel and drives the motor one step.

The way you pulse these coils greatly affects the behavior of the motor.

  • The sequence of pulses determines the spinning direction of the motor.
  • The frequency of the pulses determines the speed of the motor.
  • The number of pulses determines how far the motor will turn.
Dc Motor Driver Circuit Using Uln2003

The 28BYJ-48 Stepper Motor

The 28BYJ-48 is a 5-wire unipolar stepper motor that runs on 5 volts.

The interesting thing about this motor is that people have been using it in countless applications over the last few decades. It is used in air-conditioner, vending machines and many other applications.

One of the best things about these motors is that they can be positioned accurately, one ‘step’ at a time.

The other advantage is that they are relatively precise in their movement and they are quite reliable since the motor does not use contact brushes.

They generally give good torque even in the stand-still state which is maintained as long as power is supplied to the motor.

The only downside is that they are a bit hungry for power and consume power even when they are not moving.

28BYJ-48 Gear Reduction Ratio

According to the data sheet, when the 28BYJ-48 motor runs in full step mode, each step corresponds to a rotation of 11.25°. That means there are 32 steps per revolution (360°/11.25° = 32).

In addition, the motor has a 1/64 reduction gear set. (Actually its 1/63.68395 but for most purposes 1/64 is a good enough approximation)

What this means is that there are actually 32*63.68395 steps per revolution = 2037.8864 ~ 2038 steps!

28BYJ-48 Power Consumption

The power consumption of the motor is around 240mA.

Because the motor draws too much power, it is best to power it directly from an external 5V power supply rather than drawing that power from the Arduino.

The motor consumes power, even in the stand still state, to maintain its position.

The ULN2003 Driver Board

The motor usually comes with a ULN2003 based driver board.

The ULN2003 is one of the most common motor driver ICs, consisting of an array of 7 Darlington transistor pairs, each pair is capable of driving loads of up to 500mA and 50V. Four out of seven pairs are used on this board.

The board has a connector that mates the motor wires perfectly which makes it very easy to connect the motor to the board. There are also connections for four control inputs as well as power supply connections.

The board has four LEDs that show activity on the four control input lines (to indicate stepping state). They provide a nice visual when stepping.

The board also comes with an ON/OFF jumper to isolate power to the stepper Motor.

ULN2003 Stepper Driver Board Pinout

The pinouts of the ULN2003 stepper driver board are as follows:

IN1 – IN4 pins are used to drive the motor. Connect them to a digital output pins on the Arduino.

GND is a common ground pin.

VDD pin supplies power for the motor. Connect it to an external 5V power supply. Because the motor draws too much power, you should NEVER use the 5V power from your Arduino to power this stepper motor.

Motor Connector This is where the motor plugs into. The connector is keyed, so it only goes in one way.

Sheraton Challenger Lathe Manual Pdf First advertised during 1952 by the Demco Company, the first Sheraton lathe was a direct clone of the long-established belt-drive 9-inch South Bend and manufactured by G. Sheraton at 445 Heidelberg Road in Fairfield suburb of Melbourne, Australia. Sheraton challenger lathe manual.

Wiring 28BYJ-48 Stepper Motor and ULN2003 Driver to Arduino

Now that we know everything about the motor, we can begin hooking it up to our Arduino!

Start by connecting the power supply up to the ULN2003 driver.

Note that it is possible to directly power the stepper motor from the Arduino. However, this is not recommended; as the motor may induce electrical noise onto its power supply lines and this could damage the Arduino.

So, use a separate 5V power supply to power your stepper motors.

Next connect the ground from that power supply to the arduino’s ground. This is very important so that we establish the same voltage reference between the two.

Now connect the driver board’s IN1, IN2, IN3, IN4 to the Arduino digital pins 8, 9, 10, and 11 respectively.

Finally, hook the motor cable from the stepper motor up to the driver board.

Uln2003 Driver Board Datasheet

When you’re done you should have something that looks similar to the illustration shown below.

Arduino Code – Using Built-in Stepper Library

For our first experiment we will make use of the Arduino Stepper Library which comes packaged with your Arduino IDE.

The stepper library takes care of the stepping sequence and makes it straight forward to control a wide variety of stepper motors, both unipolar and bipolar.

Here’s the simple sketch that moves the stepper motor clockwise slowly and then counterclockwise quickly.

Code Explanation:

The sketch starts with including the Arduino Stepper Library.

Next, we define a constant stepsPerRevolution which holds the number of ‘steps’ that the motor will take to complete one revolution. In our case, it’s 2038.

The 28BYJ-48 Unipolar stepper motor has a step sequence of IN1-IN3-IN2-IN4. We will use this information to drive the motor by creating an instance of stepper library called myStepper with the pin sequence of 8, 10, 9, 11.

Make sure you get this right or the motor will not operate properly.

Dc Motor Driver Circuit Using Uln2003

There is nothing to set in the setup function as the Stepper library internally sets the four I/O pins as outputs.

In the loop function, we use the setSpeed() function to set the speed that we wish the stepper motor to move and subsequently use the step() function to tell it how many steps to rotate. Passing a negative number to the step() function reverses the spinning direction of the motor.

First code snippet will turn the motor clockwise very slowly. And the second will turn the motor counterclockwise at a much faster speed.

Arduino Code – Using AccelStepper library

The Arduino Stepper Library is perfectly adequate for simple, single motor applications. But when you want to control multiple steppers, you’ll need a better library.

So, for our next experiment we will make use of an advanced stepper motor library called AccelStepper library. It significantly improves on the standard Arduino Stepper library in several ways:

  • It supports acceleration and deceleration.
  • It supports half-step driving.
  • It supports multiple simultaneous steppers, with independent concurrent stepping on each stepper.

This library is not included in the Arduino IDE, so you will need to install it first.

Library Installation

To install the library navigate to the Sketch > Include Library > Manage Libraries… Wait for Library Manager to download libraries index and update list of installed libraries.

Filter your search by typing ‘accelstepper’. Click on the first entry, and then select Install.

Arduino Code

Here’s the simple sketch that accelerates the stepper motor in one direction and then decelerates to come to rest. Once the motor makes one revolution, it changes the spinning direction. And it keeps doing that over and over again.

Code Explanation:

We start off by including the newly installed AccelStepper library.

Now as we are going to drive our motor at full steps, we will define a constant for this. If you want to drive the motor at half steps, set the constant to 8.

Next, we create an instance of stepper library called myStepper with the pin sequence of 8, 10, 9, 11 (Remember the step sequence for these motors is IN1-IN3-IN2-IN4).

Again, make sure you get this right or the motor will not operate properly.

In the setup function we first set the maximum speed of the motor to a thousand which is about as fast as these motors can go. We then set an acceleration factor for the motor to add acceleration and deceleration to the movements of the stepper motor.

Next we set the regular speed of 200 and the number of steps we’re going to move it to i.e. 2038 (as you recall the 28BYJ-48 with its gearing will move 2038 steps per revolution).

In the loop function, we use an If statement to check how far the motor needs to travel (by reading the distanceToGo property) until it reaches the target position (set by moveTo). Once distanceToGo reaches zero we will move the motor in the opposite direction by changing the moveTo position to the negative of its current position. Wonder pets save the dancing duck save the dalmatian myvi tv.

Now at the bottom of the loop you’ll notice we have called a run() function. This is the most important function, because the stepper will not run until this function is executed.

Control Two 28BYJ-48 Stepper Motors Simultaneously

For our next experiment, we will add a second 28BYJ-48 stepper and ULN2003 driver set to our Arduino to drive two motors simultaneously.

Wiring

Leave the connections you made earlier as they are and wire the new devices as follows:

Once again we will use the separate 5V power supply to supply power to the ULN2003 driver board.

Now connect the second driver board’s IN1, IN2, IN3, IN4 to the Arduino digital pins 4, 5, 6, and 7 respectively.

The following illustration shows the wiring.

Arduino Code

Here’s the sketch that drives one motor at full steps and the second one at half steps. When the motors make one revolution their spinning direction will change. There’s some acceleration and deceleration involved as well.

Code Explanation:

We begin by including the AccelStepper Library.

Now as we are going to drive one motor at full steps and the second one at half steps. We will define two constants for that.

Next, we create two motor objects, one for each motor. We use our pin definitions and the step definitions to set these up.

In the setup function we first set the maximum speed of the stepper1 to a thousand. We then set an acceleration factor for the motor to add acceleration and deceleration to the movements of the stepper motor.

Next we set the regular speed of 200 and the number of steps we’re going to move it to i.e. 2038 (as you recall the 28BYJ-48 with its gearing will move 2038 steps per revolution).

We’re going to do exactly the same thing for stepper2 except we’ll instruct it to move to -2038 because we want it to move counterclockwise.

In the loop function, we use two If statements, one for each motor, to check how far the motors need to travel (by reading the distanceToGo property) until they reach their target positions (set by moveTo). Once distanceToGo reaches zero, we will change their moveTo position to the negative of their current position, so that they start moving in the opposite direction.

Dc Motor Driver Circuit Using Uln2003 Switch

Finally we set them into motion by calling the run() function.